| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include <cstring> | ||
| 2 | #include <set> | ||
| 3 | #include <stdio.h> | ||
| 4 | |||
| 5 | #include "base/qrs.h" | ||
| 6 | #include "base/dmap.h" | ||
| 7 | #include "zc/hero.h" | ||
| 8 | #include "zc/guys.h" | ||
| 9 | #include "subscr.h" | ||
| 10 | #include "zc/replay.h" | ||
| 11 | #include "zc/zc_ffc.h" | ||
| 12 | #include "zc/zc_subscr.h" | ||
| 13 | #include "zc/decorations.h" | ||
| 14 | #include "gamedata.h" | ||
| 15 | #include "zc/zc_custom.h" | ||
| 16 | #include "zc/title.h" | ||
| 17 | #include "zc/ffscript.h" | ||
| 18 | #include "drawing.h" | ||
| 19 | #include "zc/combos.h" | ||
| 20 | #include "base/zc_math.h" | ||
| 21 | #include "user_object.h" | ||
| 22 | #include "slopes.h" | ||
| 23 | #include "zinfo.h" | ||
| 24 | #include "base/misctypes.h" | ||
| 25 | #include "music_playback.h" | ||
| 26 | |||
| 27 | extern HeroClass Hero; | ||
| 28 | extern ZModule zcm; | ||
| 29 | extern zcmodule moduledata; | ||
| 30 | extern refInfo playerScriptData; | ||
| 31 | #include "zscriptversion.h" | ||
| 32 | #include "particles.h" | ||
| 33 | #include <fmt/format.h> | ||
| 34 | #include "zc/render.h" | ||
| 35 | |||
| 36 | extern refInfo *ri; //= NULL; | ||
| 37 | extern int32_t(*stack)[MAX_SCRIPT_REGISTERS]; | ||
| 38 | extern portal mirror_portal; | ||
| 39 | using std::set; | ||
| 40 | |||
| 41 | extern int32_t skipcont; | ||
| 42 | |||
| 43 | extern int32_t draw_screen_clip_rect_x1; | ||
| 44 | extern int32_t draw_screen_clip_rect_x2; | ||
| 45 | extern int32_t draw_screen_clip_rect_y1; | ||
| 46 | extern int32_t draw_screen_clip_rect_y2; | ||
| 47 | |||
| 48 | int32_t hero_count = -1; | ||
| 49 | int32_t hero_animation_speed = 1; //lower is faster animation | ||
| 50 | static int32_t z3step = 2; | ||
| 51 | 357 | static zfix hero_newstep(1.5); | |
| 52 | 357 | static zfix hero_newstep_diag(1.5); | |
| 53 | bool did_scripta=false; | ||
| 54 | bool did_scriptb=false; | ||
| 55 | bool did_scriptl=false; | ||
| 56 | byte lshift = 0; | ||
| 57 | int32_t dowpn = -1; | ||
| 58 | int32_t directItemA = -1; | ||
| 59 | int32_t directItemB = -1; | ||
| 60 | int32_t directItemX = -1; | ||
| 61 | int32_t directItemY = -1; | ||
| 62 | int32_t directWpn = -1; | ||
| 63 | int32_t whistleitem=-1; | ||
| 64 | extern int32_t script_hero_cset; | ||
| 65 | |||
| 66 | void playLevelMusic(); | ||
| 67 | |||
| 68 | extern particle_list particles; | ||
| 69 | |||
| 70 | byte lsteps[8] = { 1, 1, 2, 1, 1, 2, 1, 1 }; | ||
| 71 | |||
| 72 | #define CANFORCEFACEUP (get_qr(qr_SIDEVIEWLADDER_FACEUP)!=0 && dir!=up && (action==walking || action==none)) | ||
| 73 | #define NO_GRIDLOCK (get_qr(qr_DISABLE_4WAY_GRIDLOCK)||get_qr(qr_NEW_HERO_MOVEMENT2)) | ||
| 74 | #define SWITCHBLOCK_STATE (switchblock_z<0?switchblock_z:(switchblock_z+z+fakez < 0 ? zslongToFix(2147483647) : switchblock_z+z+fakez)) | ||
| 75 | #define FIXED_Z3_ANIMATION ((zinit.heroAnimationStyle==las_zelda3||zinit.heroAnimationStyle==las_zelda3slow)&&!get_qr(qr_BROKEN_Z3_ANIMATION)) | ||
| 76 | |||
| 77 | 47 | bool item_error() | |
| 78 | { | ||
| 79 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 39 times.
|
47 | if(QMisc.miscsfx[sfxERROR]) |
| 80 | 8 | sfx(QMisc.miscsfx[sfxERROR]); | |
| 81 | 47 | return false; | |
| 82 | } | ||
| 83 | 5346733 | static inline bool on_sideview_slope(int32_t x, int32_t y, int32_t oldx, int32_t oldy) | |
| 84 | { | ||
| 85 |
2/2✓ Branch 0 taken 811 times.
✓ Branch 1 taken 5345922 times.
|
5346733 | if(check_new_slope(x, y+0.0001_zf, 16, 16, oldx, oldy, false, true) < 0) return true; |
| 86 | 5345922 | return false; | |
| 87 | 5346733 | } | |
| 88 | |||
| 89 | 12071178 | static inline bool platform_fallthrough(bool doslopecheck = true) | |
| 90 | { | ||
| 91 |
2/2✓ Branch 0 taken 10288447 times.
✓ Branch 1 taken 1782731 times.
|
12071178 | if (!getInput(btnDown, false, get_qr(qr_SIDEVIEW_FALLTHROUGH_USES_DRUNK)!=0)) |
| 92 | 10288447 | return false; | |
| 93 | |||
| 94 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1782731 times.
|
1782731 | if (get_qr(qr_DOWN_FALL_THROUGH_SIDEVIEW_PLATFORMS)) |
| 95 | ✗ | return true; | |
| 96 | |||
| 97 |
3/4✓ Branch 0 taken 26307 times.
✓ Branch 1 taken 1756424 times.
✓ Branch 2 taken 26307 times.
✗ Branch 3 not taken.
|
1782731 | if (Hero.jumping < 0 && get_qr(qr_DOWNJUMP_FALL_THROUGH_SIDEVIEW_PLATFORMS)) |
| 98 | ✗ | return true; | |
| 99 | |||
| 100 |
7/8✓ Branch 0 taken 1782731 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 706 times.
✓ Branch 3 taken 1782025 times.
✓ Branch 4 taken 1781977 times.
✓ Branch 5 taken 48 times.
✓ Branch 6 taken 105 times.
✓ Branch 7 taken 1782626 times.
|
3564756 | if (doslopecheck && !on_sideview_slope(Hero.x, Hero.y,Hero.old_x,Hero.old_y) && (on_sideview_slope(Hero.x,Hero.y+1,Hero.old_x,Hero.old_y) || on_sideview_slope(Hero.x, Hero.y + 2, Hero.old_x, Hero.old_y))) |
| 101 | 105 | return true; | |
| 102 | |||
| 103 | 1782626 | return false; | |
| 104 | 12071178 | } | |
| 105 | |||
| 106 | 3292 | static inline bool on_sideview_solid(zfix x, zfix y, bool ignoreFallthrough = false, int32_t slopesmisc = 0) | |
| 107 | { | ||
| 108 |
3/4✓ Branch 0 taken 3292 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2246 times.
✓ Branch 3 taken 1046 times.
|
3292 | if(slopesmisc != 1 && check_slope(x, y + 0.0001_zf, 16, 16, (slopesmisc == 3), true) < 0) return true; |
| 109 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2246 times.
|
2246 | if(slopesmisc == 2) return false; |
| 110 |
3/4✓ Branch 0 taken 1566 times.
✓ Branch 1 taken 680 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1566 times.
|
2246 | if (_walkflag(x+4,y+16,1) || _walkflag(x+12,y+16,1)) return true; |
| 111 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 1566 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1566 | if (y>=160_zf && currscr>=0x70 && !(tmpscr->flags2&wfDOWN)) return true; |
| 112 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1566 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1566 | if (platform_fallthrough() && !ignoreFallthrough) return false; |
| 113 |
2/4✓ Branch 0 taken 1566 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1566 times.
✗ Branch 3 not taken.
|
1566 | if(slopesmisc != 1 && check_slope(x, y + 0.0001_zf, 16, 16, false, true) < 0) return true; |
| 114 |
4/6✓ Branch 0 taken 1484 times.
✓ Branch 1 taken 82 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 82 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1566 times.
|
1648 | if (y.getInt() % 16 ==0 && (checkSVLadderPlatform(x+4,y+16) || checkSVLadderPlatform(x+12,y+16))) |
| 115 | ✗ | return true; | |
| 116 | 1566 | return false; | |
| 117 | 3292 | } | |
| 118 | |||
| 119 | static inline bool on_sideview_solid_oldpos(zfix x, zfix y, zfix oldx, zfix oldy, bool ignoreFallthrough = false, int32_t slopesmisc = 0) | ||
| 120 | { | ||
| 121 | if(slopesmisc != 1 && check_new_slope(x, y+0.0001_zf, 16, 16, oldx, oldy, (slopesmisc == 3), true) < 0) return true; | ||
| 122 | if(slopesmisc == 2) return false; | ||
| 123 | if (_walkflag(x+4,y+16,1) || _walkflag(x+12,y+16,1)) return true; | ||
| 124 | if (y>=160_zf && currscr>=0x70 && !(tmpscr->flags2&wfDOWN)) return true; | ||
| 125 | if (platform_fallthrough() && !ignoreFallthrough) return false; | ||
| 126 | if (slopesmisc != 1 && check_new_slope(x, y + 0.0001_zf, 16, 16, oldx, oldy, false, true) < 0) return true; | ||
| 127 | if (y.getInt()%16==0 && (checkSVLadderPlatform(x+4,y+16) || checkSVLadderPlatform(x+12,y+16))) | ||
| 128 | return true; | ||
| 129 | return false; | ||
| 130 | } | ||
| 131 | |||
| 132 | 16053179 | static inline bool on_sideview_solid_oldpos(sprite* obj, bool ignoreFallthrough = false, int32_t slopesmisc = 0, zfix xofs = 0, zfix yofs = 0) | |
| 133 | { | ||
| 134 | 16053179 | zfix rx = obj->x+obj->hxofs+obj->sxofs+xofs, ry = obj->y+obj->hyofs+obj->syofs+yofs, | |
| 135 | 16053179 | rw = obj->hit_width+obj->sxsz_ofs, rh = obj->hit_height+obj->sysz_ofs, | |
| 136 | 16053179 | orx = obj->old_x+obj->hxofs+obj->sxofs, ory = obj->old_y+obj->hyofs+obj->syofs, | |
| 137 | 16053179 | x = obj->x+xofs, y = obj->y+yofs; | |
| 138 |
4/4✓ Branch 0 taken 1645443 times.
✓ Branch 1 taken 14407736 times.
✓ Branch 2 taken 1632079 times.
✓ Branch 3 taken 13364 times.
|
16053179 | if(slopesmisc != 1 && check_new_slope(rx, ry+0.0001_zf, rw, rh, orx, ory, (slopesmisc == 3), true, obj->slopeid) < 0) return true; |
| 139 |
2/2✓ Branch 0 taken 126159 times.
✓ Branch 1 taken 15913656 times.
|
16039815 | if(slopesmisc == 2) return false; |
| 140 |
4/4✓ Branch 0 taken 12398486 times.
✓ Branch 1 taken 3515170 times.
✓ Branch 2 taken 327976 times.
✓ Branch 3 taken 12070510 times.
|
15913656 | if (_walkflag(x+4,y+16,1) || _walkflag(x+12,y+16,1)) return true; |
| 141 |
6/6✓ Branch 0 taken 100787 times.
✓ Branch 1 taken 11969723 times.
✓ Branch 2 taken 6083 times.
✓ Branch 3 taken 94704 times.
✓ Branch 4 taken 5185 times.
✓ Branch 5 taken 898 times.
|
12070510 | if (y>=160_zf && currscr>=0x70 && !(tmpscr->flags2&wfDOWN)) return true; |
| 142 |
3/4✓ Branch 0 taken 105 times.
✓ Branch 1 taken 12069507 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 105 times.
|
12069612 | if (platform_fallthrough() && !ignoreFallthrough) return false; |
| 143 |
3/4✓ Branch 0 taken 695630 times.
✓ Branch 1 taken 11373877 times.
✓ Branch 2 taken 695630 times.
✗ Branch 3 not taken.
|
12069507 | if (slopesmisc != 1 && check_new_slope(rx, ry+0.0001_zf, rw, rh, orx, ory, false, true, obj->slopeid) < 0) return true; |
| 144 |
4/6✓ Branch 0 taken 9005711 times.
✓ Branch 1 taken 3063796 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3063796 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 12069507 times.
|
15133303 | if (y.getInt()%16==0 && (checkSVLadderPlatform(x+4,y+16) || checkSVLadderPlatform(x+12,y+16))) |
| 145 | ✗ | return true; | |
| 146 | 12069507 | return false; | |
| 147 | 16053179 | } | |
| 148 | |||
| 149 | 103057 | static inline bool no_plat_action() | |
| 150 | { | ||
| 151 |
5/8✓ Branch 0 taken 103057 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 102759 times.
✓ Branch 3 taken 298 times.
✓ Branch 4 taken 102759 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 102759 times.
|
103057 | if(Hero.fallclk || Hero.drownclk || toogam || Hero.getOnSideviewLadder()) |
| 152 | 298 | return true; | |
| 153 |
2/2✓ Branch 0 taken 441 times.
✓ Branch 1 taken 102318 times.
|
102759 | switch(Hero.action) |
| 154 | { | ||
| 155 | case freeze: case rafting: case inwind: case scrolling: case won: case hopping: | ||
| 156 | case climbcovertop: case climbcoverbottom: case dying: case drowning: | ||
| 157 | case falling: case lavadrowning: case sideswimfreeze: case sidedrowning: | ||
| 158 | 441 | return true; | |
| 159 | } | ||
| 160 | 102318 | return false; | |
| 161 | 103057 | } | |
| 162 | 84975 | bool HeroClass::on_ffc_platform(ffcdata const& ffc, bool old) | |
| 163 | { | ||
| 164 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 84975 times.
|
84975 | if(no_plat_action()) |
| 165 | ✗ | return false; | |
| 166 |
2/2✓ Branch 0 taken 45129 times.
✓ Branch 1 taken 39846 times.
|
84975 | if(!get_qr(qr_MULTI_PLATFORM_FFC)) |
| 167 | { | ||
| 168 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 39846 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
39846 | if(platform_ffc && &ffc != platform_ffc) |
| 169 | ✗ | return false; | |
| 170 | 39846 | platform_ffc = nullptr; | |
| 171 | 39846 | } | |
| 172 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 84975 times.
|
84975 | if(sideview_mode()) |
| 173 | { | ||
| 174 | ✗ | if((ffc.flags & (ffc_solid|ffc_platform|ffc_changer)) != (ffc_solid|ffc_platform)) | |
| 175 | ✗ | return false; | |
| 176 | ✗ | zfix fx = old ? ffc.old_x : ffc.x, fy = old ? ffc.old_y : ffc.y; | |
| 177 | ✗ | static const zfix tol = 0.5_zf; | |
| 178 | ✗ | if((y+16-fy).getAbs() > tol) | |
| 179 | ✗ | return false; | |
| 180 | ✗ | if(fx > x+12) | |
| 181 | ✗ | return false; | |
| 182 | ✗ | if(fx+ffc.hit_width <= x+4) | |
| 183 | ✗ | return false; | |
| 184 | ✗ | } | |
| 185 | else | ||
| 186 | { | ||
| 187 |
2/2✓ Branch 0 taken 84786 times.
✓ Branch 1 taken 189 times.
|
84975 | if((ffc.flags & (ffc_platform|ffc_changer)) != ffc_platform) |
| 188 | 84786 | return false; | |
| 189 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 189 times.
|
189 | if(z) |
| 190 | ✗ | return false; | |
| 191 | static const int tol = 3; | ||
| 192 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 189 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 188 times.
|
189 | if(!(old |
| 193 | 189 | ? ffc.collide_old(x + 8-tol, y + (bigHitbox ? 8 : 12), tol*2, tol*2) | |
| 194 | ✗ | : ffc.collide(x + 8-tol, y + (bigHitbox ? 8 : 12)-tol, tol*2, tol*2))) | |
| 195 | 188 | return false; | |
| 196 | } | ||
| 197 | 1 | platform_ffc = &ffc; | |
| 198 | 1 | return true; | |
| 199 | 84975 | } | |
| 200 | 18082 | bool HeroClass::on_ffc_platform() | |
| 201 | { | ||
| 202 |
2/2✓ Branch 0 taken 739 times.
✓ Branch 1 taken 17343 times.
|
18082 | if(no_plat_action()) |
| 203 | 739 | return false; | |
| 204 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 17343 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
17343 | if(platform_ffc && on_ffc_platform(*platform_ffc,false)) |
| 205 | ✗ | return true; | |
| 206 | 17343 | word c = tmpscr->numFFC(); | |
| 207 |
2/2✓ Branch 0 taken 84786 times.
✓ Branch 1 taken 17343 times.
|
102129 | for(word i=0; i<c; i++) |
| 208 | { | ||
| 209 | 84786 | ffcdata& ffc = tmpscr->ffcs[i]; | |
| 210 |
1/2✓ Branch 0 taken 84786 times.
✗ Branch 1 not taken.
|
84786 | if(on_ffc_platform(ffc,false)) |
| 211 | ✗ | return true; | |
| 212 | 84786 | } | |
| 213 | 17343 | return false; | |
| 214 | 18082 | } | |
| 215 | |||
| 216 | 14624588 | void HeroClass::check_platform_ffc() | |
| 217 | { | ||
| 218 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 14624588 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
14624588 | if(platform_ffc && !on_ffc_platform(*platform_ffc,false)) |
| 219 | { | ||
| 220 | ✗ | clear_platform_ffc(); | |
| 221 | ✗ | on_ffc_platform(); | |
| 222 | ✗ | } | |
| 223 | 14624588 | } | |
| 224 | 36741 | void HeroClass::clear_platform_ffc() | |
| 225 | { | ||
| 226 | 36741 | platform_ffc = nullptr; | |
| 227 | 36741 | } | |
| 228 | |||
| 229 | 1722 | void HeroClass::snap_platform() | |
| 230 | { | ||
| 231 |
2/2✓ Branch 0 taken 1010 times.
✓ Branch 1 taken 712 times.
|
1722 | if(check_new_slope(x, y+1, 16, 16, old_x, old_y, false, true) < 0) |
| 232 | 1010 | return; | |
| 233 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 712 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
712 | if (y>=160 && currscr>=0x70 && !(tmpscr->flags2&wfDOWN)) |
| 234 | { | ||
| 235 | ✗ | y = 160; | |
| 236 | ✗ | return; | |
| 237 | } | ||
| 238 |
4/4✓ Branch 0 taken 22 times.
✓ Branch 1 taken 690 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 12 times.
|
712 | if (!(_walkflag(x+4,y+16,1) || _walkflag(x+12,y+16,1))) |
| 239 | 12 | return; | |
| 240 | 700 | movexy(0,1,false,true,false,false); | |
| 241 | 1722 | } | |
| 242 | |||
| 243 | |||
| 244 | 40719344 | bool usingActiveShield(int32_t itmid) | |
| 245 | { | ||
| 246 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40719344 times.
|
40719344 | if(Hero.shieldjinxclk) return false; |
| 247 |
2/2✓ Branch 0 taken 35137501 times.
✓ Branch 1 taken 5581843 times.
|
40719344 | switch(Hero.action) //filter allowed actions |
| 248 | { | ||
| 249 | case none: case walking: case rafting: | ||
| 250 | case gothit: case swimhit: | ||
| 251 | 35137501 | break; | |
| 252 | 5581843 | default: return false; | |
| 253 | } | ||
| 254 |
4/4✓ Branch 0 taken 12334 times.
✓ Branch 1 taken 35125167 times.
✓ Branch 2 taken 4320 times.
✓ Branch 3 taken 8014 times.
|
35137501 | if(Hero.lift_wpn && (Hero.liftflags&LIFTFL_DIS_SHIELD)) return false; |
| 255 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 35129487 times.
|
35129487 | if(itmid < 0) |
| 256 |
1/2✓ Branch 0 taken 35129487 times.
✗ Branch 1 not taken.
|
35129487 | itmid = (Hero.active_shield_id < 0 |
| 257 | 35129487 | ? current_item_id(itype_shield,true,true) : Hero.active_shield_id); | |
| 258 |
2/2✓ Branch 0 taken 31137174 times.
✓ Branch 1 taken 3992313 times.
|
35129487 | if(itmid < 0) return false; |
| 259 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 31137174 times.
|
31137174 | if(item_disabled(itmid)) return false; |
| 260 |
1/2✓ Branch 0 taken 31137174 times.
✗ Branch 1 not taken.
|
31137174 | if(!checkitem_jinx(itmid)) return false; |
| 261 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 31137174 times.
|
31137174 | if(!(itemsbuf[itmid].flags & item_flag9)) return false; |
| 262 | ✗ | if(!isItmPressed(itmid)) return false; | |
| 263 | ✗ | return (checkbunny(itmid) && checkmagiccost(itmid)); | |
| 264 | 40719344 | } | |
| 265 | 4397830 | int32_t getCurrentShield(bool requireActive) | |
| 266 | { | ||
| 267 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4397830 times.
|
4397830 | if(Hero.shieldjinxclk) return -1; |
| 268 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 4397830 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
4397830 | if(Hero.active_shield_id > -1 && usingActiveShield(Hero.active_shield_id)) |
| 269 | ✗ | return Hero.active_shield_id; | |
| 270 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4397830 times.
|
4397830 | if(!requireActive) return current_item_id(itype_shield,false,true); |
| 271 | ✗ | return -1; | |
| 272 | 4397830 | } | |
| 273 | 577333 | int32_t getCurrentActiveShield() | |
| 274 | { | ||
| 275 | 577333 | int32_t id = Hero.active_shield_id; | |
| 276 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 577333 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
577333 | if(id > -1 && usingActiveShield(id)) |
| 277 | ✗ | return id; | |
| 278 | 577333 | return -1; | |
| 279 | 577333 | } | |
| 280 | 14151814 | int32_t refreshActiveShield() | |
| 281 | { | ||
| 282 | 14151814 | int32_t id = -1; | |
| 283 |
2/2✓ Branch 0 taken 13861055 times.
✓ Branch 1 taken 290759 times.
|
14151814 | if(DrunkcBbtn()) |
| 284 | { | ||
| 285 |
2/2✓ Branch 0 taken 288886 times.
✓ Branch 1 taken 1873 times.
|
290759 | itemdata const& dat = itemsbuf[NEG_OR_MASK(Bwpn,0xFFF)]; |
| 286 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 290759 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
290759 | if(dat.family == itype_shield && (dat.flags & item_flag9)) |
| 287 | { | ||
| 288 | ✗ | id = NEG_OR_MASK(Bwpn,0xFFF); | |
| 289 | ✗ | } | |
| 290 | 290759 | } | |
| 291 |
3/4✓ Branch 0 taken 14151814 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12923020 times.
✓ Branch 3 taken 1228794 times.
|
14151814 | if(id < 0 && DrunkcAbtn()) |
| 292 | { | ||
| 293 |
2/2✓ Branch 0 taken 1092420 times.
✓ Branch 1 taken 136374 times.
|
1228794 | itemdata const& dat = itemsbuf[NEG_OR_MASK(Awpn,0xFFF)]; |
| 294 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1228794 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1228794 | if(dat.family == itype_shield && (dat.flags & item_flag9)) |
| 295 | { | ||
| 296 | ✗ | id = NEG_OR_MASK(Awpn,0xFFF); | |
| 297 | ✗ | } | |
| 298 | 1228794 | } | |
| 299 |
3/4✓ Branch 0 taken 14151814 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14139257 times.
✓ Branch 3 taken 12557 times.
|
14151814 | if(id < 0 && DrunkcEx1btn()) |
| 300 | { | ||
| 301 |
2/2✓ Branch 0 taken 1997 times.
✓ Branch 1 taken 10560 times.
|
12557 | itemdata const& dat = itemsbuf[NEG_OR_MASK(Xwpn,0xFFF)]; |
| 302 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 12557 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
12557 | if(dat.family == itype_shield && (dat.flags & item_flag9)) |
| 303 | { | ||
| 304 | ✗ | id = NEG_OR_MASK(Xwpn,0xFFF); | |
| 305 | ✗ | } | |
| 306 | 12557 | } | |
| 307 |
3/4✓ Branch 0 taken 14151814 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14149107 times.
✓ Branch 3 taken 2707 times.
|
14151814 | if(id < 0 && DrunkcEx2btn()) |
| 308 | { | ||
| 309 |
2/2✓ Branch 0 taken 2471 times.
✓ Branch 1 taken 236 times.
|
2707 | itemdata const& dat = itemsbuf[NEG_OR_MASK(Ywpn,0xFFF)]; |
| 310 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2707 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2707 | if(dat.family == itype_shield && (dat.flags & item_flag9)) |
| 311 | { | ||
| 312 | ✗ | id = NEG_OR_MASK(Ywpn,0xFFF); | |
| 313 | ✗ | } | |
| 314 | 2707 | } | |
| 315 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14151814 times.
|
14151814 | if(!usingActiveShield(id)) |
| 316 | 14151814 | return -1; | |
| 317 | ✗ | return id; | |
| 318 | 14151814 | } | |
| 319 | static bool is_immobile() | ||
| 320 | { | ||
| 321 | if(!get_qr(qr_NEW_HERO_MOVEMENT)) | ||
| 322 | return false; | ||
| 323 | zfix rate(Hero.steprate); | ||
| 324 | int32_t shieldid = getCurrentActiveShield(); | ||
| 325 | if(shieldid > -1) | ||
| 326 | { | ||
| 327 | itemdata const& shield = itemsbuf[shieldid]; | ||
| 328 | if(shield.flags & item_flag10) //Change Speed flag | ||
| 329 | { | ||
| 330 | zfix perc = shield.misc7; | ||
| 331 | perc /= 100; | ||
| 332 | if(perc < 0) | ||
| 333 | perc = (perc*-1)+1; | ||
| 334 | rate = (rate * perc) + shield.misc8; | ||
| 335 | } | ||
| 336 | } | ||
| 337 | return rate != 0; | ||
| 338 | } | ||
| 339 | |||
| 340 | 28483320 | bool nomove_action(int action) | |
| 341 | { | ||
| 342 |
2/2✓ Branch 0 taken 27278862 times.
✓ Branch 1 taken 1204458 times.
|
28483320 | switch(action) |
| 343 | { | ||
| 344 | case gothit: | ||
| 345 | case drowning: | ||
| 346 | case lavadrowning: | ||
| 347 | case sidedrowning: | ||
| 348 | case falling: | ||
| 349 | case freeze: | ||
| 350 | case sideswimfreeze: | ||
| 351 | case scrolling: | ||
| 352 | case casting: | ||
| 353 | case sideswimcasting: | ||
| 354 | case landhold1: | ||
| 355 | case landhold2: | ||
| 356 | case waterhold1: | ||
| 357 | case waterhold2: | ||
| 358 | case sidewaterhold1: | ||
| 359 | case sidewaterhold2: | ||
| 360 | case hopping: | ||
| 361 | case inwind: | ||
| 362 | 1204458 | return true; | |
| 363 | } | ||
| 364 | 27278862 | return false; | |
| 365 | 28483320 | } | |
| 366 | |||
| 367 | 14488856 | bool HeroClass::isStanding(bool forJump) | |
| 368 | { | ||
| 369 |
3/4✓ Branch 0 taken 14458854 times.
✓ Branch 1 taken 30002 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 14458854 times.
|
14488856 | if(z || fakez) return false; |
| 370 |
3/4✓ Branch 0 taken 259205 times.
✓ Branch 1 taken 14199649 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 127681 times.
|
14586535 | if(isSideViewHero() && !on_sideview_solid_oldpos(this) |
| 371 |
4/6✓ Branch 0 taken 127681 times.
✓ Branch 1 taken 131524 times.
✓ Branch 2 taken 127681 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 127681 times.
✗ Branch 5 not taken.
|
259205 | && !ladderx && !laddery && !getOnSideviewLadder()) |
| 372 | 127681 | return false; | |
| 373 |
2/2✓ Branch 0 taken 36 times.
✓ Branch 1 taken 14331137 times.
|
14331173 | if(hoverclk) return false; |
| 374 |
2/2✓ Branch 0 taken 599868 times.
✓ Branch 1 taken 13731269 times.
|
14331137 | if(nomove_action(action)) return false; |
| 375 | 13731269 | int32_t val = check_pitslide(); | |
| 376 |
2/2✓ Branch 0 taken 34 times.
✓ Branch 1 taken 13731235 times.
|
13731269 | if(val == -2) return false; |
| 377 |
2/2✓ Branch 0 taken 257 times.
✓ Branch 1 taken 13730978 times.
|
13731235 | if(val == -1) return true; |
| 378 | 257 | return forJump; | |
| 379 | 14488856 | } | |
| 380 | 826829 | bool HeroClass::isLifting() | |
| 381 | { | ||
| 382 |
2/2✓ Branch 0 taken 11209 times.
✓ Branch 1 taken 815620 times.
|
826829 | if(lift_wpn) return true; |
| 383 | 815620 | return false; | |
| 384 | 826829 | } | |
| 385 | 62 | void HeroClass::set_liftflags(int liftid) | |
| 386 | { | ||
| 387 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 62 times.
|
62 | if(unsigned(liftid) >= MAXITEMS) |
| 388 | ✗ | return; | |
| 389 | 62 | itemdata const& itm = itemsbuf[liftid]; | |
| 390 |
1/2✓ Branch 0 taken 62 times.
✗ Branch 1 not taken.
|
62 | SETFLAG(liftflags, LIFTFL_DIS_SWIMMING, !(itm.flags & item_flag2)); |
| 391 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 39 times.
|
62 | SETFLAG(liftflags, LIFTFL_DIS_SHIELD, itm.flags & item_flag3); |
| 392 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 39 times.
|
62 | SETFLAG(liftflags, LIFTFL_DIS_ITEMS, itm.flags & item_flag4); |
| 393 | 62 | } | |
| 394 | |||
| 395 | 504727 | void HeroClass::set_respawn_point(bool setwarp) | |
| 396 | { | ||
| 397 | 504727 | zfix oldx = x, oldy = y; | |
| 398 |
2/2✓ Branch 0 taken 33939 times.
✓ Branch 1 taken 470788 times.
|
504727 | if (replay_version_check(17)) |
| 399 | { | ||
| 400 | 470788 | x = vbound(x,0_zf,240_zf); | |
| 401 | 470788 | y = vbound(y,0_zf,160_zf); | |
| 402 | 470788 | } | |
| 403 | |||
| 404 |
2/2✓ Branch 0 taken 486803 times.
✓ Branch 1 taken 17924 times.
|
504727 | if(setwarp) |
| 405 | { | ||
| 406 | 17924 | warpx = x; | |
| 407 | 17924 | warpy = y; | |
| 408 | 17924 | raftwarpx = x; | |
| 409 | 17924 | raftwarpy = y; | |
| 410 | 17924 | } | |
| 411 | 504727 | do | |
| 412 | { | ||
| 413 |
2/2✓ Branch 0 taken 44179 times.
✓ Branch 1 taken 460548 times.
|
504727 | if(!get_qr(qr_OLD_RESPAWN_POINTS)) |
| 414 | { | ||
| 415 |
2/2✓ Branch 0 taken 119 times.
✓ Branch 1 taken 460429 times.
|
460548 | if(currscr >= 0x80) break; |
| 416 | 460429 | bool is_safe = true; | |
| 417 |
2/2✓ Branch 0 taken 396594 times.
✓ Branch 1 taken 63835 times.
|
460429 | switch(action) |
| 418 | { | ||
| 419 | case none: case walking: | ||
| 420 | 396594 | break; | |
| 421 | default: | ||
| 422 | 63835 | is_safe = false; | |
| 423 | 63835 | } | |
| 424 |
2/2✓ Branch 0 taken 396594 times.
✓ Branch 1 taken 63835 times.
|
460429 | if(!is_safe) break; //unsafe action |
| 425 |
5/6✓ Branch 0 taken 394674 times.
✓ Branch 1 taken 1920 times.
✓ Branch 2 taken 394674 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 19 times.
✓ Branch 5 taken 394655 times.
|
396594 | if(z > 0 || fakez > 0 || hoverclk) break; //in air |
| 426 |
4/4✓ Branch 0 taken 3292 times.
✓ Branch 1 taken 391363 times.
✓ Branch 2 taken 1726 times.
✓ Branch 3 taken 1566 times.
|
394655 | if(sideview_mode() && !on_sideview_solid(x,y,true)) break; //in air sideview |
| 427 |
2/2✓ Branch 0 taken 139 times.
✓ Branch 1 taken 392950 times.
|
393089 | if(check_pitslide(true) != -1) break; //On a pit |
| 428 |
2/2✓ Branch 0 taken 11 times.
✓ Branch 1 taken 392939 times.
|
392950 | if (ladderx+laddery) break; //on the ladder |
| 429 | |||
| 430 | { //Check water | ||
| 431 | 392939 | int32_t water = 0; | |
| 432 | 392939 | int32_t types[4] = {0}; | |
| 433 | 392939 | int32_t x1 = x+4, x2 = x+11, | |
| 434 | 392939 | y1 = y+9, y2 = y+15; | |
| 435 |
1/2✓ Branch 0 taken 392939 times.
✗ Branch 1 not taken.
|
392939 | if (get_qr(qr_SMARTER_WATER)) |
| 436 | { | ||
| 437 |
4/4✓ Branch 0 taken 1905 times.
✓ Branch 1 taken 391034 times.
✓ Branch 2 taken 13 times.
✓ Branch 3 taken 249 times.
|
393201 | if (iswaterex(0, currmap, currscr, -1, x1, y1, true, false) && |
| 438 |
2/2✓ Branch 0 taken 1157 times.
✓ Branch 1 taken 748 times.
|
1905 | iswaterex(0, currmap, currscr, -1, x1, y2, true, false) && |
| 439 |
2/2✓ Branch 0 taken 262 times.
✓ Branch 1 taken 895 times.
|
1157 | iswaterex(0, currmap, currscr, -1, x2, y1, true, false) && |
| 440 | 262 | iswaterex(0, currmap, currscr, -1, x2, y2, true, false)) water = iswaterex(0, currmap, currscr, -1, (x2+x1)/2,(y2+y1)/2, true, false); | |
| 441 | 392939 | } | |
| 442 | else | ||
| 443 | { | ||
| 444 | ✗ | types[0] = COMBOTYPE(x1,y1); | |
| 445 | |||
| 446 | ✗ | if(MAPFFCOMBO(x1,y1)) | |
| 447 | ✗ | types[0] = FFCOMBOTYPE(x1,y1); | |
| 448 | |||
| 449 | ✗ | types[1] = COMBOTYPE(x1,y2); | |
| 450 | |||
| 451 | ✗ | if(MAPFFCOMBO(x1,y2)) | |
| 452 | ✗ | types[1] = FFCOMBOTYPE(x1,y2); | |
| 453 | |||
| 454 | ✗ | types[2] = COMBOTYPE(x2,y1); | |
| 455 | |||
| 456 | ✗ | if(MAPFFCOMBO(x2,y1)) | |
| 457 | ✗ | types[2] = FFCOMBOTYPE(x2,y1); | |
| 458 | |||
| 459 | ✗ | types[3] = COMBOTYPE(x2,y2); | |
| 460 | |||
| 461 | ✗ | if(MAPFFCOMBO(x2,y2)) | |
| 462 | ✗ | types[3] = FFCOMBOTYPE(x2,y2); | |
| 463 | |||
| 464 | ✗ | int32_t typec = COMBOTYPE((x2+x1)/2,(y2+y1)/2); | |
| 465 | ✗ | if(MAPFFCOMBO((x2+x1)/2,(y2+y1)/2)) | |
| 466 | ✗ | typec = FFCOMBOTYPE((x2+x1)/2,(y2+y1)/2); | |
| 467 | |||
| 468 | ✗ | if(combo_class_buf[types[0]].water && combo_class_buf[types[1]].water && | |
| 469 | ✗ | combo_class_buf[types[2]].water && combo_class_buf[types[3]].water && combo_class_buf[typec].water) | |
| 470 | ✗ | water = typec; | |
| 471 | } | ||
| 472 |
2/2✓ Branch 0 taken 249 times.
✓ Branch 1 taken 392690 times.
|
392939 | if(water > 0) |
| 473 | 249 | break; | |
| 474 | } //End check water | ||
| 475 | |||
| 476 | 1963450 | int poses[4] = { | |
| 477 | 392690 | COMBOPOS(x,y+(bigHitbox?0:8)), | |
| 478 | 392690 | COMBOPOS(x,y+15), | |
| 479 | 392690 | COMBOPOS(x+15,y+(bigHitbox?0:8)), | |
| 480 | 392690 | COMBOPOS(x+15,y+15) | |
| 481 | }; | ||
| 482 |
2/2✓ Branch 0 taken 350420 times.
✓ Branch 1 taken 1452825 times.
|
1803245 | for(auto pos : poses) |
| 483 | { | ||
| 484 |
2/2✓ Branch 0 taken 1410555 times.
✓ Branch 1 taken 42270 times.
|
1452825 | if(HASFLAG_ANY(mfUNSAFEGROUND, pos)) //"Unsafe Ground" flag touching the player |
| 485 | { | ||
| 486 | 42270 | is_safe = false; | |
| 487 | 42270 | break; | |
| 488 | } | ||
| 489 | } | ||
| 490 |
2/2✓ Branch 0 taken 350420 times.
✓ Branch 1 taken 42270 times.
|
392690 | if(!is_safe) break; |
| 491 | 350420 | } | |
| 492 | 394599 | respawn_x = x; | |
| 493 | 394599 | respawn_y = y; | |
| 494 | 394599 | respawn_scr = currscr; | |
| 495 | 394599 | respawn_dmap = currdmap; | |
| 496 | 394599 | } | |
| 497 | while(false); //run once, but 'break' works | ||
| 498 | |||
| 499 | 504727 | x = oldx; | |
| 500 | 504727 | y = oldy; | |
| 501 | 504727 | } | |
| 502 | |||
| 503 | 355699 | void HeroClass::clear_ice() | |
| 504 | { | ||
| 505 | 355699 | ice_vx = ice_vy = 0; | |
| 506 | 355699 | ice_entry_count = ice_entry_mcount = 0; | |
| 507 | 355699 | ice_combo = 0; | |
| 508 | 355699 | sliding = 0; | |
| 509 | 355699 | } | |
| 510 | |||
| 511 | 143 | void HeroClass::go_respawn_point() | |
| 512 | { | ||
| 513 | 143 | x = respawn_x; | |
| 514 | 143 | y = respawn_y; | |
| 515 | 143 | clear_ice(); | |
| 516 | 143 | handle_portal_prox(&mirror_portal); | |
| 517 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | portals.forEach([&](sprite& p) |
| 518 | { | ||
| 519 | ✗ | handle_portal_prox((portal*)&p); | |
| 520 | ✗ | return false; | |
| 521 | }); | ||
| 522 | 143 | warpx=x; | |
| 523 | 143 | warpy=y; | |
| 524 | 143 | raftwarpx = x; | |
| 525 | 143 | raftwarpy = y; | |
| 526 | 143 | trySideviewLadder(); //Cling to ladder automatically | |
| 527 | |||
| 528 |
2/2✓ Branch 0 taken 75 times.
✓ Branch 1 taken 68 times.
|
143 | if(get_qr(qr_OLD_RESPAWN_POINTS)) |
| 529 | 68 | return; //No cross-screen return | |
| 530 | |||
| 531 |
2/4✓ Branch 0 taken 75 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 75 times.
|
75 | if(currdmap != respawn_dmap || currscr != respawn_scr) |
| 532 | { | ||
| 533 | ✗ | FFCore.warp_player(wtIWARP, respawn_dmap, respawn_scr-DMaps[currdmap].xoff, | |
| 534 | -1, -1, 0, 0, warpFlagNOSTEPFORWARD, -1); | ||
| 535 | ✗ | } | |
| 536 | 143 | } | |
| 537 | |||
| 538 | 33303 | void HeroClass::trySideviewLadder() | |
| 539 | { | ||
| 540 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 33303 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
33303 | if(canSideviewLadder() && !on_sideview_solid_oldpos(this)) |
| 541 | ✗ | setOnSideviewLadder(true); | |
| 542 | 33303 | } | |
| 543 | |||
| 544 | 65641783 | bool HeroClass::can_pitfall(bool ignore_hover) | |
| 545 | { | ||
| 546 | 65641783 | return !( | |
| 547 | 65641783 | isSideViewGravity() | |
| 548 |
2/2✓ Branch 0 taken 65045060 times.
✓ Branch 1 taken 596723 times.
|
65641783 | || action==rafting |
| 549 |
7/8✓ Branch 0 taken 64705175 times.
✓ Branch 1 taken 339885 times.
✓ Branch 2 taken 64669700 times.
✓ Branch 3 taken 35475 times.
✓ Branch 4 taken 64669700 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 64668630 times.
✓ Branch 7 taken 1070 times.
|
65045060 | || z>0 || fakez>0 || fall<0 || fakefall<0 |
| 550 |
3/4✓ Branch 0 taken 64668630 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 70 times.
✓ Branch 3 taken 64668560 times.
|
64668630 | || (hoverclk && !ignore_hover) |
| 551 |
6/6✓ Branch 0 taken 64638378 times.
✓ Branch 1 taken 30252 times.
✓ Branch 2 taken 64634391 times.
✓ Branch 3 taken 3987 times.
✓ Branch 4 taken 64599563 times.
✓ Branch 5 taken 34828 times.
|
64668630 | || inlikelike || inwallm || pull_hero || toogam |
| 552 |
6/6✓ Branch 0 taken 64513031 times.
✓ Branch 1 taken 86532 times.
✓ Branch 2 taken 63875098 times.
✓ Branch 3 taken 637933 times.
✓ Branch 4 taken 63874818 times.
✓ Branch 5 taken 280 times.
|
64599563 | || (ladderx||laddery) || getOnSideviewLadder() |
| 553 |
3/4✓ Branch 0 taken 63874818 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 63862456 times.
✓ Branch 3 taken 12362 times.
|
63874818 | || drownclk || !(moveflags & move_can_pitfall) |
| 554 |
2/2✓ Branch 0 taken 63861713 times.
✓ Branch 1 taken 743 times.
|
63862456 | || platform_ffc); |
| 555 | } | ||
| 556 | |||
| 557 | 8345645 | int32_t HeroClass::DrunkClock() | |
| 558 | { | ||
| 559 | 8345645 | return drunkclk; | |
| 560 | } | ||
| 561 | 1 | void HeroClass::setDrunkClock(int32_t newdrunkclk) | |
| 562 | { | ||
| 563 | 1 | drunkclk=newdrunkclk; | |
| 564 | 1 | } | |
| 565 | |||
| 566 | 440770 | int32_t HeroClass::StunClock() | |
| 567 | { | ||
| 568 | 440770 | return lstunclock; | |
| 569 | } | ||
| 570 | 290 | void HeroClass::setStunClock(int32_t v) | |
| 571 | { | ||
| 572 | 290 | lstunclock=v; | |
| 573 | 290 | } | |
| 574 | |||
| 575 | 3108624141 | int32_t HeroClass::BunnyClock() | |
| 576 | { | ||
| 577 | 3108624141 | return lbunnyclock; | |
| 578 | } | ||
| 579 | ✗ | void HeroClass::setBunnyClock(int32_t v) | |
| 580 | { | ||
| 581 | ✗ | lbunnyclock=v; | |
| 582 | ✗ | } | |
| 583 | |||
| 584 |
13/26✓ Branch 0 taken 357 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 357 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 357 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 357 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 357 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 357 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 357 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 357 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 357 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 357 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 357 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 357 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 357 times.
✗ Branch 25 not taken.
|
714 | HeroClass::HeroClass() : sprite() |
| 585 | 357 | { | |
| 586 | 357 | lift_wpn = nullptr; | |
| 587 |
1/2✓ Branch 0 taken 357 times.
✗ Branch 1 not taken.
|
357 | init(); |
| 588 | 357 | } | |
| 589 | |||
| 590 | //2.6 | ||
| 591 | |||
| 592 | //Stop the subscreen from falling. -Z | ||
| 593 | |||
| 594 | 1368 | bool HeroClass::stopSubscreenFalling(){ | |
| 595 | 1368 | return preventsubscreenfalling; | |
| 596 | } | ||
| 597 | |||
| 598 | ✗ | void HeroClass::stopSubscreenFalling(bool v){ | |
| 599 | ✗ | preventsubscreenfalling = v; | |
| 600 | ✗ | } | |
| 601 | |||
| 602 | 14153429 | void HeroClass::ClearhitHeroUIDs() | |
| 603 | { //Why the flidd doesn't this work?! Clearing this to 0 in a way that doesn't demolish script access is impossible. -Z | ||
| 604 | //All I want, is to clear it at the end of a frame, or at the start of a frame, so that if it changes to non-0 | ||
| 605 | //that a script can read it before Waitdraw(). --I want it to go stale at the end of a frame. | ||
| 606 | //I suppose I will need to do this inside the script engine, and not the game_loop() ? -Z | ||
| 607 | //THis started out as a simple clear to 0 of lastHitBy[n], but that did not work: | ||
| 608 | //I added the second element to this, so that I could store the frame on which the hit is recorded, and | ||
| 609 | //clear it on the next frame, but that had the SAME outcome. | ||
| 610 | //Where and how can I clear a value at the end of every frame, so that: | ||
| 611 | // 1. If set by internal mecanics, it has its value that you can read by script, before waitdraw--this part works at present. | ||
| 612 | // 2. FFCs can read it before Waitframe. --same. | ||
| 613 | // 3. After Waitframe(), it is wiped by the ZC Engine to 0. --I cannot get this to happen without breaking 1 and 2. | ||
| 614 |
2/2✓ Branch 0 taken 240608293 times.
✓ Branch 1 taken 14153429 times.
|
254761722 | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) |
| 615 | { | ||
| 616 | /* | ||
| 617 | if ( lastHitBy[q][1] == (frame-1) ) //Verify if this is needed at all now. | ||
| 618 | { | ||
| 619 | //Z_scripterrlog("frame is: %d\n", frame); | ||
| 620 | //Z_scripterrlog("Player->HitBy frame is: %d\n", lastHitBy[q][1]); | ||
| 621 | lastHitBy[q][0] = 0; | ||
| 622 | } | ||
| 623 | */ | ||
| 624 | 240608293 | lastHitBy[q][0] = 0; | |
| 625 | 240608293 | } | |
| 626 | 14153429 | } | |
| 627 | |||
| 628 | 76582 | void HeroClass::sethitHeroUID(int32_t type, int32_t screen_index) | |
| 629 | { | ||
| 630 | 76582 | lastHitBy[type][0] = screen_index; | |
| 631 | 76582 | } | |
| 632 | |||
| 633 | 3244 | int32_t HeroClass::gethitHeroUID(int32_t type) | |
| 634 | { | ||
| 635 | 3244 | return lastHitBy[type][0]; | |
| 636 | } | ||
| 637 | |||
| 638 | ✗ | void HeroClass::set_defence(int32_t type, int32_t v) | |
| 639 | { | ||
| 640 | ✗ | defence[type] = v; | |
| 641 | ✗ | } | |
| 642 | |||
| 643 | ✗ | int32_t HeroClass::get_defence(int32_t type) | |
| 644 | { | ||
| 645 | ✗ | return defence[type]; | |
| 646 | } | ||
| 647 | |||
| 648 | |||
| 649 | //Set Hero;s hurt sfx | ||
| 650 | 277115 | void HeroClass::setHurtSFX(int32_t sfx) | |
| 651 | { | ||
| 652 | 277115 | QMisc.miscsfx[sfxHURTPLAYER] = sfx; | |
| 653 | 277115 | } | |
| 654 | 15441 | int32_t HeroClass::getHurtSFX() | |
| 655 | { | ||
| 656 | 15441 | return QMisc.miscsfx[sfxHURTPLAYER]; | |
| 657 | } | ||
| 658 | |||
| 659 | ✗ | bool HeroClass::getDiagMove() | |
| 660 | { | ||
| 661 | ✗ | return diagonalMovement; | |
| 662 | } | ||
| 663 | 1057 | void HeroClass::setDiagMove(bool newdiag) | |
| 664 | { | ||
| 665 | 1057 | diagonalMovement=newdiag; | |
| 666 | 1057 | } | |
| 667 | 271788 | bool HeroClass::getBigHitbox() | |
| 668 | { | ||
| 669 | 271788 | return bigHitbox; | |
| 670 | } | ||
| 671 | 2492 | void HeroClass::setBigHitbox(bool newbigHitbox) | |
| 672 | { | ||
| 673 | 2492 | bigHitbox=newbigHitbox; | |
| 674 | 2492 | syofs = bigHitbox?0:8; | |
| 675 | 2492 | sysz_ofs = bigHitbox?0:-8; | |
| 676 | 2492 | } | |
| 677 | 6371 | int32_t HeroClass::getStepRate() | |
| 678 | { | ||
| 679 | 6371 | return steprate; | |
| 680 | } | ||
| 681 | 947 | void HeroClass::setStepRate(int32_t newrate) | |
| 682 | { | ||
| 683 | 947 | steprate = newrate; | |
| 684 | 947 | } | |
| 685 | ✗ | int32_t HeroClass::getSwimUpRate() | |
| 686 | { | ||
| 687 | ✗ | return game->get_sideswim_up(); | |
| 688 | } | ||
| 689 | ✗ | void HeroClass::setSwimUpRate(int32_t newrate) | |
| 690 | { | ||
| 691 | ✗ | game->set_sideswim_up(newrate); | |
| 692 | ✗ | } | |
| 693 | ✗ | int32_t HeroClass::getSwimSideRate() | |
| 694 | { | ||
| 695 | ✗ | return game->get_sideswim_side(); | |
| 696 | } | ||
| 697 | ✗ | void HeroClass::setSwimSideRate(int32_t newrate) | |
| 698 | { | ||
| 699 | ✗ | game->set_sideswim_side(newrate); | |
| 700 | ✗ | } | |
| 701 | ✗ | int32_t HeroClass::getSwimDownRate() | |
| 702 | { | ||
| 703 | ✗ | return game->get_sideswim_down(); | |
| 704 | } | ||
| 705 | ✗ | void HeroClass::setSwimDownRate(int32_t newrate) | |
| 706 | { | ||
| 707 | ✗ | game->set_sideswim_down(newrate); | |
| 708 | ✗ | } | |
| 709 | |||
| 710 | |||
| 711 | 10399081 | void HeroClass::herostep() | |
| 712 | { | ||
| 713 |
2/2✓ Branch 0 taken 9748437 times.
✓ Branch 1 taken 650644 times.
|
10399081 | lstep = lstep<((zinit.heroAnimationStyle==las_bszelda)?27:11) ? lstep+1 : 0; |
| 714 | //need to run all global/hero/dmap scripts here? | ||
| 715 | 10399081 | } | |
| 716 | |||
| 717 | 142451 | bool is_moving() | |
| 718 | { | ||
| 719 |
6/6✓ Branch 0 taken 110147 times.
✓ Branch 1 taken 32304 times.
✓ Branch 2 taken 82023 times.
✓ Branch 3 taken 28124 times.
✓ Branch 4 taken 32573 times.
✓ Branch 5 taken 49450 times.
|
142451 | return DrunkUp()||DrunkDown()||DrunkLeft()||DrunkRight(); |
| 720 | } | ||
| 721 | |||
| 722 | // called by ALLOFF() | ||
| 723 | 35820 | void HeroClass::resetflags(bool all) | |
| 724 | { | ||
| 725 | 35820 | refilling=REFILL_NONE; | |
| 726 | 35820 | inwallm=false; | |
| 727 | 35820 | inlikelike=blowcnt=whirlwind=specialcave=hclk=fairyclk=refill_why=didstuff=0; | |
| 728 | 35820 | usecounts.clear(); | |
| 729 | |||
| 730 |
4/4✓ Branch 0 taken 35739 times.
✓ Branch 1 taken 81 times.
✓ Branch 2 taken 367 times.
✓ Branch 3 taken 35372 times.
|
35820 | if(swordclk>0 || all) |
| 731 | { | ||
| 732 | 448 | swordclk=0; | |
| 733 | 448 | verifyAWpn(); | |
| 734 | 448 | } | |
| 735 |
4/4✓ Branch 0 taken 35802 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 367 times.
✓ Branch 3 taken 35435 times.
|
35820 | if(itemclk>0 || all) |
| 736 | 385 | itemclk=0; | |
| 737 |
3/4✓ Branch 0 taken 35820 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 367 times.
✓ Branch 3 taken 35453 times.
|
35820 | if(shieldjinxclk>0 || all) |
| 738 | 367 | shieldjinxclk=0; | |
| 739 | |||
| 740 |
2/2✓ Branch 0 taken 35453 times.
✓ Branch 1 taken 367 times.
|
35820 | if(all) |
| 741 | { | ||
| 742 | 367 | DivineProtectionShieldClk=0; | |
| 743 | |||
| 744 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 367 times.
|
367 | if(div_prot_item != -1) |
| 745 | { | ||
| 746 | ✗ | stop_sfx(itemsbuf[div_prot_item].usesound); | |
| 747 | ✗ | stop_sfx(itemsbuf[div_prot_item].usesound+1); | |
| 748 | ✗ | } | |
| 749 | |||
| 750 | 367 | div_prot_item = -1; | |
| 751 | 367 | hoverclk=jumping=0; | |
| 752 | 367 | hoverflags = 0; | |
| 753 | 367 | } | |
| 754 | 35820 | damageovertimeclk = 0; | |
| 755 | 35820 | newconveyorclk = 0; | |
| 756 | 35820 | switchhookclk = switchhookstyle = switchhookarg = switchhookmaxtime = 0; | |
| 757 |
2/2✓ Branch 0 taken 35820 times.
✓ Branch 1 taken 250740 times.
|
286560 | for(auto q = 0; q < 7; ++q) |
| 758 | 250740 | hooked_undercombos[q] = -1; | |
| 759 | 35820 | hopclk=0; | |
| 760 | 35820 | hopdir=-1; | |
| 761 | 35820 | attackclk=0; | |
| 762 | 35820 | stomping=false; | |
| 763 | 35820 | reset_swordcharge(); | |
| 764 | 35820 | diveclk=drownclk=drownCombo=0; | |
| 765 | 35820 | action=none; FFCore.setHeroAction(none); | |
| 766 | 35820 | conveyor_flags=0; | |
| 767 | 35820 | magiccastclk=0; | |
| 768 | 35820 | magicitem=-1; | |
| 769 | 35820 | } | |
| 770 | |||
| 771 | //Can use this for Hero->Stun. -Z | ||
| 772 | 14692 | void HeroClass::Freeze() | |
| 773 | { | ||
| 774 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14692 times.
|
14692 | if (action != inwind) |
| 775 | { | ||
| 776 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14692 times.
|
14692 | if (IsSideSwim()) {action=sideswimfreeze; FFCore.setHeroAction(sideswimfreeze);} |
| 777 | 14692 | else {action=freeze; FFCore.setHeroAction(freeze);} | |
| 778 | // also cancel Hero's attack | ||
| 779 | 14692 | attackclk = 0; | |
| 780 | 14692 | } | |
| 781 | 14692 | } | |
| 782 | 5954 | void HeroClass::unfreeze() | |
| 783 | { | ||
| 784 |
4/4✓ Branch 0 taken 1280 times.
✓ Branch 1 taken 4674 times.
✓ Branch 2 taken 1279 times.
✓ Branch 3 taken 1 times.
|
5954 | if(action==freeze && fairyclk<1) { action=none; FFCore.setHeroAction(none); } |
| 785 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 5954 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
5954 | if(action==sideswimfreeze && fairyclk<1) { action=sideswimming; FFCore.setHeroAction(sideswimming); } |
| 786 | 5954 | } | |
| 787 | |||
| 788 | 192 | void HeroClass::Drown(int32_t state) | |
| 789 | { | ||
| 790 | // Hero should never drown if the ladder is out | ||
| 791 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 192 times.
|
192 | if(ladderx+laddery) |
| 792 | ✗ | return; | |
| 793 | |||
| 794 | 192 | drop_liftwpn(); | |
| 795 |
2/2✓ Branch 0 taken 188 times.
✓ Branch 1 taken 4 times.
|
192 | switch(state) |
| 796 | { | ||
| 797 | case 1: | ||
| 798 | 4 | action=lavadrowning; FFCore.setHeroAction(lavadrowning); | |
| 799 | 4 | attackclk=0; | |
| 800 | 4 | attack=wNone; | |
| 801 | 4 | attackid=-1; | |
| 802 | 4 | reset_swordcharge(); | |
| 803 | 4 | drownclk=64; | |
| 804 | 4 | z=fakez=fall=fakefall=0; | |
| 805 | 4 | break; | |
| 806 | |||
| 807 | |||
| 808 | default: | ||
| 809 | { | ||
| 810 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 188 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
188 | if (isSideViewHero() && get_qr(qr_SIDESWIM)){action=sidedrowning; FFCore.setHeroAction(sidedrowning);} |
| 811 | 188 | else {action=drowning; FFCore.setHeroAction(drowning);} | |
| 812 | 188 | attackclk=0; | |
| 813 | 188 | attack=wNone; | |
| 814 | 188 | attackid=-1; | |
| 815 | 188 | reset_swordcharge(); | |
| 816 | 188 | drownclk=64; | |
| 817 | 188 | z=fakez=fall=fakefall=0; | |
| 818 | 188 | break; | |
| 819 | } | ||
| 820 | } | ||
| 821 | |||
| 822 | 192 | } | |
| 823 | |||
| 824 | 4683 | void HeroClass::finishedmsg() | |
| 825 | { | ||
| 826 | //these are to cancel out any keys that Hero may | ||
| 827 | //be pressing so he doesn't attack at the end of | ||
| 828 | //a message if he was scrolling through it quickly. | ||
| 829 | 4683 | rAbtn(); | |
| 830 | 4683 | rBbtn(); | |
| 831 | 4683 | unfreeze(); | |
| 832 | |||
| 833 |
3/4✓ Branch 0 taken 4589 times.
✓ Branch 1 taken 94 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4558 times.
|
9241 | if(action == landhold1 || |
| 834 |
2/2✓ Branch 0 taken 4560 times.
✓ Branch 1 taken 29 times.
|
4589 | action == landhold2 || |
| 835 |
2/2✓ Branch 0 taken 4559 times.
✓ Branch 1 taken 1 times.
|
4560 | action == waterhold1 || |
| 836 |
2/2✓ Branch 0 taken 4558 times.
✓ Branch 1 taken 1 times.
|
4559 | action == waterhold2 || |
| 837 |
1/2✓ Branch 0 taken 4558 times.
✗ Branch 1 not taken.
|
4558 | action == sidewaterhold1 || |
| 838 | 4558 | action == sidewaterhold2) | |
| 839 | { | ||
| 840 | 125 | holdclk = 1; | |
| 841 | 125 | } | |
| 842 | 4683 | } | |
| 843 | 78 | void HeroClass::setEaten(int32_t i) | |
| 844 | { | ||
| 845 | 78 | inlikelike=i; | |
| 846 | 78 | } | |
| 847 | 70 | int32_t HeroClass::getEaten() | |
| 848 | { | ||
| 849 | 70 | return inlikelike; | |
| 850 | } | ||
| 851 | 60592022 | zfix HeroClass::getX() | |
| 852 | { | ||
| 853 | 60592022 | return x; | |
| 854 | } | ||
| 855 | 61016648 | zfix HeroClass::getY() | |
| 856 | { | ||
| 857 | 61016648 | return y; | |
| 858 | } | ||
| 859 | 89677650 | zfix HeroClass::getZ() | |
| 860 | { | ||
| 861 | 89677650 | return z; | |
| 862 | } | ||
| 863 | 55197136 | zfix HeroClass::getFakeZ() | |
| 864 | { | ||
| 865 | 55197136 | return fakez; | |
| 866 | } | ||
| 867 | 641401 | zfix HeroClass::getFall() | |
| 868 | { | ||
| 869 | 641401 | return fall; | |
| 870 | } | ||
| 871 | ✗ | zfix HeroClass::getFakeFall() | |
| 872 | { | ||
| 873 | ✗ | return fakefall; | |
| 874 | } | ||
| 875 | ✗ | zfix HeroClass::getXOfs() | |
| 876 | { | ||
| 877 | ✗ | return xofs; | |
| 878 | } | ||
| 879 | 1344 | zfix HeroClass::getYOfs() | |
| 880 | { | ||
| 881 | 1344 | return yofs; | |
| 882 | } | ||
| 883 | ✗ | void HeroClass::setXOfs(int32_t newxofs) | |
| 884 | { | ||
| 885 | ✗ | xofs=newxofs; | |
| 886 | ✗ | } | |
| 887 | ✗ | void HeroClass::setYOfs(int32_t newyofs) | |
| 888 | { | ||
| 889 | ✗ | yofs=newyofs; | |
| 890 | ✗ | } | |
| 891 | ✗ | int32_t HeroClass::getHXOfs() | |
| 892 | { | ||
| 893 | ✗ | return hxofs; | |
| 894 | } | ||
| 895 | ✗ | int32_t HeroClass::getHYOfs() | |
| 896 | { | ||
| 897 | ✗ | return hyofs; | |
| 898 | } | ||
| 899 | ✗ | int32_t HeroClass::getHXSz() | |
| 900 | { | ||
| 901 | ✗ | return hit_width; | |
| 902 | } | ||
| 903 | ✗ | int32_t HeroClass::getHYSz() | |
| 904 | { | ||
| 905 | ✗ | return hit_height; | |
| 906 | } | ||
| 907 | 88064 | zfix HeroClass::getClimbCoverX() | |
| 908 | { | ||
| 909 | 88064 | return climb_cover_x; | |
| 910 | } | ||
| 911 | 88064 | zfix HeroClass::getClimbCoverY() | |
| 912 | { | ||
| 913 | 88064 | return climb_cover_y; | |
| 914 | } | ||
| 915 | ✗ | int32_t HeroClass::getLadderX() | |
| 916 | { | ||
| 917 | ✗ | return ladderx; | |
| 918 | } | ||
| 919 | ✗ | int32_t HeroClass::getLadderY() | |
| 920 | { | ||
| 921 | ✗ | return laddery; | |
| 922 | } | ||
| 923 | |||
| 924 | 459866 | void HeroClass::setX(int32_t new_x) | |
| 925 | { | ||
| 926 | 459866 | zfix dx=new_x-x; | |
| 927 | 459866 | justmoved = 2; | |
| 928 |
2/2✓ Branch 0 taken 459845 times.
✓ Branch 1 taken 21 times.
|
459866 | if(Lwpns.idFirst(wHookshot)>-1) |
| 929 | { | ||
| 930 | 21 | Lwpns.spr(Lwpns.idFirst(wHookshot))->x+=dx; | |
| 931 | 21 | hs_startx+=(int32_t)dx; | |
| 932 | 21 | } | |
| 933 | |||
| 934 |
2/2✓ Branch 0 taken 459845 times.
✓ Branch 1 taken 21 times.
|
459866 | if(Lwpns.idFirst(wHSHandle)>-1) |
| 935 | { | ||
| 936 | 21 | Lwpns.spr(Lwpns.idFirst(wHSHandle))->x+=dx; | |
| 937 | 21 | } | |
| 938 | |||
| 939 |
2/2✓ Branch 0 taken 459857 times.
✓ Branch 1 taken 9 times.
|
459866 | if(chainlinks.Count()>0) |
| 940 | { | ||
| 941 |
2/2✓ Branch 0 taken 19 times.
✓ Branch 1 taken 9 times.
|
28 | for(int32_t j=0; j<chainlinks.Count(); j++) |
| 942 | { | ||
| 943 | 19 | chainlinks.spr(j)->x+=dx; | |
| 944 | 19 | } | |
| 945 | 9 | } | |
| 946 | |||
| 947 | 459866 | x=new_x; | |
| 948 | |||
| 949 | // A kludge | ||
| 950 |
4/4✓ Branch 0 taken 3704 times.
✓ Branch 1 taken 456162 times.
✓ Branch 2 taken 2385 times.
✓ Branch 3 taken 1319 times.
|
459866 | if(!diagonalMovement && dir<=down) |
| 951 | 1319 | is_on_conveyor=true; | |
| 952 | 459866 | } | |
| 953 | |||
| 954 | 474142 | void HeroClass::setY(int32_t new_y) | |
| 955 | { | ||
| 956 | 474142 | zfix dy=new_y-y; | |
| 957 | 474142 | justmoved = 2; | |
| 958 |
2/2✓ Branch 0 taken 474133 times.
✓ Branch 1 taken 9 times.
|
474142 | if(Lwpns.idFirst(wHookshot)>-1) |
| 959 | { | ||
| 960 | 9 | Lwpns.spr(Lwpns.idFirst(wHookshot))->y+=dy; | |
| 961 | 9 | hs_starty+=(int32_t)dy; | |
| 962 | 9 | } | |
| 963 | |||
| 964 |
2/2✓ Branch 0 taken 474133 times.
✓ Branch 1 taken 9 times.
|
474142 | if(Lwpns.idFirst(wHSHandle)>-1) |
| 965 | { | ||
| 966 | 9 | Lwpns.spr(Lwpns.idFirst(wHSHandle))->y+=dy; | |
| 967 | 9 | } | |
| 968 | |||
| 969 |
1/2✓ Branch 0 taken 474142 times.
✗ Branch 1 not taken.
|
474142 | if(chainlinks.Count()>0) |
| 970 | { | ||
| 971 | ✗ | for(int32_t j=0; j<chainlinks.Count(); j++) | |
| 972 | { | ||
| 973 | ✗ | chainlinks.spr(j)->y+=dy; | |
| 974 | ✗ | } | |
| 975 | ✗ | } | |
| 976 | |||
| 977 | 474142 | y=new_y; | |
| 978 | |||
| 979 | // A kludge | ||
| 980 |
4/4✓ Branch 0 taken 3704 times.
✓ Branch 1 taken 470438 times.
✓ Branch 2 taken 1319 times.
✓ Branch 3 taken 2385 times.
|
474142 | if(!diagonalMovement && dir>=left) |
| 981 | 2385 | is_on_conveyor=true; | |
| 982 | 474142 | } | |
| 983 | |||
| 984 | 4 | void HeroClass::setZ(int32_t new_z) | |
| 985 | { | ||
| 986 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | if(isSideViewHero()) |
| 987 | ✗ | return; | |
| 988 | |||
| 989 |
2/4✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
|
4 | if(z==0 && new_z > 0) |
| 990 | { | ||
| 991 |
1/4✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
4 | switch(action) |
| 992 | { | ||
| 993 | case swimming: | ||
| 994 | { | ||
| 995 | ✗ | diveclk=0; | |
| 996 | ✗ | action=walking; FFCore.setHeroAction(walking); | |
| 997 | ✗ | break; | |
| 998 | } | ||
| 999 | |||
| 1000 | case waterhold1: | ||
| 1001 | { | ||
| 1002 | ✗ | action=landhold1; FFCore.setHeroAction(landhold1); | |
| 1003 | ✗ | break; | |
| 1004 | } | ||
| 1005 | |||
| 1006 | case waterhold2: | ||
| 1007 | { | ||
| 1008 | ✗ | action=landhold2; FFCore.setHeroAction(landhold2); | |
| 1009 | ✗ | break; | |
| 1010 | } | ||
| 1011 | |||
| 1012 | default: | ||
| 1013 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | if(charging) //!DIMITODO: Let Hero jump while charging sword |
| 1014 | { | ||
| 1015 | ✗ | reset_swordcharge(); | |
| 1016 | ✗ | attackclk=0; | |
| 1017 | ✗ | } | |
| 1018 | |||
| 1019 | 4 | break; | |
| 1020 | } | ||
| 1021 | 4 | } | |
| 1022 | |||
| 1023 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | z=(new_z>0 ? new_z : 0); |
| 1024 | 4 | } | |
| 1025 | |||
| 1026 | ✗ | void HeroClass::setFakeZ(int32_t new_z) | |
| 1027 | { | ||
| 1028 | ✗ | if(isSideViewHero()) | |
| 1029 | ✗ | return; | |
| 1030 | |||
| 1031 | ✗ | if(fakez==0 && new_z > 0) | |
| 1032 | { | ||
| 1033 | ✗ | switch(action) | |
| 1034 | { | ||
| 1035 | case swimming: | ||
| 1036 | { | ||
| 1037 | ✗ | diveclk=0; | |
| 1038 | ✗ | action=walking; FFCore.setHeroAction(walking); | |
| 1039 | ✗ | break; | |
| 1040 | } | ||
| 1041 | |||
| 1042 | case waterhold1: | ||
| 1043 | { | ||
| 1044 | ✗ | action=landhold1; FFCore.setHeroAction(landhold1); | |
| 1045 | ✗ | break; | |
| 1046 | } | ||
| 1047 | |||
| 1048 | case waterhold2: | ||
| 1049 | { | ||
| 1050 | ✗ | action=landhold2; FFCore.setHeroAction(landhold2); | |
| 1051 | ✗ | break; | |
| 1052 | } | ||
| 1053 | |||
| 1054 | default: | ||
| 1055 | ✗ | if(charging) //!DIMITODO: Let Hero jump while charging sword | |
| 1056 | { | ||
| 1057 | ✗ | reset_swordcharge(); | |
| 1058 | ✗ | attackclk=0; | |
| 1059 | ✗ | } | |
| 1060 | |||
| 1061 | ✗ | break; | |
| 1062 | } | ||
| 1063 | ✗ | } | |
| 1064 | |||
| 1065 | ✗ | fakez=(new_z>0 ? new_z : 0); | |
| 1066 | ✗ | } | |
| 1067 | |||
| 1068 | 23466 | void HeroClass::setXfix(zfix new_x) | |
| 1069 | { | ||
| 1070 | //Z_scripterrlog("setxdbl: %f\n",new_x); | ||
| 1071 | 23466 | zfix dx=new_x-x; | |
| 1072 | 23466 | justmoved = 2; | |
| 1073 |
2/2✓ Branch 0 taken 23456 times.
✓ Branch 1 taken 10 times.
|
23466 | if(Lwpns.idFirst(wHookshot)>-1) |
| 1074 | { | ||
| 1075 | 10 | Lwpns.spr(Lwpns.idFirst(wHookshot))->x+=dx; | |
| 1076 | 10 | hs_startx+=(int32_t)dx; | |
| 1077 | 10 | } | |
| 1078 | |||
| 1079 |
2/2✓ Branch 0 taken 23456 times.
✓ Branch 1 taken 10 times.
|
23466 | if(Lwpns.idFirst(wHSHandle)>-1) |
| 1080 | { | ||
| 1081 | 10 | Lwpns.spr(Lwpns.idFirst(wHSHandle))->x+=dx; | |
| 1082 | 10 | } | |
| 1083 | |||
| 1084 |
2/2✓ Branch 0 taken 23459 times.
✓ Branch 1 taken 7 times.
|
23466 | if(chainlinks.Count()>0) |
| 1085 | { | ||
| 1086 |
2/2✓ Branch 0 taken 15 times.
✓ Branch 1 taken 7 times.
|
22 | for(int32_t j=0; j<chainlinks.Count(); j++) |
| 1087 | { | ||
| 1088 | 15 | chainlinks.spr(j)->x+=dx; | |
| 1089 | 15 | } | |
| 1090 | 7 | } | |
| 1091 | |||
| 1092 | 23466 | x=new_x; | |
| 1093 | |||
| 1094 | // A kludge | ||
| 1095 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 23466 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
23466 | if(!diagonalMovement && dir<=down) |
| 1096 | ✗ | is_on_conveyor=true; | |
| 1097 | 23466 | } | |
| 1098 | |||
| 1099 | 22709 | void HeroClass::setYfix(zfix new_y) | |
| 1100 | { | ||
| 1101 | 22709 | zfix dy=new_y-y; | |
| 1102 | 22709 | justmoved = 2; | |
| 1103 |
2/2✓ Branch 0 taken 22669 times.
✓ Branch 1 taken 40 times.
|
22709 | if(Lwpns.idFirst(wHookshot)>-1) |
| 1104 | { | ||
| 1105 | 40 | Lwpns.spr(Lwpns.idFirst(wHookshot))->y+=dy; | |
| 1106 | 40 | hs_starty+=(int32_t)dy; | |
| 1107 | 40 | } | |
| 1108 | |||
| 1109 |
2/2✓ Branch 0 taken 22669 times.
✓ Branch 1 taken 40 times.
|
22709 | if(Lwpns.idFirst(wHSHandle)>-1) |
| 1110 | { | ||
| 1111 | 40 | Lwpns.spr(Lwpns.idFirst(wHSHandle))->y+=dy; | |
| 1112 | 40 | } | |
| 1113 | |||
| 1114 |
2/2✓ Branch 0 taken 22675 times.
✓ Branch 1 taken 34 times.
|
22709 | if(chainlinks.Count()>0) |
| 1115 | { | ||
| 1116 |
2/2✓ Branch 0 taken 179 times.
✓ Branch 1 taken 34 times.
|
213 | for(int32_t j=0; j<chainlinks.Count(); j++) |
| 1117 | { | ||
| 1118 | 179 | chainlinks.spr(j)->y+=dy; | |
| 1119 | 179 | } | |
| 1120 | 34 | } | |
| 1121 | |||
| 1122 | 22709 | y=new_y; | |
| 1123 | |||
| 1124 | // A kludge | ||
| 1125 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 22709 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
22709 | if(!diagonalMovement && dir>=left) |
| 1126 | ✗ | is_on_conveyor=true; | |
| 1127 | 22709 | } | |
| 1128 | |||
| 1129 | 2775 | void HeroClass::setZfix(zfix new_z) | |
| 1130 | { | ||
| 1131 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2775 times.
|
2775 | if(isSideViewHero()) |
| 1132 | ✗ | return; | |
| 1133 | |||
| 1134 |
4/4✓ Branch 0 taken 20 times.
✓ Branch 1 taken 2755 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 14 times.
|
2775 | if(z==0 && new_z > 0) |
| 1135 | { | ||
| 1136 |
1/4✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
14 | switch(action) |
| 1137 | { | ||
| 1138 | case swimming: | ||
| 1139 | { | ||
| 1140 | ✗ | diveclk=0; | |
| 1141 | ✗ | action=walking; FFCore.setHeroAction(walking); | |
| 1142 | ✗ | break; | |
| 1143 | } | ||
| 1144 | |||
| 1145 | case waterhold1: | ||
| 1146 | { | ||
| 1147 | ✗ | action=landhold1; FFCore.setHeroAction(landhold1); | |
| 1148 | ✗ | break; | |
| 1149 | } | ||
| 1150 | |||
| 1151 | case waterhold2: | ||
| 1152 | { | ||
| 1153 | ✗ | action=landhold2; FFCore.setHeroAction(landhold2); | |
| 1154 | ✗ | break; | |
| 1155 | } | ||
| 1156 | |||
| 1157 | default: | ||
| 1158 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
14 | if(charging) //!DIMITODO: Let Hero jump while charging sword |
| 1159 | { | ||
| 1160 | ✗ | reset_swordcharge(); | |
| 1161 | ✗ | attackclk=0; | |
| 1162 | ✗ | } | |
| 1163 | |||
| 1164 | 14 | break; | |
| 1165 | } | ||
| 1166 | 14 | } | |
| 1167 | |||
| 1168 |
2/2✓ Branch 0 taken 2768 times.
✓ Branch 1 taken 7 times.
|
2775 | z=(new_z>0 ? new_z : 0_zf); |
| 1169 | 2775 | } | |
| 1170 | |||
| 1171 | ✗ | void HeroClass::setFakeZfix(zfix new_z) | |
| 1172 | { | ||
| 1173 | ✗ | if(isSideViewHero()) | |
| 1174 | ✗ | return; | |
| 1175 | |||
| 1176 | ✗ | if(fakez==0 && new_z > 0) | |
| 1177 | { | ||
| 1178 | ✗ | switch(action) | |
| 1179 | { | ||
| 1180 | case swimming: | ||
| 1181 | { | ||
| 1182 | ✗ | diveclk=0; | |
| 1183 | ✗ | action=walking; FFCore.setHeroAction(walking); | |
| 1184 | ✗ | break; | |
| 1185 | } | ||
| 1186 | |||
| 1187 | case waterhold1: | ||
| 1188 | { | ||
| 1189 | ✗ | action=landhold1; FFCore.setHeroAction(landhold1); | |
| 1190 | ✗ | break; | |
| 1191 | } | ||
| 1192 | |||
| 1193 | case waterhold2: | ||
| 1194 | { | ||
| 1195 | ✗ | action=landhold2; FFCore.setHeroAction(landhold2); | |
| 1196 | ✗ | break; | |
| 1197 | } | ||
| 1198 | |||
| 1199 | default: | ||
| 1200 | ✗ | if(charging) //!DIMITODO: Let Hero jump while charging sword | |
| 1201 | { | ||
| 1202 | ✗ | reset_swordcharge(); | |
| 1203 | ✗ | attackclk=0; | |
| 1204 | ✗ | } | |
| 1205 | |||
| 1206 | ✗ | break; | |
| 1207 | } | ||
| 1208 | ✗ | } | |
| 1209 | |||
| 1210 | ✗ | fakez=(new_z>0 ? new_z : 0_zf); | |
| 1211 | ✗ | } | |
| 1212 | |||
| 1213 | 64810 | void HeroClass::setFall(zfix new_fall) | |
| 1214 | { | ||
| 1215 | 64810 | fall=new_fall; | |
| 1216 | 64810 | justmoved = 2; | |
| 1217 | 64810 | jumping=-1; | |
| 1218 | 64810 | } | |
| 1219 | ✗ | void HeroClass::setFakeFall(zfix new_fall) | |
| 1220 | { | ||
| 1221 | ✗ | fakefall=new_fall; | |
| 1222 | ✗ | jumping=-1; | |
| 1223 | ✗ | } | |
| 1224 | ✗ | void HeroClass::setClimbCoverX(int32_t new_x) | |
| 1225 | { | ||
| 1226 | ✗ | climb_cover_x=new_x; | |
| 1227 | ✗ | } | |
| 1228 | ✗ | void HeroClass::setClimbCoverY(int32_t new_y) | |
| 1229 | { | ||
| 1230 | ✗ | climb_cover_y=new_y; | |
| 1231 | ✗ | } | |
| 1232 | 131599 | int32_t HeroClass::getLStep() | |
| 1233 | { | ||
| 1234 | 131599 | return lstep; | |
| 1235 | } | ||
| 1236 | 5756 | int32_t HeroClass::getCharging() | |
| 1237 | { | ||
| 1238 | 5756 | return charging; | |
| 1239 | } | ||
| 1240 | 127163 | bool HeroClass::isCharged() | |
| 1241 | { | ||
| 1242 | 127163 | return spins>0; | |
| 1243 | } | ||
| 1244 | 2 | int32_t HeroClass::getAttackClk() | |
| 1245 | { | ||
| 1246 | 2 | return attackclk; | |
| 1247 | } | ||
| 1248 | 2 | void HeroClass::setAttackClk(int32_t new_clk) | |
| 1249 | { | ||
| 1250 | 2 | attackclk=new_clk; | |
| 1251 | 2 | } | |
| 1252 | ✗ | void HeroClass::setCharging(int32_t new_charging) | |
| 1253 | { | ||
| 1254 | ✗ | charging=new_charging; | |
| 1255 | ✗ | } | |
| 1256 | 2917933170 | int32_t HeroClass::getSwordClk() | |
| 1257 | { | ||
| 1258 | 2917933170 | return swordclk; | |
| 1259 | } | ||
| 1260 | 2850974879 | int32_t HeroClass::getItemClk() | |
| 1261 | { | ||
| 1262 | 2850974879 | return itemclk; | |
| 1263 | } | ||
| 1264 | 2850715186 | int32_t HeroClass::getShieldClk() | |
| 1265 | { | ||
| 1266 | 2850715186 | return shieldjinxclk; | |
| 1267 | } | ||
| 1268 | 716 | void HeroClass::setSwordClk(int32_t newclk) | |
| 1269 | { | ||
| 1270 | 716 | swordclk=newclk; | |
| 1271 | 716 | verifyAWpn(); | |
| 1272 | 716 | } | |
| 1273 | 5873 | void HeroClass::setItemClk(int32_t newclk) | |
| 1274 | { | ||
| 1275 | 5873 | itemclk=newclk; | |
| 1276 | 5873 | } | |
| 1277 | 2 | void HeroClass::setShieldClk(int32_t newclk) | |
| 1278 | { | ||
| 1279 | 2 | shieldjinxclk=newclk; | |
| 1280 | 2 | } | |
| 1281 | // TODO remove, no longer needed. | ||
| 1282 | 1250668 | zfix HeroClass::getModifiedX() | |
| 1283 | { | ||
| 1284 | 1250668 | zfix tempx=x; | |
| 1285 | 1250668 | return tempx; | |
| 1286 | } | ||
| 1287 | |||
| 1288 | 1250668 | zfix HeroClass::getModifiedY() | |
| 1289 | { | ||
| 1290 | 1250668 | zfix tempy=y; | |
| 1291 | 1250668 | return tempy; | |
| 1292 | } | ||
| 1293 | |||
| 1294 | 64149 | int32_t HeroClass::getDir() | |
| 1295 | { | ||
| 1296 | 64149 | return dir; | |
| 1297 | } | ||
| 1298 | 93583 | void HeroClass::setDir(int32_t newdir) | |
| 1299 | { | ||
| 1300 | 93583 | dir=newdir; | |
| 1301 | 93583 | reset_hookshot(); | |
| 1302 | 93583 | } | |
| 1303 | 441276 | int32_t HeroClass::getHitDir() | |
| 1304 | { | ||
| 1305 | 441276 | return hitdir; | |
| 1306 | } | ||
| 1307 | 2220 | void HeroClass::setHitDir(int32_t newdir) | |
| 1308 | { | ||
| 1309 | 2220 | hitdir = newdir; | |
| 1310 | 2220 | } | |
| 1311 | ✗ | int32_t HeroClass::getClk() | |
| 1312 | { | ||
| 1313 | ✗ | return clk; | |
| 1314 | } | ||
| 1315 | 178963 | int32_t HeroClass::getPushing() | |
| 1316 | { | ||
| 1317 | 178963 | return pushing; | |
| 1318 | } | ||
| 1319 | 15582 | void HeroClass::Catch() | |
| 1320 | { | ||
| 1321 |
5/6✓ Branch 0 taken 15582 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12602 times.
✓ Branch 3 taken 2980 times.
✓ Branch 4 taken 6224 times.
✓ Branch 5 taken 6378 times.
|
15582 | if(!inwallm && (action==none || action==walking)) |
| 1322 | { | ||
| 1323 | 9204 | SetAttack(); | |
| 1324 | 9204 | attackclk=0; | |
| 1325 | 9204 | attack=wCatching; | |
| 1326 | 9204 | } | |
| 1327 | 15582 | } | |
| 1328 | |||
| 1329 | 4372133 | bool HeroClass::getClock() | |
| 1330 | { | ||
| 1331 | 4372133 | return superman; | |
| 1332 | } | ||
| 1333 | 952 | void HeroClass::setClock(bool state) | |
| 1334 | { | ||
| 1335 | 952 | superman=state; | |
| 1336 | 952 | } | |
| 1337 | 16554586 | int32_t HeroClass::getFlashingCSet() | |
| 1338 | { | ||
| 1339 | 16554586 | int32_t temp_cs = 6; | |
| 1340 |
2/2✓ Branch 0 taken 16301698 times.
✓ Branch 1 taken 252888 times.
|
16554586 | if (script_hero_cset > -1) temp_cs = script_hero_cset; |
| 1341 |
2/2✓ Branch 0 taken 2277803 times.
✓ Branch 1 taken 14276783 times.
|
16554586 | if (!get_qr(qr_HEROFLICKER)) |
| 1342 | { | ||
| 1343 |
3/4✓ Branch 0 taken 120557 times.
✓ Branch 1 taken 14156226 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 120557 times.
|
14276783 | if (superman && getCanFlicker()) |
| 1344 | { | ||
| 1345 | 120557 | temp_cs += (((~frame) >> 1) & 3); | |
| 1346 | 120557 | } | |
| 1347 |
4/6✓ Branch 0 taken 629596 times.
✓ Branch 1 taken 13526630 times.
✓ Branch 2 taken 629596 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 629596 times.
|
14156226 | else if (hclk && (DivineProtectionShieldClk <= 0) && getCanFlicker()) |
| 1348 | { | ||
| 1349 | 629596 | temp_cs += ((hclk >> 1) & 3); | |
| 1350 | 629596 | } | |
| 1351 | 14276783 | } | |
| 1352 | 16554586 | return temp_cs; | |
| 1353 | } | ||
| 1354 | 17472859 | bool HeroClass::is_hitflickerframe() | |
| 1355 | { | ||
| 1356 |
6/6✓ Branch 0 taken 2428528 times.
✓ Branch 1 taken 15044331 times.
✓ Branch 2 taken 2365727 times.
✓ Branch 3 taken 62801 times.
✓ Branch 4 taken 107237 times.
✓ Branch 5 taken 2258490 times.
|
17472859 | if (!(get_qr(qr_HEROFLICKER) && (superman || hclk))) |
| 1357 | 17302821 | return false; | |
| 1358 | |||
| 1359 | 170038 | int32_t fr = game->get_spriteflickerspeed(); | |
| 1360 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 170038 times.
|
170038 | if (fr == 0) |
| 1361 | ✗ | return true; | |
| 1362 | 170038 | return frame % (fr * 2) >= fr; | |
| 1363 | 17472859 | } | |
| 1364 | 94393358 | int32_t HeroClass::getAction() // Used by ZScript | |
| 1365 | { | ||
| 1366 |
2/2✓ Branch 0 taken 31122 times.
✓ Branch 1 taken 94362236 times.
|
94393358 | if(spins > 0) |
| 1367 | 31122 | return isspinning; | |
| 1368 |
2/2✓ Branch 0 taken 369381 times.
✓ Branch 1 taken 93992855 times.
|
94362236 | else if(charging > 0) |
| 1369 | 369381 | return ischarging; | |
| 1370 |
2/2✓ Branch 0 taken 93885669 times.
✓ Branch 1 taken 107186 times.
|
93992855 | else if(diveclk > 0) |
| 1371 | 107186 | return isdiving; | |
| 1372 | //else if (pushing > 0) return ispushing; //Needs a QR? -Z or make it an instruction as Hero->Pushing? Probably better, as that has a clk?? | ||
| 1373 | |||
| 1374 | 93885669 | return action; | |
| 1375 | 94393358 | } | |
| 1376 | |||
| 1377 | 90062945 | int32_t HeroClass::getAction2() // Used by ZScript new FFCore.actions | |
| 1378 | { | ||
| 1379 |
2/2✓ Branch 0 taken 25963 times.
✓ Branch 1 taken 90036982 times.
|
90062945 | if(spins > 0) |
| 1380 | 25963 | return isspinning; | |
| 1381 |
2/2✓ Branch 0 taken 333968 times.
✓ Branch 1 taken 89703014 times.
|
90036982 | else if(charging > 0) |
| 1382 | 333968 | return ischarging; | |
| 1383 |
2/2✓ Branch 0 taken 89504065 times.
✓ Branch 1 taken 198949 times.
|
89703014 | else if(diveclk > 0) |
| 1384 | 198949 | return isdiving; | |
| 1385 | //else if (pushing > 0) return ispushing; //Needs a QR? -Z or make it an instruction as Hero->Pushing? Probably better, as that has a clk?? | ||
| 1386 | |||
| 1387 | 89504065 | return -1; | |
| 1388 | 90062945 | } | |
| 1389 | |||
| 1390 | 5057 | void HeroClass::setAction(actiontype new_action) // Used by ZScript | |
| 1391 | { | ||
| 1392 |
4/8✓ Branch 0 taken 5057 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5057 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5057 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5057 times.
|
10114 | if(new_action==dying || new_action==won || new_action==scrolling || |
| 1393 |
3/6✓ Branch 0 taken 5057 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5057 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5057 times.
✗ Branch 5 not taken.
|
5057 | new_action==inwind || new_action==ischarging || new_action==sideswimischarging || |
| 1394 | 5057 | new_action==hopping) //!DIMITODO: allow setting sideswimming stuff | |
| 1395 | ✗ | return; // Can't use these actions. | |
| 1396 | |||
| 1397 |
3/6✓ Branch 0 taken 4858 times.
✓ Branch 1 taken 199 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4858 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
5057 | if (!isSideViewHero() && (new_action>=sideswimming && new_action <= sideswimischarging)) |
| 1398 | ✗ | return; | |
| 1399 | |||
| 1400 |
1/2✓ Branch 0 taken 5057 times.
✗ Branch 1 not taken.
|
5057 | if(new_action==rafting) |
| 1401 | { | ||
| 1402 | ✗ | if(get_qr(qr_DISALLOW_SETTING_RAFTING)) return; | |
| 1403 | ✗ | if(!(isRaftFlag(nextflag(x+8,y+8,dir,false))||isRaftFlag(nextflag(x+8,y+8,dir,true)))) | |
| 1404 | ✗ | return; | |
| 1405 | ✗ | } | |
| 1406 | |||
| 1407 | |||
| 1408 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 5057 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
5057 | if(magicitem>-1 && itemsbuf[magicitem].family==itype_divineescape) |
| 1409 | { | ||
| 1410 | // Using Divine Escape | ||
| 1411 | ✗ | if(magiccastclk<96) | |
| 1412 | { | ||
| 1413 | // Not cast yet; cancel it | ||
| 1414 | ✗ | magicitem=-1; | |
| 1415 | ✗ | magiccastclk=0; | |
| 1416 | ✗ | } | |
| 1417 | else | ||
| 1418 | // Already activated; don't do anything | ||
| 1419 | ✗ | return; | |
| 1420 | ✗ | } | |
| 1421 | |||
| 1422 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5057 times.
|
5057 | if(action==inwind) // Remove from whirlwind |
| 1423 | { | ||
| 1424 | ✗ | xofs=0; | |
| 1425 | ✗ | whirlwind=0; | |
| 1426 | ✗ | lstep=0; | |
| 1427 | ✗ | if ( dontdraw < 2 ) { dontdraw=0; } | |
| 1428 | ✗ | } | |
| 1429 |
2/4✓ Branch 0 taken 5057 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5057 times.
|
5057 | else if(action==freeze||action==sideswimfreeze) // Might be in enemy wind |
| 1430 | { | ||
| 1431 | ✗ | sprite* wind=0; | |
| 1432 | ✗ | bool foundWind=false; | |
| 1433 | ✗ | for(int32_t i=0; i<Ewpns.Count(); i++) | |
| 1434 | { | ||
| 1435 | ✗ | wind=Ewpns.spr(i); | |
| 1436 | ✗ | if(wind->id==ewWind && wind->misc==999) | |
| 1437 | { | ||
| 1438 | ✗ | foundWind=true; | |
| 1439 | ✗ | break; | |
| 1440 | } | ||
| 1441 | ✗ | } | |
| 1442 | |||
| 1443 | ✗ | if(foundWind) | |
| 1444 | { | ||
| 1445 | ✗ | xofs=0; | |
| 1446 | ✗ | if ( dontdraw < 2 ) { dontdraw=false; } | |
| 1447 | ✗ | wind->misc=-1; | |
| 1448 | ✗ | x=wind->x; | |
| 1449 | ✗ | y=wind->y; | |
| 1450 | ✗ | } | |
| 1451 | ✗ | } | |
| 1452 | |||
| 1453 | //Unless compat rule is on, reset hopping clocks when writing action! | ||
| 1454 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 5057 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
5057 | if(action == hopping && !get_qr(qr_NO_OVERWRITING_HOPPING)) |
| 1455 | { | ||
| 1456 | ✗ | hopclk = 0; | |
| 1457 | ✗ | hopdir = -1; | |
| 1458 | ✗ | } | |
| 1459 | |||
| 1460 |
3/4✓ Branch 0 taken 2679 times.
✓ Branch 1 taken 2378 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2679 times.
|
5057 | if(new_action != attacking && new_action != sideswimattacking) |
| 1461 | { | ||
| 1462 | 2679 | attackclk=0; | |
| 1463 | |||
| 1464 |
1/2✓ Branch 0 taken 2679 times.
✗ Branch 1 not taken.
|
2679 | if(attack==wHookshot) |
| 1465 | ✗ | reset_hookshot(); | |
| 1466 | 2679 | } | |
| 1467 |
2/4✓ Branch 0 taken 5057 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5057 times.
|
5057 | if(new_action != isspinning && new_action != sideswimisspinning) |
| 1468 | { | ||
| 1469 | 5057 | charging = 0; | |
| 1470 | 5057 | spins = 0; | |
| 1471 | 5057 | } | |
| 1472 | |||
| 1473 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 5057 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
5057 | if(action == falling && new_action != falling) |
| 1474 | { | ||
| 1475 | ✗ | fallclk = 0; //Stop falling; | |
| 1476 | ✗ | } | |
| 1477 | |||
| 1478 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 5057 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
5057 | if (action == rafting && new_action != rafting) |
| 1479 | { | ||
| 1480 | ✗ | raftwarpx = x;//If you wanted to make Link stop rafting on a dock combo, don't make the dock retrigger the raft. | |
| 1481 | ✗ | raftwarpy = y; | |
| 1482 | ✗ | } | |
| 1483 | |||
| 1484 |
4/9✓ Branch 0 taken 17 times.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2378 times.
✓ Branch 5 taken 2661 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
5057 | switch(new_action) |
| 1485 | { | ||
| 1486 | case isspinning: | ||
| 1487 | case sideswimisspinning: | ||
| 1488 | ✗ | if(attack==wSword) | |
| 1489 | { | ||
| 1490 | ✗ | attackclk = SWORDCHARGEFRAME+1; | |
| 1491 | ✗ | charging = 0; | |
| 1492 | |||
| 1493 | ✗ | if(spins==0) | |
| 1494 | ✗ | spins = 5; | |
| 1495 | ✗ | } | |
| 1496 | ✗ | return; | |
| 1497 | |||
| 1498 | case isdiving: | ||
| 1499 | ✗ | if(action==swimming && diveclk==0) | |
| 1500 | { | ||
| 1501 | ✗ | int32_t flippers_id = current_item_id(itype_flippers); | |
| 1502 | ✗ | diveclk = (flippers_id < 0 ? 80 : (itemsbuf[flippers_id].misc1 + itemsbuf[flippers_id].misc2)); // Who cares about qr_NODIVING? It's the questmaker's business. | |
| 1503 | ✗ | } | |
| 1504 | ✗ | return; | |
| 1505 | |||
| 1506 | case drowning: | ||
| 1507 | case sidedrowning: | ||
| 1508 | ✗ | clear_platform_ffc(); | |
| 1509 | ✗ | if(!drownclk) | |
| 1510 | ✗ | Drown(); | |
| 1511 | |||
| 1512 | ✗ | break; | |
| 1513 | |||
| 1514 | case lavadrowning: | ||
| 1515 | //Lavadrowning is just drowning but with a different argument. Simplicity! -Dimi | ||
| 1516 | ✗ | clear_platform_ffc(); | |
| 1517 | ✗ | if(!drownclk) | |
| 1518 | ✗ | Drown(1); | |
| 1519 | |||
| 1520 | ✗ | break; | |
| 1521 | |||
| 1522 | case falling: | ||
| 1523 | ✗ | clear_platform_ffc(); | |
| 1524 | ✗ | if(!fallclk) | |
| 1525 | { | ||
| 1526 | //If there is a pit under Hero, use its combo. | ||
| 1527 | ✗ | if(int32_t c = getpitfall(x+8,y+(bigHitbox?8:12))) fallCombo = c; | |
| 1528 | ✗ | else if(int32_t c = getpitfall(x,y+(bigHitbox?0:8))) fallCombo = c; | |
| 1529 | ✗ | else if(int32_t c = getpitfall(x+15,y+(bigHitbox?0:8))) fallCombo = c; | |
| 1530 | ✗ | else if(int32_t c = getpitfall(x,y+15)) fallCombo = c; | |
| 1531 | ✗ | else if(int32_t c = getpitfall(x+15,y+15)) fallCombo = c; | |
| 1532 | //Else, use a null value; triggers default pit values | ||
| 1533 | ✗ | else fallCombo = 0; | |
| 1534 | ✗ | fallclk = PITFALL_FALL_FRAMES; | |
| 1535 | ✗ | } | |
| 1536 | ✗ | break; | |
| 1537 | |||
| 1538 | case gothit: | ||
| 1539 | case swimhit: | ||
| 1540 | case sideswimhit: | ||
| 1541 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if(!hclk) |
| 1542 | 1 | hclk=48; | |
| 1543 | |||
| 1544 | 1 | break; | |
| 1545 | |||
| 1546 | case landhold1: | ||
| 1547 | case landhold2: | ||
| 1548 | case waterhold1: | ||
| 1549 | case waterhold2: | ||
| 1550 | case sidewaterhold1: | ||
| 1551 | case sidewaterhold2: | ||
| 1552 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
|
17 | if(!holdclk) |
| 1553 | 17 | holdclk=130; | |
| 1554 | |||
| 1555 | 17 | attack=none; | |
| 1556 | 17 | break; | |
| 1557 | |||
| 1558 | case attacking: | ||
| 1559 | case sideswimattacking: | ||
| 1560 | 2378 | attack=none; | |
| 1561 | 2378 | break; | |
| 1562 | |||
| 1563 | default: | ||
| 1564 | 2661 | break; | |
| 1565 | } | ||
| 1566 | |||
| 1567 | 5057 | action=new_action; FFCore.setHeroAction(new_action); | |
| 1568 | 5057 | } | |
| 1569 | |||
| 1570 | 48 | void HeroClass::setHeldItem(int32_t newitem) | |
| 1571 | { | ||
| 1572 | 48 | holditem=newitem; | |
| 1573 | 48 | } | |
| 1574 | 200 | int32_t HeroClass::getHeldItem() | |
| 1575 | { | ||
| 1576 | 200 | return holditem; | |
| 1577 | } | ||
| 1578 | 20328565 | bool HeroClass::isDiving() | |
| 1579 | { | ||
| 1580 | 20328565 | int32_t flippers_id = current_item_id(itype_flippers); | |
| 1581 |
2/2✓ Branch 0 taken 15020161 times.
✓ Branch 1 taken 5308404 times.
|
20328565 | return (diveclk > (flippers_id < 0 ? 30 : itemsbuf[flippers_id].misc2)); |
| 1582 | } | ||
| 1583 | 44778249 | bool HeroClass::isSwimming() | |
| 1584 | { | ||
| 1585 | 44778249 | bool include_swimhit = true; | |
| 1586 |
3/4✓ Branch 0 taken 44778249 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8617601 times.
✓ Branch 3 taken 36160648 times.
|
44778249 | if (replay_is_active() && replay_version_check(0, 31)) |
| 1587 | { | ||
| 1588 |
2/4✓ Branch 0 taken 36160648 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 36160648 times.
|
36160648 | std::string qst = replay_get_meta_str("qst"); |
| 1589 | 36160648 | bool disable = false; | |
| 1590 |
1/2✓ Branch 0 taken 36160648 times.
✗ Branch 1 not taken.
|
36160648 | disable |= qst == "demons_inferno.qst"; |
| 1591 |
1/2✓ Branch 0 taken 36160648 times.
✗ Branch 1 not taken.
|
36160648 | disable |= qst == "demosp253.qst"; |
| 1592 |
1/2✓ Branch 0 taken 36160648 times.
✗ Branch 1 not taken.
|
36160648 | disable |= qst == "hell_awaits.qst"; |
| 1593 |
1/2✓ Branch 0 taken 36160648 times.
✗ Branch 1 not taken.
|
36160648 | disable |= qst == "lands_of_serenity.qst"; |
| 1594 |
1/2✓ Branch 0 taken 36160648 times.
✗ Branch 1 not taken.
|
36160648 | disable |= qst == "link_to_the_heavens.qst"; |
| 1595 | // The others are just a gfx change, but this one actual breaks without this compat check. | ||
| 1596 |
1/2✓ Branch 0 taken 36160648 times.
✗ Branch 1 not taken.
|
36160648 | disable |= qst == "link_to_the_zelda.qst"; |
| 1597 | 36160648 | include_swimhit = !disable; | |
| 1598 | 36160648 | } | |
| 1599 |
4/6✓ Branch 0 taken 44327045 times.
✓ Branch 1 taken 451204 times.
✓ Branch 2 taken 44327045 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 44327045 times.
✗ Branch 5 not taken.
|
89105294 | return ((action==swimming)||(action==sideswimming)||IsSideSwim()|| |
| 1600 |
8/8✓ Branch 0 taken 44323032 times.
✓ Branch 1 taken 4013 times.
✓ Branch 2 taken 44320273 times.
✓ Branch 3 taken 2759 times.
✓ Branch 4 taken 27840302 times.
✓ Branch 5 taken 16479971 times.
✓ Branch 6 taken 1166 times.
✓ Branch 7 taken 27839136 times.
|
44327045 | (action==waterhold1)||(action==waterhold2)||(include_swimhit && action==swimhit)|| |
| 1601 | 44319107 | (hopclk==0xFF)); | |
| 1602 | ✗ | } | |
| 1603 | |||
| 1604 | 3277 | void HeroClass::setDontDraw(byte new_dontdraw) | |
| 1605 | { | ||
| 1606 | 3277 | dontdraw=new_dontdraw; | |
| 1607 | 3277 | } | |
| 1608 | |||
| 1609 | 1950802 | byte HeroClass::getDontDraw() | |
| 1610 | { | ||
| 1611 | 1950802 | return dontdraw; | |
| 1612 | } | ||
| 1613 | |||
| 1614 | 3 | void HeroClass::setHClk(int32_t newhclk) | |
| 1615 | { | ||
| 1616 | 3 | hclk=newhclk; | |
| 1617 | 3 | } | |
| 1618 | |||
| 1619 | 56468 | int32_t HeroClass::getHClk() | |
| 1620 | { | ||
| 1621 | 56468 | return hclk; | |
| 1622 | } | ||
| 1623 | |||
| 1624 | 11225528 | int32_t HeroClass::getSpecialCave() | |
| 1625 | { | ||
| 1626 | 11225528 | return specialcave; // used only by maps.cpp | |
| 1627 | } | ||
| 1628 | |||
| 1629 | 1435 | void HeroClass::init() | |
| 1630 | { | ||
| 1631 | 1435 | cache_tile_mod_clear(); | |
| 1632 | 1435 | usecounts.clear(); | |
| 1633 | 1435 | scale = 0; | |
| 1634 | 1435 | rotation = 0; | |
| 1635 | 1435 | do_animation = true; | |
| 1636 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1435 times.
|
1435 | if(lift_wpn) |
| 1637 | { | ||
| 1638 | ✗ | delete lift_wpn; | |
| 1639 | ✗ | lift_wpn = nullptr; | |
| 1640 | ✗ | } | |
| 1641 | 1435 | clear_platform_ffc(); | |
| 1642 | 1435 | liftclk = 0; | |
| 1643 | 1435 | tliftclk = 0; | |
| 1644 | 1435 | liftheight = 0; | |
| 1645 | 1435 | liftflags = 0; | |
| 1646 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1435 times.
|
1435 | if ( dontdraw != 2 ) { dontdraw = 0; } //scripted dontdraw == 2, normal == 1, draw hero == 0 |
| 1647 | 1435 | hookshot_used=false; | |
| 1648 | 1435 | justmoved = 0; | |
| 1649 | 1435 | hookshot_frozen=false; | |
| 1650 | 1435 | onpassivedmg=false; | |
| 1651 | 1435 | dir = up; | |
| 1652 | 1435 | damageovertimeclk = 0; | |
| 1653 | 1435 | newconveyorclk = 0; | |
| 1654 | 1435 | switchhookclk = switchhookstyle = switchhookarg = switchhookmaxtime = 0; | |
| 1655 |
2/2✓ Branch 0 taken 10045 times.
✓ Branch 1 taken 1435 times.
|
11480 | for(auto q = 0; q < 7; ++q) |
| 1656 | 10045 | hooked_undercombos[q] = -1; | |
| 1657 | 1435 | shiftdir = -1; | |
| 1658 | 1435 | sideswimdir = right; | |
| 1659 | 1435 | holddir = -1; | |
| 1660 | 1435 | landswim = 0; | |
| 1661 | 1435 | sdir = up; | |
| 1662 | 1435 | ilswim=true; | |
| 1663 | 1435 | walkable=false; | |
| 1664 | 1435 | moveflags = move_obeys_grav | move_can_pitfall | move_can_waterdrown; | |
| 1665 | 1435 | warp_sound = 0; | |
| 1666 | 1435 | subscr_speed = zinit.subscrSpeed; | |
| 1667 | 1435 | steprate = zinit.heroStep; | |
| 1668 | 1435 | shove_offset = zinit.shove_offset; | |
| 1669 | 1435 | is_warping = false; | |
| 1670 | 1435 | coyotetime = 0; | |
| 1671 | |||
| 1672 | 1435 | hammer_swim_up_offset = hammeroffsets[0]; | |
| 1673 | 1435 | hammer_swim_down_offset = hammeroffsets[1]; | |
| 1674 | 1435 | hammer_swim_left_offset = hammeroffsets[2]; | |
| 1675 | 1435 | hammer_swim_right_offset = hammeroffsets[3]; | |
| 1676 | |||
| 1677 | 1435 | prompt_combo = prompt_x = prompt_y = prompt_cset = 0; | |
| 1678 | |||
| 1679 |
2/2✓ Branch 0 taken 538 times.
✓ Branch 1 taken 897 times.
|
1435 | if(get_qr(qr_NOARRIVALPOINT)) |
| 1680 | { | ||
| 1681 | 538 | x=tmpscr->warpreturnx[0]; | |
| 1682 | 538 | y=tmpscr->warpreturny[0]; | |
| 1683 | 538 | } | |
| 1684 | else | ||
| 1685 | { | ||
| 1686 | 897 | x=tmpscr->warparrivalx; | |
| 1687 | 897 | y=tmpscr->warparrivaly; | |
| 1688 | } | ||
| 1689 | |||
| 1690 | 1435 | z=fakez=fall=fakefall=0; | |
| 1691 | 1435 | hzsz = 12; // So that flying peahats can still hit him. | |
| 1692 | |||
| 1693 |
2/2✓ Branch 0 taken 463 times.
✓ Branch 1 taken 972 times.
|
1435 | if(x==0) dir=right; |
| 1694 | |||
| 1695 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 1417 times.
|
1435 | if(x==240) dir=left; |
| 1696 | |||
| 1697 |
2/2✓ Branch 0 taken 464 times.
✓ Branch 1 taken 971 times.
|
1435 | if(y==0) dir=down; |
| 1698 | |||
| 1699 |
2/2✓ Branch 0 taken 301 times.
✓ Branch 1 taken 1134 times.
|
1435 | if(y==160) dir=up; |
| 1700 | |||
| 1701 | 1435 | lstep=0; | |
| 1702 | 1435 | skipstep=0; | |
| 1703 | 1435 | autostep=false; | |
| 1704 | 1435 | attackclk=holdclk=hoverclk=jumping=raftclk=0; | |
| 1705 | 1435 | attack=wNone; | |
| 1706 | 1435 | attackid=-1; | |
| 1707 | 1435 | action=none; FFCore.setHeroAction(none); tempaction=none; | |
| 1708 | 1435 | xofs=0; | |
| 1709 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1435 times.
|
1435 | yofs=(get_qr(qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset); |
| 1710 | 1435 | cs=6; | |
| 1711 | 1435 | flickercolor=-1; | |
| 1712 | 1435 | flickertransp=-1; | |
| 1713 | 1435 | pushing=fairyclk=0; | |
| 1714 | 1435 | id=0; | |
| 1715 | 1435 | inlikelike=0; | |
| 1716 | 1435 | superman=inwallm=false; | |
| 1717 | 1435 | scriptcoldet=true; | |
| 1718 | 1435 | blowcnt=whirlwind=specialcave=0; | |
| 1719 | 1435 | hopclk=diveclk=fallclk=0; | |
| 1720 | 1435 | fallCombo = 0; | |
| 1721 | 1435 | pit_pulldir = -1; | |
| 1722 | 1435 | hopdir=-1; | |
| 1723 | 1435 | conveyor_flags=0; | |
| 1724 | 1435 | drunkclk=0; | |
| 1725 | 1435 | lstunclock = 0; | |
| 1726 | 1435 | is_conveyor_stunned=0; | |
| 1727 | 1435 | convey_forcex=convey_forcey=0; | |
| 1728 | 1435 | drawstyle=3; | |
| 1729 | 1435 | ffwarp = false; | |
| 1730 | 1435 | stepoutindex=stepoutwr=stepoutdmap=stepoutscr=0; | |
| 1731 | 1435 | stepnext=stepsecret=-1; | |
| 1732 | 1435 | ffpit = false; | |
| 1733 | 1435 | respawn_x=x; | |
| 1734 | 1435 | respawn_y=y; | |
| 1735 | 1435 | respawn_dmap=currdmap; | |
| 1736 | 1435 | respawn_scr=currscr; | |
| 1737 | 1435 | falling_oldy = y; | |
| 1738 | 1435 | magiccastclk=0; | |
| 1739 | 1435 | magicitem = div_prot_item = -1; | |
| 1740 | 1435 | last_lens_id = 0; //Should be -1 (-Z) | |
| 1741 | 1435 | last_lift_id.reset(); | |
| 1742 | 1435 | last_savepoint_id = 0; | |
| 1743 | 1435 | misc_internal_hero_flags = 0; | |
| 1744 | 1435 | last_cane_of_byrna_item_id = -1; | |
| 1745 | 1435 | on_sideview_ladder = false; | |
| 1746 | 1435 | switchblock_z = 0; | |
| 1747 | 1435 | switchblock_offset = false; | |
| 1748 | 1435 | extra_jump_count = 0; | |
| 1749 | 1435 | hoverflags = 0; | |
| 1750 | 1435 | lbunnyclock = 0; | |
| 1751 | 1435 | lamp_paid = false; | |
| 1752 | |||
| 1753 |
2/2✓ Branch 0 taken 45920 times.
✓ Branch 1 taken 1435 times.
|
47355 | for(int32_t i=0; i<32; i++) miscellaneous[i] = 0; |
| 1754 | |||
| 1755 | 1435 | setBigHitbox(get_qr(qr_LTTPCOLLISION)); | |
| 1756 | 1435 | diagonalMovement=(get_qr(qr_LTTPWALK)); | |
| 1757 | |||
| 1758 | 1435 | shield_active = false; | |
| 1759 | 1435 | shield_forcedir = -1; | |
| 1760 | 1435 | active_shield_id = -1; | |
| 1761 | 1435 | conv_forcedir = -1; | |
| 1762 | |||
| 1763 | 1435 | preventsubscreenfalling = false; //-Z | |
| 1764 | 1435 | walkspeed = 0; //not used, yet. -Z | |
| 1765 |
2/2✓ Branch 0 taken 24395 times.
✓ Branch 1 taken 1435 times.
|
25830 | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) lastHitBy[q][0] = 0; |
| 1766 |
2/2✓ Branch 0 taken 24395 times.
✓ Branch 1 taken 1435 times.
|
25830 | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) lastHitBy[q][1] = 0; |
| 1767 |
2/2✓ Branch 0 taken 209510 times.
✓ Branch 1 taken 1435 times.
|
210945 | for ( int32_t q = 0; q < wMax; q++ ) |
| 1768 | { | ||
| 1769 | 209510 | defence[q] = hero_defence[q]; //we will need to have a Hero section in the quest load/save code! -Z Added 3/26/21 - Jman | |
| 1770 | 209510 | } | |
| 1771 | |||
| 1772 | 1435 | clear_ice(); | |
| 1773 | 1435 | script_ice_combo = 0; | |
| 1774 | //Run script! | ||
| 1775 |
4/4✓ Branch 0 taken 190 times.
✓ Branch 1 taken 1245 times.
✓ Branch 2 taken 85 times.
✓ Branch 3 taken 105 times.
|
1435 | if (( FFCore.getQuestHeaderInfo(vZelda) >= 0x255 ) && (game->get_hasplayed()) ) //if (!hasplayed) runs in game_loop() |
| 1776 | { | ||
| 1777 | 85 | ZScriptVersion::RunScript(ScriptType::Player, SCRIPT_PLAYER_INIT); | |
| 1778 | 85 | FFCore.deallocateAllScriptOwned(ScriptType::Player, SCRIPT_PLAYER_INIT); | |
| 1779 | 85 | FFCore.initZScriptHeroScripts(); //Clear the stack and the refinfo data to be ready for Hero's active script. | |
| 1780 | 85 | set_respawn_point(); //screen entry at spawn; //This should be after the init script, so that Hero->X and Hero->Y set by the script | |
| 1781 | //are properly set by the engine. | ||
| 1782 | 85 | } | |
| 1783 | 1435 | FFCore.nostepforward = 0; | |
| 1784 | |||
| 1785 |
2/2✓ Branch 0 taken 315 times.
✓ Branch 1 taken 1120 times.
|
1435 | if (replay_version_check(12)) |
| 1786 | 1120 | z3step = 2; | |
| 1787 | 1435 | } | |
| 1788 | |||
| 1789 | 16577496 | void HeroClass::draw_under(BITMAP* dest) | |
| 1790 | { | ||
| 1791 | 16577496 | int32_t c_raft=current_item_id(itype_raft); | |
| 1792 | 16577496 | int32_t c_ladder=current_item_id(itype_ladder); | |
| 1793 | |||
| 1794 |
3/4✓ Branch 0 taken 144426 times.
✓ Branch 1 taken 16433070 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 144426 times.
|
16577496 | if(action==rafting && c_raft >-1) |
| 1795 | { | ||
| 1796 |
4/4✓ Branch 0 taken 106833 times.
✓ Branch 1 taken 37593 times.
✓ Branch 2 taken 82762 times.
✓ Branch 3 taken 61664 times.
|
144426 | if(((dir==left) || (dir==right)) && (get_qr(qr_RLFIX))) |
| 1797 | { | ||
| 1798 | 123328 | overtile16(dest, itemsbuf[c_raft].tile, x, y+playing_field_offset+4, | |
| 1799 | 61664 | itemsbuf[c_raft].csets&15, rotate_value((itemsbuf[c_raft].misc_flags>>2)&3)^3); | |
| 1800 | 61664 | } | |
| 1801 | else | ||
| 1802 | { | ||
| 1803 | 165524 | overtile16(dest, itemsbuf[c_raft].tile, x, y+playing_field_offset+4, | |
| 1804 | 82762 | itemsbuf[c_raft].csets&15, (itemsbuf[c_raft].misc_flags>>2)&3); | |
| 1805 | } | ||
| 1806 | 144426 | } | |
| 1807 | |||
| 1808 |
3/4✓ Branch 0 taken 142297 times.
✓ Branch 1 taken 16435199 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 142297 times.
|
16577496 | if(ladderx+laddery && c_ladder >-1) |
| 1809 | { | ||
| 1810 |
4/4✓ Branch 0 taken 67726 times.
✓ Branch 1 taken 74571 times.
✓ Branch 2 taken 44376 times.
✓ Branch 3 taken 23350 times.
|
142297 | if((ladderdir>=left) && (get_qr(qr_RLFIX))) |
| 1811 | { | ||
| 1812 | 88752 | overtile16(dest, itemsbuf[c_ladder].tile, ladderx, laddery+playing_field_offset, | |
| 1813 | 44376 | itemsbuf[c_ladder].csets&15, rotate_value((itemsbuf[iRaft].misc_flags>>2)&3)^3); | |
| 1814 | 44376 | } | |
| 1815 | else | ||
| 1816 | { | ||
| 1817 | 195842 | overtile16(dest, itemsbuf[c_ladder].tile, ladderx, laddery+playing_field_offset, | |
| 1818 | 97921 | itemsbuf[c_ladder].csets&15, (itemsbuf[c_ladder].misc_flags>>2)&3); | |
| 1819 | } | ||
| 1820 | 142297 | } | |
| 1821 | 16577496 | } | |
| 1822 | |||
| 1823 | 17823 | void HeroClass::drawshadow(BITMAP* dest, bool translucent) | |
| 1824 | { | ||
| 1825 | 17823 | int32_t tempy=yofs; | |
| 1826 | 17823 | yofs+=8; | |
| 1827 | 17823 | shadowtile = wpnsbuf[spr_shadow].tile; | |
| 1828 | 17823 | sprite::drawshadow(dest,translucent); | |
| 1829 | 17823 | yofs=tempy; | |
| 1830 | 17823 | } | |
| 1831 | |||
| 1832 | // The Stone of Agony reacts to these flags. | ||
| 1833 | 483872 | bool HeroClass::agonyflag(int32_t flag) | |
| 1834 | { | ||
| 1835 |
2/2✓ Branch 0 taken 483840 times.
✓ Branch 1 taken 32 times.
|
483872 | switch(flag) |
| 1836 | { | ||
| 1837 | case mfWHISTLE: | ||
| 1838 | case mfANYFIRE: | ||
| 1839 | case mfARROW: | ||
| 1840 | case mfBOMB: | ||
| 1841 | case mfSBOMB: | ||
| 1842 | case mfBRANG: | ||
| 1843 | case mfMBRANG: | ||
| 1844 | case mfFBRANG: | ||
| 1845 | case mfSARROW: | ||
| 1846 | case mfGARROW: | ||
| 1847 | case mfSTRONGFIRE: | ||
| 1848 | case mfMAGICFIRE: | ||
| 1849 | case mfDIVINEFIRE: | ||
| 1850 | case mfWANDMAGIC: | ||
| 1851 | case mfREFMAGIC: | ||
| 1852 | case mfREFFIREBALL: | ||
| 1853 | case mfSWORD: | ||
| 1854 | case mfWSWORD: | ||
| 1855 | case mfMSWORD: | ||
| 1856 | case mfXSWORD: | ||
| 1857 | case mfSWORDBEAM: | ||
| 1858 | case mfWSWORDBEAM: | ||
| 1859 | case mfMSWORDBEAM: | ||
| 1860 | case mfXSWORDBEAM: | ||
| 1861 | case mfHOOKSHOT: | ||
| 1862 | case mfWAND: | ||
| 1863 | case mfHAMMER: | ||
| 1864 | case mfSTRIKE: | ||
| 1865 | 32 | return true; | |
| 1866 | } | ||
| 1867 | |||
| 1868 | 483840 | return false; | |
| 1869 | 483872 | } | |
| 1870 | |||
| 1871 | |||
| 1872 | // Find the attack power of the current melee weapon. | ||
| 1873 | // The Whimsical Ring is applied on a target-by-target basis. | ||
| 1874 | 1104017 | int32_t HeroClass::weaponattackpower(int32_t itid) | |
| 1875 | { | ||
| 1876 |
1/2✓ Branch 0 taken 1104017 times.
✗ Branch 1 not taken.
|
1104017 | if(itid < 0) |
| 1877 | { | ||
| 1878 | ✗ | itid = current_item_id(attack==wCByrna ? itype_cbyrna | |
| 1879 | ✗ | : attack==wWand ? itype_wand | |
| 1880 | ✗ | : attack==wHammer ? itype_hammer | |
| 1881 | : itype_sword); | ||
| 1882 | ✗ | } | |
| 1883 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 1103997 times.
|
1104017 | int32_t power = attack==wCByrna ? itemsbuf[itid].misc4 : itemsbuf[itid].power; |
| 1884 | |||
| 1885 | // Multiply it by the power of the spin attack/quake hammer, if applicable. | ||
| 1886 |
2/2✓ Branch 0 taken 2189 times.
✓ Branch 1 taken 1101828 times.
|
1104017 | if(spins > 0) |
| 1887 | { | ||
| 1888 | 2189 | int scr = currentscroll; | |
| 1889 |
1/2✓ Branch 0 taken 2189 times.
✗ Branch 1 not taken.
|
2189 | if(scr < 0) |
| 1890 | { | ||
| 1891 | ✗ | scr = current_item_id(attack==wHammer ? (spins>1?itype_quakescroll2:itype_quakescroll) | |
| 1892 | ✗ | : (spins>5 || current_item_id(itype_spinscroll) < 0) | |
| 1893 | ? itype_spinscroll2 : itype_spinscroll); | ||
| 1894 | ✗ | } | |
| 1895 | 2189 | power *= itemsbuf[scr].power; | |
| 1896 | 2189 | } | |
| 1897 | 1101828 | else currentscroll = -1; | |
| 1898 | 1104017 | return power; | |
| 1899 | } | ||
| 1900 | |||
| 1901 | #define NET_CLK_TOTAL 24 | ||
| 1902 | #define NET_DIR_INC (NET_CLK_TOTAL/3) | ||
| 1903 | // Must only be called once per frame! | ||
| 1904 | 138 | void HeroClass::positionNet(weapon *w, int32_t itemid) | |
| 1905 | { | ||
| 1906 | 138 | itemid = vbound(itemid, 0, MAXITEMS-1); | |
| 1907 | 138 | int32_t t = w->o_tile, | |
| 1908 | 138 | wx = 1, wy = 1; | |
| 1909 | |||
| 1910 | //Invert positioning clock if right-handed animation | ||
| 1911 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 138 times.
|
138 | int32_t clock = (itemsbuf[itemid].flags&item_flag2 ? (NET_CLK_TOTAL-1)-attackclk : attackclk); |
| 1912 |
1/2✓ Branch 0 taken 138 times.
✗ Branch 1 not taken.
|
138 | if(clock >= NET_CLK_TOTAL) |
| 1913 | ✗ | w->dead = 0; | |
| 1914 | 138 | int32_t tiledir = dir; | |
| 1915 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 69 times.
✓ Branch 3 taken 23 times.
✓ Branch 4 taken 38 times.
|
138 | switch(dir) |
| 1916 | { | ||
| 1917 | case up: | ||
| 1918 | { | ||
| 1919 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | if(clock < NET_DIR_INC) tiledir = l_up; |
| 1920 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | else if(clock >= NET_DIR_INC*2) tiledir = r_up; |
| 1921 | 8 | break; | |
| 1922 | } | ||
| 1923 | case down: | ||
| 1924 | { | ||
| 1925 |
2/2✓ Branch 0 taken 21 times.
✓ Branch 1 taken 48 times.
|
69 | if(clock < NET_DIR_INC) tiledir = r_down; |
| 1926 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 24 times.
|
48 | else if(clock >= NET_DIR_INC*2) tiledir = l_down; |
| 1927 | 69 | break; | |
| 1928 | } | ||
| 1929 | case left: | ||
| 1930 | { | ||
| 1931 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 16 times.
|
23 | if(clock < NET_DIR_INC) tiledir = l_down; |
| 1932 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 8 times.
|
16 | else if(clock >= NET_DIR_INC*2) tiledir = l_up; |
| 1933 | 23 | break; | |
| 1934 | } | ||
| 1935 | case right: | ||
| 1936 | { | ||
| 1937 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 24 times.
|
38 | if(clock < NET_DIR_INC) tiledir = r_up; |
| 1938 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 8 times.
|
24 | else if(clock >= NET_DIR_INC*2) tiledir = r_down; |
| 1939 | 38 | break; | |
| 1940 | } | ||
| 1941 | } | ||
| 1942 | 138 | int32_t offs = 0; | |
| 1943 |
2/2✓ Branch 0 taken 90 times.
✓ Branch 1 taken 48 times.
|
138 | if(tiledir > right) |
| 1944 | 90 | offs = ((clock%NET_DIR_INC)<NET_DIR_INC/2) ? 1 : 0; | |
| 1945 | 48 | else offs = vbound(((clock%NET_DIR_INC)/(NET_DIR_INC/3))-1,-1,1); | |
| 1946 | //One of 8 positions | ||
| 1947 |
7/9✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 22 times.
✓ Branch 3 taken 16 times.
✓ Branch 4 taken 29 times.
✓ Branch 5 taken 24 times.
✓ Branch 6 taken 31 times.
✓ Branch 7 taken 8 times.
✓ Branch 8 taken 8 times.
|
138 | switch(tiledir) |
| 1948 | { | ||
| 1949 | case up: | ||
| 1950 | { | ||
| 1951 | ✗ | wx = 6*offs; | |
| 1952 | ✗ | wy = -14; | |
| 1953 | ✗ | break; | |
| 1954 | } | ||
| 1955 | case r_up: | ||
| 1956 | { | ||
| 1957 | 22 | wx = (offs ? 10 : 14); | |
| 1958 | 22 | wy = (offs ? -12 : -10); | |
| 1959 | 22 | break; | |
| 1960 | } | ||
| 1961 | case right: | ||
| 1962 | { | ||
| 1963 | 16 | wx = 14; | |
| 1964 | 16 | wy = 6*offs; | |
| 1965 | 16 | break; | |
| 1966 | } | ||
| 1967 | case r_down: | ||
| 1968 | { | ||
| 1969 | 29 | wx = (offs ? 14 : 10); | |
| 1970 | 29 | wy = (offs ? 10 : 12); | |
| 1971 | 29 | break; | |
| 1972 | } | ||
| 1973 | case down: | ||
| 1974 | { | ||
| 1975 | 24 | wx = -6*offs; | |
| 1976 | 24 | wy = 14; | |
| 1977 | 24 | break; | |
| 1978 | } | ||
| 1979 | case l_down: | ||
| 1980 | { | ||
| 1981 | 31 | wx = (offs ? -10 : -14); | |
| 1982 | 31 | wy = (offs ? 12 : 10); | |
| 1983 | 31 | break; | |
| 1984 | } | ||
| 1985 | case left: | ||
| 1986 | { | ||
| 1987 | 8 | wx = -14; | |
| 1988 | 8 | wy = -6*offs; | |
| 1989 | 8 | break; | |
| 1990 | } | ||
| 1991 | case l_up: | ||
| 1992 | { | ||
| 1993 | 8 | wx = (offs ? -14 : -10); | |
| 1994 | 8 | wy = (offs ? -10 : -12); | |
| 1995 | 8 | break; | |
| 1996 | } | ||
| 1997 | } | ||
| 1998 | |||
| 1999 | 138 | w->x = x+wx; | |
| 2000 | 138 | w->y = y+wy-(54-(yofs))-fakez; | |
| 2001 | 138 | w->z = (z+zofs); | |
| 2002 | 138 | w->fakez = fakez; | |
| 2003 | 138 | w->tile = t+tiledir; | |
| 2004 | 138 | w->power = 0; | |
| 2005 | 138 | w->dir = dir; | |
| 2006 | 138 | w->doAutoRotate(true); | |
| 2007 | 138 | } | |
| 2008 | 965079 | void HeroClass::positionSword(weapon *w, int32_t itemid) | |
| 2009 | { | ||
| 2010 | //if ( w->ScriptGenerated ) return; //t/b/a for script-generated swords. | ||
| 2011 | //if ( itemsbuf[itemid].ScriptGenerated ) return; //t/b/a for script-generated swords. | ||
| 2012 | 965079 | itemid=vbound(itemid, 0, MAXITEMS-1); | |
| 2013 | // Place a sword weapon at the right spot. | ||
| 2014 | 965079 | int32_t wy=1; | |
| 2015 | 965079 | int32_t wx=1; | |
| 2016 | 965079 | int32_t f=0,t,cs2; | |
| 2017 | |||
| 2018 | 965079 | t = w->o_tile; | |
| 2019 | 965079 | cs2 = w->o_cset; | |
| 2020 | 965079 | slashxofs=0; | |
| 2021 | 965079 | slashyofs=0; | |
| 2022 | |||
| 2023 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 197442 times.
✓ Branch 2 taken 208289 times.
✓ Branch 3 taken 278982 times.
✓ Branch 4 taken 280366 times.
|
965079 | switch(dir) |
| 2024 | { | ||
| 2025 | case up: | ||
| 2026 | 197442 | wx=-1; | |
| 2027 | 197442 | wy=-12; | |
| 2028 | |||
| 2029 |
8/8✓ Branch 0 taken 88286 times.
✓ Branch 1 taken 109156 times.
✓ Branch 2 taken 86709 times.
✓ Branch 3 taken 1577 times.
✓ Branch 4 taken 86299 times.
✓ Branch 5 taken 410 times.
✓ Branch 6 taken 8142 times.
✓ Branch 7 taken 78157 times.
|
197442 | if(game->get_canslash() && w->id==wSword && itemsbuf[itemid].flags & item_flag4 && charging==0) |
| 2030 | { | ||
| 2031 |
2/2✓ Branch 0 taken 50096 times.
✓ Branch 1 taken 28061 times.
|
78157 | if(attackclk>10) //extended stab |
| 2032 | { | ||
| 2033 | 28061 | slashyofs-=3; | |
| 2034 | 28061 | wy-=2; | |
| 2035 | 28061 | } | |
| 2036 | |||
| 2037 |
2/2✓ Branch 0 taken 69755 times.
✓ Branch 1 taken 8402 times.
|
78157 | if(attackclk>=14) //retracting stab |
| 2038 | { | ||
| 2039 | 8402 | slashyofs+=3; | |
| 2040 | 8402 | wy+=2; | |
| 2041 | 8402 | } | |
| 2042 | 78157 | } | |
| 2043 | else | ||
| 2044 | { | ||
| 2045 |
2/2✓ Branch 0 taken 6746 times.
✓ Branch 1 taken 112539 times.
|
119285 | if(attackclk==SWORDCHARGEFRAME) |
| 2046 | { | ||
| 2047 | 6746 | wy+=4; | |
| 2048 | 6746 | } | |
| 2049 |
2/2✓ Branch 0 taken 10909 times.
✓ Branch 1 taken 101630 times.
|
112539 | else if(attackclk==13) |
| 2050 | { | ||
| 2051 | 10909 | wy+=4; | |
| 2052 | 10909 | } | |
| 2053 |
2/2✓ Branch 0 taken 90829 times.
✓ Branch 1 taken 10801 times.
|
101630 | else if(attackclk==14) |
| 2054 | { | ||
| 2055 | 10801 | wy+=8; | |
| 2056 | 10801 | } | |
| 2057 | } | ||
| 2058 | |||
| 2059 | 197442 | break; | |
| 2060 | |||
| 2061 | case down: | ||
| 2062 | 208289 | f=get_qr(qr_SWORDWANDFLIPFIX)?3:2; | |
| 2063 | 208289 | wy=11; | |
| 2064 | |||
| 2065 |
8/8✓ Branch 0 taken 111445 times.
✓ Branch 1 taken 96844 times.
✓ Branch 2 taken 110042 times.
✓ Branch 3 taken 1403 times.
✓ Branch 4 taken 109682 times.
✓ Branch 5 taken 360 times.
✓ Branch 6 taken 6988 times.
✓ Branch 7 taken 102694 times.
|
208289 | if(game->get_canslash() && w->id==wSword && itemsbuf[itemid].flags & item_flag4 && charging==0) |
| 2066 | { | ||
| 2067 |
2/2✓ Branch 0 taken 64615 times.
✓ Branch 1 taken 38079 times.
|
102694 | if(attackclk>10) //extended stab |
| 2068 | { | ||
| 2069 | 38079 | slashyofs+=3; | |
| 2070 | 38079 | wy+=2; | |
| 2071 | 38079 | } | |
| 2072 | |||
| 2073 |
2/2✓ Branch 0 taken 91151 times.
✓ Branch 1 taken 11543 times.
|
102694 | if(attackclk>=14) //retracting stab |
| 2074 | { | ||
| 2075 | 11543 | slashyofs-=3; | |
| 2076 | 11543 | wy-=2; | |
| 2077 | 11543 | } | |
| 2078 | 102694 | } | |
| 2079 | else | ||
| 2080 | { | ||
| 2081 |
2/2✓ Branch 0 taken 6473 times.
✓ Branch 1 taken 99122 times.
|
105595 | if(attackclk==SWORDCHARGEFRAME) |
| 2082 | { | ||
| 2083 | 6473 | wy-=2; | |
| 2084 | 6473 | } | |
| 2085 |
2/2✓ Branch 0 taken 9870 times.
✓ Branch 1 taken 89252 times.
|
99122 | else if(attackclk==13) |
| 2086 | { | ||
| 2087 | 9870 | wy-=4; | |
| 2088 | 9870 | } | |
| 2089 |
2/2✓ Branch 0 taken 79417 times.
✓ Branch 1 taken 9835 times.
|
89252 | else if(attackclk==14) |
| 2090 | { | ||
| 2091 | 9835 | wy-=8; | |
| 2092 | 9835 | } | |
| 2093 | } | ||
| 2094 | |||
| 2095 | 208289 | break; | |
| 2096 | |||
| 2097 | case left: | ||
| 2098 | 278982 | f=1; | |
| 2099 | 278982 | wx=-11; | |
| 2100 | 278982 | ++t; | |
| 2101 | |||
| 2102 |
8/8✓ Branch 0 taken 157598 times.
✓ Branch 1 taken 121384 times.
✓ Branch 2 taken 153899 times.
✓ Branch 3 taken 3699 times.
✓ Branch 4 taken 153047 times.
✓ Branch 5 taken 852 times.
✓ Branch 6 taken 10065 times.
✓ Branch 7 taken 142982 times.
|
278982 | if(game->get_canslash() && w->id==wSword && itemsbuf[itemid].flags & item_flag4 && charging==0) |
| 2103 | { | ||
| 2104 |
2/2✓ Branch 0 taken 88998 times.
✓ Branch 1 taken 53984 times.
|
142982 | if(attackclk>10) //extended stab |
| 2105 | { | ||
| 2106 | 53984 | slashxofs-=4; | |
| 2107 | 53984 | wx-=7; | |
| 2108 | 53984 | } | |
| 2109 | |||
| 2110 |
2/2✓ Branch 0 taken 127112 times.
✓ Branch 1 taken 15870 times.
|
142982 | if(attackclk>=14) //retracting stab |
| 2111 | { | ||
| 2112 | 15870 | slashxofs+=3; | |
| 2113 | 15870 | wx+=7; | |
| 2114 | 15870 | } | |
| 2115 | 142982 | } | |
| 2116 | else | ||
| 2117 | { | ||
| 2118 |
2/2✓ Branch 0 taken 8752 times.
✓ Branch 1 taken 127248 times.
|
136000 | if(attackclk==SWORDCHARGEFRAME) |
| 2119 | { | ||
| 2120 | 8752 | wx+=2; | |
| 2121 | 8752 | } | |
| 2122 |
2/2✓ Branch 0 taken 12652 times.
✓ Branch 1 taken 114596 times.
|
127248 | else if(attackclk==13) |
| 2123 | { | ||
| 2124 | 12652 | wx+=4; | |
| 2125 | 12652 | } | |
| 2126 |
2/2✓ Branch 0 taken 101987 times.
✓ Branch 1 taken 12609 times.
|
114596 | else if(attackclk==14) |
| 2127 | { | ||
| 2128 | 12609 | wx+=8; | |
| 2129 | 12609 | } | |
| 2130 | } | ||
| 2131 | |||
| 2132 | 278982 | break; | |
| 2133 | |||
| 2134 | case right: | ||
| 2135 | 280366 | wx=11; | |
| 2136 | 280366 | ++t; | |
| 2137 | |||
| 2138 |
8/8✓ Branch 0 taken 152723 times.
✓ Branch 1 taken 127643 times.
✓ Branch 2 taken 149921 times.
✓ Branch 3 taken 2802 times.
✓ Branch 4 taken 148087 times.
✓ Branch 5 taken 1834 times.
✓ Branch 6 taken 13666 times.
✓ Branch 7 taken 134421 times.
|
280366 | if(game->get_canslash() && w->id==wSword && itemsbuf[itemid].flags & item_flag4 && charging==0) |
| 2139 | { | ||
| 2140 |
2/2✓ Branch 0 taken 83298 times.
✓ Branch 1 taken 51123 times.
|
134421 | if(attackclk>10) //extended stab |
| 2141 | { | ||
| 2142 | 51123 | slashxofs+=4; | |
| 2143 | 51123 | wx+=7; | |
| 2144 | 51123 | } | |
| 2145 | |||
| 2146 |
2/2✓ Branch 0 taken 118829 times.
✓ Branch 1 taken 15592 times.
|
134421 | if(attackclk>=14) //retracting stab |
| 2147 | { | ||
| 2148 | 15592 | slashxofs-=3; | |
| 2149 | 15592 | wx-=7; | |
| 2150 | 15592 | } | |
| 2151 | 134421 | } | |
| 2152 | else | ||
| 2153 | { | ||
| 2154 |
2/2✓ Branch 0 taken 12322 times.
✓ Branch 1 taken 133623 times.
|
145945 | if(attackclk==SWORDCHARGEFRAME) |
| 2155 | { | ||
| 2156 | 12322 | wx-=2; | |
| 2157 | 12322 | } | |
| 2158 |
2/2✓ Branch 0 taken 13265 times.
✓ Branch 1 taken 120358 times.
|
133623 | else if(attackclk==13) |
| 2159 | { | ||
| 2160 | 13265 | wx-=4; | |
| 2161 | 13265 | } | |
| 2162 |
2/2✓ Branch 0 taken 107131 times.
✓ Branch 1 taken 13227 times.
|
120358 | else if(attackclk==14) |
| 2163 | { | ||
| 2164 | 13227 | wx-=8; | |
| 2165 | 13227 | } | |
| 2166 | } | ||
| 2167 | |||
| 2168 | 280366 | break; | |
| 2169 | } | ||
| 2170 | |||
| 2171 |
6/6✓ Branch 0 taken 510052 times.
✓ Branch 1 taken 455027 times.
✓ Branch 2 taken 499901 times.
✓ Branch 3 taken 10151 times.
✓ Branch 4 taken 211097 times.
✓ Branch 5 taken 288804 times.
|
965079 | if(game->get_canslash() && itemsbuf[itemid].flags & item_flag4 && attackclk<11) |
| 2172 | { | ||
| 2173 | 288804 | int32_t wpn2=itemsbuf[itemid].wpn2; | |
| 2174 | 288804 | wpn2=vbound(wpn2, 0, MAXWPNS); | |
| 2175 | |||
| 2176 | //slashing tiles | ||
| 2177 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 50381 times.
✓ Branch 2 taken 65009 times.
✓ Branch 3 taken 89631 times.
✓ Branch 4 taken 83783 times.
|
288804 | switch(dir) |
| 2178 | { | ||
| 2179 | case up: | ||
| 2180 | 50381 | wx=15; | |
| 2181 | 50381 | wy=-3; | |
| 2182 | 50381 | ++t; | |
| 2183 | 50381 | f=0; //starts pointing right | |
| 2184 | |||
| 2185 |
2/2✓ Branch 0 taken 22471 times.
✓ Branch 1 taken 27910 times.
|
50381 | if(attackclk>=7) |
| 2186 | { | ||
| 2187 | 27910 | wy-=9; | |
| 2188 | 27910 | wx-=3; | |
| 2189 | 27910 | t = wpnsbuf[wpn2].tile; | |
| 2190 | 27910 | cs2 = wpnsbuf[wpn2].csets&15; | |
| 2191 | 27910 | f=0; | |
| 2192 | 27910 | } | |
| 2193 | |||
| 2194 | 50381 | break; | |
| 2195 | |||
| 2196 | case down: | ||
| 2197 | 65009 | wx=-13; | |
| 2198 | 65009 | wy=-1; | |
| 2199 | 65009 | ++t; | |
| 2200 | 65009 | f=1; //starts pointing left | |
| 2201 | |||
| 2202 |
2/2✓ Branch 0 taken 28379 times.
✓ Branch 1 taken 36630 times.
|
65009 | if(attackclk>=7) |
| 2203 | { | ||
| 2204 | 36630 | wy+=15; | |
| 2205 | 36630 | wx+=2; | |
| 2206 | 36630 | t = wpnsbuf[wpn2].tile; | |
| 2207 | 36630 | cs2 = wpnsbuf[wpn2].csets&15; | |
| 2208 | 36630 | ++t; | |
| 2209 | 36630 | f=0; | |
| 2210 | 36630 | } | |
| 2211 | |||
| 2212 | 65009 | break; | |
| 2213 | |||
| 2214 | case left: | ||
| 2215 | 89631 | wx=3; | |
| 2216 | 89631 | wy=-15; | |
| 2217 | 89631 | --t; | |
| 2218 | 89631 | f=0; //starts pointing up | |
| 2219 | |||
| 2220 |
2/2✓ Branch 0 taken 38219 times.
✓ Branch 1 taken 51412 times.
|
89631 | if(attackclk>=7) |
| 2221 | { | ||
| 2222 | 51412 | wx-=15; | |
| 2223 | 51412 | wy+=3; | |
| 2224 | 51412 | slashxofs-=1; | |
| 2225 | 51412 | t = wpnsbuf[wpn2].tile; | |
| 2226 | 51412 | cs2 = wpnsbuf[wpn2].csets&15; | |
| 2227 | 51412 | t+=2; | |
| 2228 | 51412 | f=0; | |
| 2229 | 51412 | } | |
| 2230 | |||
| 2231 | 89631 | break; | |
| 2232 | |||
| 2233 | case right: | ||
| 2234 | 83783 | --t; | |
| 2235 | |||
| 2236 |
3/4✓ Branch 0 taken 83370 times.
✓ Branch 1 taken 413 times.
✓ Branch 2 taken 83370 times.
✗ Branch 3 not taken.
|
83783 | if(spins>0 || (itemsbuf[itemid].flags & item_flag8)) |
| 2237 | { | ||
| 2238 | 413 | wx=1; | |
| 2239 | 413 | wy=13; | |
| 2240 | 413 | f=2; | |
| 2241 | 413 | } | |
| 2242 | else | ||
| 2243 | { | ||
| 2244 | 83370 | wx=3; | |
| 2245 | 83370 | wy=-15; | |
| 2246 | 83370 | f=0; | |
| 2247 | } | ||
| 2248 | |||
| 2249 |
2/2✓ Branch 0 taken 35765 times.
✓ Branch 1 taken 48018 times.
|
83783 | if(attackclk>=7) |
| 2250 | { | ||
| 2251 | 48018 | wx+=15; | |
| 2252 | 48018 | slashxofs+=1; | |
| 2253 | 48018 | t = wpnsbuf[wpn2].tile; | |
| 2254 | 48018 | cs2 = wpnsbuf[wpn2].csets&15; | |
| 2255 | |||
| 2256 |
3/4✓ Branch 0 taken 47743 times.
✓ Branch 1 taken 275 times.
✓ Branch 2 taken 47743 times.
✗ Branch 3 not taken.
|
48018 | if(spins>0 || (itemsbuf[itemid].flags & item_flag8)) |
| 2257 | { | ||
| 2258 | 275 | wx-=1; | |
| 2259 | 275 | wy-=2; | |
| 2260 | 275 | } | |
| 2261 | else | ||
| 2262 | { | ||
| 2263 | 47743 | t+=3; | |
| 2264 | 47743 | f=0; | |
| 2265 | 47743 | wy+=3; | |
| 2266 | } | ||
| 2267 | 48018 | } | |
| 2268 | |||
| 2269 | 83783 | break; | |
| 2270 | } | ||
| 2271 | 288804 | } | |
| 2272 | |||
| 2273 | 965079 | int32_t itemid2 = current_item_id(itype_chargering); | |
| 2274 | |||
| 2275 |
4/4✓ Branch 0 taken 27595 times.
✓ Branch 1 taken 937484 times.
✓ Branch 2 taken 951958 times.
✓ Branch 3 taken 13121 times.
|
965079 | if(charging>(itemid2>=0 ? itemsbuf[itemid2].misc1 : 64)) |
| 2276 | { | ||
| 2277 |
2/2✓ Branch 0 taken 12589 times.
✓ Branch 1 taken 532 times.
|
13121 | cs2=(BSZ ? (frame&3)+6 : ((frame>>2)&1)+7); |
| 2278 | 13121 | } | |
| 2279 | |||
| 2280 | /*if(BSZ || ((isdungeon() && currscr<128) && !get_qr(qr_HERODUNGEONPOSFIX))) | ||
| 2281 | { | ||
| 2282 | wy+=2; | ||
| 2283 | }*/ | ||
| 2284 | 965079 | w->x = x+wx; | |
| 2285 | 965079 | w->y = y+wy-(54-(yofs+slashyofs))-fakez; | |
| 2286 | 965079 | w->z = (z+zofs); | |
| 2287 | 965079 | w->tile = t; | |
| 2288 | 965079 | w->flip = f; | |
| 2289 | 965079 | w->power = weaponattackpower(itemid); | |
| 2290 | 965079 | w->dir = dir; | |
| 2291 | 965079 | w->doAutoRotate(true); | |
| 2292 | 965079 | } | |
| 2293 | |||
| 2294 | ✗ | int HeroClass::getHammerState() const | |
| 2295 | { | ||
| 2296 | ✗ | if(attack == wHammer) | |
| 2297 | { | ||
| 2298 | ✗ | if(attackclk >= 15) | |
| 2299 | ✗ | return 3; | |
| 2300 | ✗ | if(attackclk >= 13) | |
| 2301 | ✗ | return 2; | |
| 2302 | ✗ | return 1; | |
| 2303 | } | ||
| 2304 | ✗ | return 0; | |
| 2305 | ✗ | } | |
| 2306 | 1094131 | weapon* find_first_wtype(int wtype) | |
| 2307 | { | ||
| 2308 |
2/2✓ Branch 0 taken 1177762 times.
✓ Branch 1 taken 88793 times.
|
1266555 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 2309 | { | ||
| 2310 | 1177762 | weapon* w = (weapon*)Lwpns.spr(i); | |
| 2311 | |||
| 2312 |
2/2✓ Branch 0 taken 1005338 times.
✓ Branch 1 taken 172424 times.
|
1177762 | if(w->id == wtype) |
| 2313 | 1005338 | return w; | |
| 2314 | 172424 | } | |
| 2315 | 88793 | return nullptr; | |
| 2316 | 1094131 | } | |
| 2317 | 16705787 | void HeroClass::draw(BITMAP* dest) | |
| 2318 | { | ||
| 2319 | /*{ | ||
| 2320 | char buf[36]; | ||
| 2321 | //sprintf(buf,"%d %d %d %d %d %d %d",dir, action, attack, attackclk, charging, spins, tapping); | ||
| 2322 | textout_shadowed_ex(framebuf,font, buf, 2,72,WHITE,BLACK,-1); | ||
| 2323 | }*/ | ||
| 2324 | 16705787 | int32_t oxofs = xofs, oyofs = yofs; | |
| 2325 | 16705787 | bool shieldModify = false; | |
| 2326 |
2/2✓ Branch 0 taken 93566 times.
✓ Branch 1 taken 16612221 times.
|
16705787 | bool invisible=(dontdraw>0) || (tmpscr->flags3&fINVISHERO); |
| 2327 | |||
| 2328 | { | ||
| 2329 |
2/2✓ Branch 0 taken 16535 times.
✓ Branch 1 taken 16689252 times.
|
16705787 | if(action==dying) |
| 2330 | { | ||
| 2331 |
2/2✓ Branch 0 taken 12522 times.
✓ Branch 1 taken 4013 times.
|
16535 | if(!invisible) |
| 2332 | { | ||
| 2333 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4013 times.
|
4013 | if ( script_hero_cset > -1 ) cs = script_hero_cset; |
| 2334 | 4013 | sprite::draw(dest); | |
| 2335 | 4013 | } | |
| 2336 | 16535 | goto herodraw_end; | |
| 2337 | } | ||
| 2338 | |||
| 2339 | 16689252 | bool useltm=(get_qr(qr_EXPANDEDLTM) != 0); | |
| 2340 | |||
| 2341 | |||
| 2342 |
2/2✓ Branch 0 taken 268676 times.
✓ Branch 1 taken 16420576 times.
|
16689252 | if(!invisible) |
| 2343 |
6/6✓ Branch 0 taken 7409291 times.
✓ Branch 1 taken 9011285 times.
✓ Branch 2 taken 4808578 times.
✓ Branch 3 taken 2600713 times.
✓ Branch 4 taken 183822 times.
✓ Branch 5 taken 4624756 times.
|
16420576 | yofs = oyofs-((!BSZ && isdungeon() && currscr<128 && !get_qr(qr_HERODUNGEONPOSFIX)) ? 2 : 0); |
| 2344 | |||
| 2345 | // Stone of Agony | ||
| 2346 | 16689252 | bool agony=false; | |
| 2347 | 16689252 | int32_t agonyid = current_item_id(itype_agony); | |
| 2348 | |||
| 2349 |
2/2✓ Branch 0 taken 268676 times.
✓ Branch 1 taken 16420576 times.
|
16689252 | if(!invisible) |
| 2350 | { | ||
| 2351 |
2/2✓ Branch 0 taken 241944 times.
✓ Branch 1 taken 16178632 times.
|
16420576 | if(agonyid>-1) |
| 2352 | { | ||
| 2353 | 241944 | int32_t power=itemsbuf[agonyid].power; | |
| 2354 | 241944 | int32_t left=static_cast<int32_t>(x+8-power)&0xF0; // Check top-left pixel of each tile | |
| 2355 | 241944 | int32_t right=(static_cast<int32_t>(x+8+power)&0xF0)+16; | |
| 2356 | 241944 | int32_t top=static_cast<int32_t>(y+(bigHitbox ? 8 : 12)-power)&0xF0; | |
| 2357 | 241944 | int32_t bottom=(static_cast<int32_t>(y+(bigHitbox ? 8 : 12)+power)&0xF0)+16; | |
| 2358 | |||
| 2359 |
2/2✓ Branch 0 taken 241944 times.
✓ Branch 1 taken 241944 times.
|
483888 | for(int32_t x=left; x<right; x+=16) |
| 2360 | { | ||
| 2361 |
2/2✓ Branch 0 taken 241912 times.
✓ Branch 1 taken 241944 times.
|
483856 | for(int32_t y=top; y<bottom; y+=16) |
| 2362 | { | ||
| 2363 |
4/4✓ Branch 0 taken 241928 times.
✓ Branch 1 taken 16 times.
✓ Branch 2 taken 241912 times.
✓ Branch 3 taken 16 times.
|
241944 | if(agonyflag(MAPFLAG(x, y)) || agonyflag(MAPCOMBOFLAG(x, y))) |
| 2364 | { | ||
| 2365 | 32 | agony=true; | |
| 2366 | 32 | x=right; // Break out of outer loop | |
| 2367 | 32 | break; | |
| 2368 | } | ||
| 2369 | 241912 | } | |
| 2370 | 241944 | } | |
| 2371 | 241944 | } | |
| 2372 | |||
| 2373 | 16420576 | cs = getFlashingCSet(); | |
| 2374 | 16420576 | } | |
| 2375 | |||
| 2376 |
5/6✓ Branch 0 taken 14957218 times.
✓ Branch 1 taken 1732034 times.
✓ Branch 2 taken 14944002 times.
✓ Branch 3 taken 13216 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 14944002 times.
|
16689252 | if(attackclk || (action==attacking||action==sideswimattacking)) |
| 2377 | { | ||
| 2378 | /* Spaghetti code constants! | ||
| 2379 | * - Hero.attack contains a weapon type... | ||
| 2380 | * - which must be converted to an itype... | ||
| 2381 | * - which must be converted to an item ID... | ||
| 2382 | * - which is used to acquire a wpn ID! Aack! | ||
| 2383 | */ | ||
| 2384 |
8/8✓ Branch 0 taken 38574 times.
✓ Branch 1 taken 1706676 times.
✓ Branch 2 taken 28 times.
✓ Branch 3 taken 1706648 times.
✓ Branch 4 taken 25729 times.
✓ Branch 5 taken 1680919 times.
✓ Branch 6 taken 64609 times.
✓ Branch 7 taken 1616310 times.
|
1745250 | int32_t itype = (attack==wFire ? itype_candle : attack==wCByrna ? itype_cbyrna : attack==wWand ? itype_wand : attack==wHammer ? itype_hammer : attack==wBugNet ? itype_bugnet : itype_sword); |
| 2385 |
4/4✓ Branch 0 taken 487400 times.
✓ Branch 1 taken 1197300 times.
✓ Branch 2 taken 324331 times.
✓ Branch 3 taken 163069 times.
|
1745250 | int32_t itemid = (directWpn>-1 && itemsbuf[directWpn].family==itype) ? directWpn : current_item_id(itype); |
| 2386 | 1684700 | itemid=vbound(itemid, 0, MAXITEMS-1); | |
| 2387 | // if ( itemsbuf[itemid].ScriptGenerated ) return; //t/b/a for script-generated swords. | ||
| 2388 |
8/8✓ Branch 0 taken 574637 times.
✓ Branch 1 taken 1110063 times.
✓ Branch 2 taken 574613 times.
✓ Branch 3 taken 24 times.
✓ Branch 4 taken 378210 times.
✓ Branch 5 taken 196403 times.
✓ Branch 6 taken 213725 times.
✓ Branch 7 taken 164485 times.
|
1684700 | if(attackclk>4||attack==wBugNet||(attack==wSword&&game->get_canslash())) |
| 2389 | { | ||
| 2390 |
2/2✓ Branch 0 taken 138 times.
✓ Branch 1 taken 1323674 times.
|
1323812 | if(attack == wBugNet) |
| 2391 | { | ||
| 2392 | 138 | weapon *w=NULL; | |
| 2393 | 138 | bool found = false; | |
| 2394 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 132 times.
|
138 | for(int32_t q = 0; q < Lwpns.Count(); ++q) |
| 2395 | { | ||
| 2396 | 132 | w = (weapon*)Lwpns.spr(q); | |
| 2397 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
|
132 | if(w->id == wBugNet) |
| 2398 | { | ||
| 2399 | 132 | found = true; | |
| 2400 | 132 | break; | |
| 2401 | } | ||
| 2402 | ✗ | } | |
| 2403 |
2/2✓ Branch 0 taken 132 times.
✓ Branch 1 taken 6 times.
|
138 | if(!found) |
| 2404 | { | ||
| 2405 |
5/10✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 6 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 6 times.
✗ Branch 9 not taken.
|
6 | Lwpns.add(new weapon((zfix)0,(zfix)0,(zfix)0,wBugNet,0,0,dir,itemid,getUID(),false,false,true)); |
| 2406 | |||
| 2407 | 6 | w = (weapon*)Lwpns.spr(Lwpns.Count()-1); | |
| 2408 | 6 | } | |
| 2409 | 138 | positionNet(w, itemid); | |
| 2410 | 138 | } | |
| 2411 |
8/8✓ Branch 0 taken 248408 times.
✓ Branch 1 taken 1075266 times.
✓ Branch 2 taken 230034 times.
✓ Branch 3 taken 18374 times.
✓ Branch 4 taken 215275 times.
✓ Branch 5 taken 14759 times.
✓ Branch 6 taken 229544 times.
✓ Branch 7 taken 1094130 times.
|
1323674 | else if((attack==wSword || attack==wWand || ((attack==wFire || attack==wCByrna) && itemsbuf[itemid].wpn)) && wpnsbuf[itemsbuf[itemid].wpn].tile) |
| 2412 | { | ||
| 2413 | // Create a sword weapon at the right spot. | ||
| 2414 | 1094130 | weapon *w=find_first_wtype(attack==wSword ? wSword : wWand); | |
| 2415 |
2/2✓ Branch 0 taken 1005337 times.
✓ Branch 1 taken 88793 times.
|
1094130 | if(!w) // Create one if sword nonexistant |
| 2416 | { | ||
| 2417 |
5/10✓ Branch 0 taken 88793 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 88793 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 88793 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 88793 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 88793 times.
✗ Branch 9 not taken.
|
88793 | Lwpns.add(new weapon((zfix)0,(zfix)0,(zfix)0,(attack==wSword ? wSword : wWand),0,0,dir,itemid,getUID(),false,false,true)); |
| 2418 | 88793 | w = (weapon*)Lwpns.spr(Lwpns.Count()-1); | |
| 2419 | |||
| 2420 | 88793 | positionSword(w,itemid); | |
| 2421 | |||
| 2422 | // Stone of Agony | ||
| 2423 |
1/2✓ Branch 0 taken 88793 times.
✗ Branch 1 not taken.
|
88793 | if(agony) |
| 2424 | { | ||
| 2425 | ✗ | w->y-=!(frame%zc_max(60-itemsbuf[agonyid].misc1,2))?1:0; | |
| 2426 | ✗ | } | |
| 2427 | 88793 | } | |
| 2428 | |||
| 2429 | // These are set by positionSword(), above or in checkstab() | ||
| 2430 | 1094130 | yofs += slashyofs; | |
| 2431 | 1094130 | xofs += slashxofs; | |
| 2432 | 1094130 | slashyofs = slashxofs = 0; | |
| 2433 | 1094130 | } | |
| 2434 | 1323812 | } | |
| 2435 | |||
| 2436 | 1684802 | if(attackclk<7 | |
| 2437 |
4/4✓ Branch 0 taken 917267 times.
✓ Branch 1 taken 767433 times.
✓ Branch 2 taken 731521 times.
✓ Branch 3 taken 185746 times.
|
1684700 | || (attack==wSword && ((attackclk<(game->get_canslash()?15:13) |
| 2438 |
4/6✓ Branch 0 taken 137308 times.
✓ Branch 1 taken 594213 times.
✓ Branch 2 taken 137308 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 137308 times.
|
731521 | || FIXED_Z3_ANIMATION && attackclk<(game->get_canslash()?16:12)) |
| 2439 |
2/2✓ Branch 0 taken 38044 times.
✓ Branch 1 taken 99264 times.
|
137308 | || (charging>0 && attackclk!=SWORDCHARGEFRAME))) |
| 2440 |
4/4✓ Branch 0 taken 304215 times.
✓ Branch 1 taken 24181 times.
✓ Branch 2 taken 292778 times.
✓ Branch 3 taken 11437 times.
|
323054 | || ((attack==wWand || attack==wFire || attack==wCByrna) && attackclk<13) |
| 2441 |
4/4✓ Branch 0 taken 29392 times.
✓ Branch 1 taken 299004 times.
✓ Branch 2 taken 50923 times.
✓ Branch 3 taken 248081 times.
|
328396 | || (attack==wHammer && attackclk<=30) |
| 2442 |
2/2✓ Branch 0 taken 102 times.
✓ Branch 1 taken 247979 times.
|
299004 | || (attack==wBugNet && attackclk<NET_CLK_TOTAL)) |
| 2443 | { | ||
| 2444 |
2/2✓ Branch 0 taken 340 times.
✓ Branch 1 taken 1479767 times.
|
1480107 | if(!invisible) |
| 2445 | { | ||
| 2446 | 1479767 | herotile(&tile, &flip, &extend, (IsSideSwim())?ls_sideswimstab:ls_stab, dir, zinit.heroAnimationStyle); | |
| 2447 |
2/4✓ Branch 0 taken 1479767 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1479767 times.
✗ Branch 3 not taken.
|
1479767 | if (FIXED_Z3_ANIMATION) |
| 2448 | { | ||
| 2449 | ✗ | if (attackclk >= 2) tile += (extend==2?2:1); | |
| 2450 | ✗ | if (attackclk >= 13) tile += (extend==2?2:1); | |
| 2451 | ✗ | } | |
| 2452 | |||
| 2453 |
14/18✓ Branch 0 taken 742532 times.
✓ Branch 1 taken 737235 times.
✓ Branch 2 taken 157205 times.
✓ Branch 3 taken 585327 times.
✓ Branch 4 taken 146324 times.
✓ Branch 5 taken 10881 times.
✓ Branch 6 taken 141820 times.
✓ Branch 7 taken 4504 times.
✓ Branch 8 taken 584266 times.
✓ Branch 9 taken 158266 times.
✓ Branch 10 taken 331198 times.
✓ Branch 11 taken 253068 times.
✓ Branch 12 taken 331198 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 331198 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
1479767 | if(((game->get_canslash() && (attack==wSword || attack==wWand || attack==wFire || attack==wCByrna)) && itemsbuf[itemid].flags&item_flag4 && (attackclk<7||FIXED_Z3_ANIMATION&&(attackclk < 16)))) |
| 2454 | { | ||
| 2455 | 253068 | herotile(&tile, &flip, &extend, (IsSideSwim())?ls_sideswimslash:ls_slash, dir, zinit.heroAnimationStyle); | |
| 2456 |
2/4✓ Branch 0 taken 253068 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 253068 times.
✗ Branch 3 not taken.
|
253068 | if (FIXED_Z3_ANIMATION) |
| 2457 | { | ||
| 2458 | ✗ | if (attackclk >= 7) tile += (extend==2?2:1); | |
| 2459 | ✗ | if (attackclk >= 11) tile += (extend==2?2:1); | |
| 2460 | ✗ | if (attackclk >= 14) tile += (extend==2?2:1); | |
| 2461 | ✗ | } | |
| 2462 | 253068 | } | |
| 2463 |
3/4✓ Branch 0 taken 138 times.
✓ Branch 1 taken 1479629 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 138 times.
|
1479767 | if (attack==wBugNet && !get_qr(qr_OLD_BUG_NET)) |
| 2464 | { | ||
| 2465 |
6/6✓ Branch 0 taken 38 times.
✓ Branch 1 taken 100 times.
✓ Branch 2 taken 100 times.
✓ Branch 3 taken 62 times.
✓ Branch 4 taken 100 times.
✓ Branch 5 taken 62 times.
|
138 | if ((dir == right && (itemsbuf[itemid].flags&item_flag2)) || (dir != right && !(itemsbuf[itemid].flags&item_flag2))) |
| 2466 | { | ||
| 2467 |
2/2✓ Branch 0 taken 68 times.
✓ Branch 1 taken 32 times.
|
100 | if (attackclk < 9) herotile(&tile, &flip, &extend, ls_revslash, dir, zinit.heroAnimationStyle); |
| 2468 |
2/2✓ Branch 0 taken 60 times.
✓ Branch 1 taken 40 times.
|
100 | if (attackclk > 15) herotile(&tile, &flip, &extend, (IsSideSwim())?ls_sideswimslash:ls_slash, dir, zinit.heroAnimationStyle); |
| 2469 | 100 | } | |
| 2470 | else | ||
| 2471 | { | ||
| 2472 |
2/2✓ Branch 0 taken 22 times.
✓ Branch 1 taken 16 times.
|
162 | if (attackclk < 9) herotile(&tile, &flip, &extend, (IsSideSwim())?ls_sideswimslash:ls_slash, dir, zinit.heroAnimationStyle); |
| 2473 |
2/2✓ Branch 0 taken 30 times.
✓ Branch 1 taken 8 times.
|
38 | if (attackclk > 15) herotile(&tile, &flip, &extend, ls_revslash, dir, zinit.heroAnimationStyle); |
| 2474 | } | ||
| 2475 | 138 | } | |
| 2476 | |||
| 2477 |
4/4✓ Branch 0 taken 64609 times.
✓ Branch 1 taken 1415158 times.
✓ Branch 2 taken 37727 times.
✓ Branch 3 taken 26882 times.
|
1479767 | if((attack==wHammer) && (attackclk<13)) |
| 2478 | { | ||
| 2479 | 26882 | herotile(&tile, &flip, &extend, (IsSideSwim())?ls_sideswimpound:ls_pound, dir, zinit.heroAnimationStyle); | |
| 2480 |
2/4✓ Branch 0 taken 26882 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 26882 times.
✗ Branch 3 not taken.
|
26882 | if (FIXED_Z3_ANIMATION) |
| 2481 | { | ||
| 2482 | ✗ | if (attackclk >= 14) tile += (extend==2?2:1); | |
| 2483 | ✗ | if (attackclk >= 16) tile += (extend==2?2:1); | |
| 2484 | ✗ | } | |
| 2485 | 26882 | } | |
| 2486 | |||
| 2487 |
2/2✓ Branch 0 taken 987121 times.
✓ Branch 1 taken 492646 times.
|
1479767 | if(useltm) |
| 2488 | { | ||
| 2489 |
2/2✓ Branch 0 taken 1840 times.
✓ Branch 1 taken 490806 times.
|
492646 | if ( script_hero_sprite <= 0 ) tile+=getTileModifier(); |
| 2490 | 492646 | } | |
| 2491 | |||
| 2492 | // Stone of Agony | ||
| 2493 |
1/2✓ Branch 0 taken 1479767 times.
✗ Branch 1 not taken.
|
1479767 | if(agony) |
| 2494 | { | ||
| 2495 | ✗ | yofs-=!(frame%zc_max(60-itemsbuf[agonyid].misc1,3))?1:0; | |
| 2496 | ✗ | } | |
| 2497 | |||
| 2498 | //Probably what makes Hero flicker, except for the QR check. What makes him flicker when that rule is off?! -Z | ||
| 2499 | |||
| 2500 | //I'm pretty sure he doesn't flicker when the rule is off. Also, take note of the parenthesis after the ! in this if statement; I was blind and didn't see it, and thought this code did something completely different. -Deedee | ||
| 2501 |
2/2✓ Branch 0 taken 12487 times.
✓ Branch 1 taken 1467280 times.
|
1479767 | if (is_hitflickerframe()) |
| 2502 | { | ||
| 2503 |
4/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 12485 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 12485 times.
|
12487 | int32_t temp_flicker_color = (game->get_life() > 0 || immortal) ? (flickercolor < 0 ? game->get_spriteflickercolor() : flickercolor) : 0; |
| 2504 |
2/4✓ Branch 0 taken 12487 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12487 times.
✗ Branch 3 not taken.
|
12487 | if((game->get_spriteflickercolor() || temp_flicker_color) && !superman) |
| 2505 | { | ||
| 2506 | ✗ | sprite_flicker_transp_passes = (flickertransp < 0 ? game->get_spriteflickertransp() : flickertransp); | |
| 2507 | ✗ | sprite_flicker_color = temp_flicker_color; | |
| 2508 | ✗ | masked_draw(dest); | |
| 2509 | ✗ | } | |
| 2510 | 12487 | } | |
| 2511 | else | ||
| 2512 | 1467280 | masked_draw(dest); | |
| 2513 | |||
| 2514 | //Prevent flickering -Z | ||
| 2515 |
1/2✓ Branch 0 taken 1479767 times.
✗ Branch 1 not taken.
|
1479767 | if (!getCanFlicker()) masked_draw(dest); |
| 2516 | 1479767 | } | |
| 2517 | |||
| 2518 |
2/2✓ Branch 0 taken 1415498 times.
✓ Branch 1 taken 64609 times.
|
1480107 | if(attack!=wHammer) |
| 2519 | 1415498 | goto herodraw_end; | |
| 2520 | 64609 | } | |
| 2521 | |||
| 2522 |
2/2✓ Branch 0 taken 64609 times.
✓ Branch 1 taken 247979 times.
|
312588 | if(attack==wHammer) // To do: possibly abstract this out to a positionHammer routine? |
| 2523 | { | ||
| 2524 | 64609 | int32_t wy=1; | |
| 2525 | 64609 | int32_t wx=1; | |
| 2526 | 64609 | int32_t f=0,t,cs2; | |
| 2527 | 64609 | weapon *w=NULL; | |
| 2528 | 64609 | bool found = false; | |
| 2529 | |||
| 2530 |
2/2✓ Branch 0 taken 2255 times.
✓ Branch 1 taken 63240 times.
|
65495 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 2531 | { | ||
| 2532 | 63240 | w = (weapon*)Lwpns.spr(i); | |
| 2533 | |||
| 2534 |
2/2✓ Branch 0 taken 886 times.
✓ Branch 1 taken 62354 times.
|
63240 | if(w->id == wHammer) |
| 2535 | { | ||
| 2536 | 62354 | found = true; | |
| 2537 | 62354 | break; | |
| 2538 | } | ||
| 2539 | 886 | } | |
| 2540 | |||
| 2541 |
2/2✓ Branch 0 taken 62354 times.
✓ Branch 1 taken 2255 times.
|
64609 | if(!found) |
| 2542 | { | ||
| 2543 |
5/10✓ Branch 0 taken 2255 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2255 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2255 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2255 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2255 times.
✗ Branch 9 not taken.
|
2255 | Lwpns.add(new weapon((zfix)0,(zfix)0,(zfix)0,wHammer,0,0,dir,itemid,getUID(),false,false,true)); |
| 2544 | 2255 | w = (weapon*)Lwpns.spr(Lwpns.Count()-1); | |
| 2545 | 2255 | found = true; | |
| 2546 | 2255 | } | |
| 2547 | |||
| 2548 | 64609 | t = w->o_tile; | |
| 2549 | 64609 | cs2 = w->o_cset; | |
| 2550 | |||
| 2551 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 10368 times.
✓ Branch 2 taken 15134 times.
✓ Branch 3 taken 21126 times.
✓ Branch 4 taken 17981 times.
|
64609 | switch(dir) |
| 2552 | { | ||
| 2553 | case up: | ||
| 2554 | 10368 | wx=-1; | |
| 2555 | 10368 | wy=-15; | |
| 2556 |
1/2✓ Branch 0 taken 10368 times.
✗ Branch 1 not taken.
|
10368 | if (IsSideSwim())wy+=hammer_swim_up_offset; |
| 2557 | |||
| 2558 |
2/2✓ Branch 0 taken 4383 times.
✓ Branch 1 taken 5985 times.
|
10368 | if(attackclk>=13) |
| 2559 | { | ||
| 2560 | 5985 | wx-=1; | |
| 2561 | 5985 | wy+=1; | |
| 2562 | 5985 | ++t; | |
| 2563 | 5985 | } | |
| 2564 | |||
| 2565 |
2/2✓ Branch 0 taken 5061 times.
✓ Branch 1 taken 5307 times.
|
10368 | if(attackclk>=15) |
| 2566 | { | ||
| 2567 |
1/2✓ Branch 0 taken 5307 times.
✗ Branch 1 not taken.
|
5307 | if (IsSideSwim())wy-=hammer_swim_up_offset; |
| 2568 | 5307 | ++t; | |
| 2569 | 5307 | } | |
| 2570 | |||
| 2571 | 10368 | break; | |
| 2572 | |||
| 2573 | case down: | ||
| 2574 | 15134 | wx=3; | |
| 2575 | 15134 | wy=-14; | |
| 2576 |
1/2✓ Branch 0 taken 15134 times.
✗ Branch 1 not taken.
|
15134 | if (IsSideSwim())wy+=hammer_swim_down_offset; |
| 2577 | 15134 | t+=3; | |
| 2578 | |||
| 2579 |
2/2✓ Branch 0 taken 6339 times.
✓ Branch 1 taken 8795 times.
|
15134 | if(attackclk>=13) |
| 2580 | { | ||
| 2581 | 8795 | wy+=16; | |
| 2582 | 8795 | ++t; | |
| 2583 | 8795 | } | |
| 2584 | |||
| 2585 |
2/2✓ Branch 0 taken 7346 times.
✓ Branch 1 taken 7788 times.
|
15134 | if(attackclk>=15) |
| 2586 | { | ||
| 2587 | 7788 | wx-=1; | |
| 2588 | 7788 | wy+=12; | |
| 2589 |
1/2✓ Branch 0 taken 7788 times.
✗ Branch 1 not taken.
|
7788 | if (IsSideSwim())wy-=hammer_swim_down_offset; |
| 2590 | 7788 | ++t; | |
| 2591 | 7788 | } | |
| 2592 | |||
| 2593 | 15134 | break; | |
| 2594 | |||
| 2595 | case left: | ||
| 2596 | 21126 | wx=0; | |
| 2597 | 21126 | wy=-14; | |
| 2598 |
1/2✓ Branch 0 taken 21126 times.
✗ Branch 1 not taken.
|
21126 | if (IsSideSwim())wy+=hammer_swim_left_offset; |
| 2599 | 21126 | t+=6; | |
| 2600 | 21126 | f=1; | |
| 2601 | |||
| 2602 |
2/2✓ Branch 0 taken 8777 times.
✓ Branch 1 taken 12349 times.
|
21126 | if(attackclk>=13) |
| 2603 | { | ||
| 2604 | 12349 | wx-=7; | |
| 2605 | 12349 | wy+=8; | |
| 2606 | 12349 | ++t; | |
| 2607 | 12349 | } | |
| 2608 | |||
| 2609 |
2/2✓ Branch 0 taken 10191 times.
✓ Branch 1 taken 10935 times.
|
21126 | if(attackclk>=15) |
| 2610 | { | ||
| 2611 | 10935 | wx-=8; | |
| 2612 | 10935 | wy+=8; | |
| 2613 |
1/2✓ Branch 0 taken 10935 times.
✗ Branch 1 not taken.
|
10935 | if (IsSideSwim())wy-=hammer_swim_left_offset; |
| 2614 | 10935 | ++t; | |
| 2615 | 10935 | } | |
| 2616 | |||
| 2617 | 21126 | break; | |
| 2618 | |||
| 2619 | case right: | ||
| 2620 | 17981 | wx=0; | |
| 2621 | 17981 | wy=-14; | |
| 2622 |
1/2✓ Branch 0 taken 17981 times.
✗ Branch 1 not taken.
|
17981 | if (IsSideSwim())wy+=hammer_swim_right_offset; |
| 2623 | 17981 | t+=6; | |
| 2624 | |||
| 2625 |
2/2✓ Branch 0 taken 7383 times.
✓ Branch 1 taken 10598 times.
|
17981 | if(attackclk>=13) |
| 2626 | { | ||
| 2627 | 10598 | wx+=7; | |
| 2628 | 10598 | wy+=8; | |
| 2629 | 10598 | ++t; | |
| 2630 | 10598 | } | |
| 2631 | |||
| 2632 |
2/2✓ Branch 0 taken 8581 times.
✓ Branch 1 taken 9400 times.
|
17981 | if(attackclk>=15) |
| 2633 | { | ||
| 2634 | 9400 | wx+=8; | |
| 2635 | 9400 | wy+=8; | |
| 2636 |
1/2✓ Branch 0 taken 9400 times.
✗ Branch 1 not taken.
|
9400 | if (IsSideSwim())wy-=hammer_swim_right_offset; |
| 2637 | 9400 | ++t; | |
| 2638 | 9400 | } | |
| 2639 | |||
| 2640 | 17981 | break; | |
| 2641 | } | ||
| 2642 | |||
| 2643 |
7/8✓ Branch 0 taken 28062 times.
✓ Branch 1 taken 36547 times.
✓ Branch 2 taken 20878 times.
✓ Branch 3 taken 7184 times.
✓ Branch 4 taken 20878 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 4720 times.
✓ Branch 7 taken 16158 times.
|
64609 | if(BSZ || ((isdungeon() && currscr<128) && !get_qr(qr_HERODUNGEONPOSFIX))) |
| 2644 | { | ||
| 2645 | 52705 | wy+=2; | |
| 2646 | 52705 | } | |
| 2647 | |||
| 2648 | // Stone of Agony | ||
| 2649 |
1/2✓ Branch 0 taken 64609 times.
✗ Branch 1 not taken.
|
64609 | if(agony) |
| 2650 | { | ||
| 2651 | ✗ | wy-=!(frame%zc_max(60-itemsbuf[agonyid].misc1,3))?1:0; | |
| 2652 | ✗ | } | |
| 2653 | |||
| 2654 | 64609 | w->x = x+wx; | |
| 2655 | 64609 | w->y = y+wy-(54-yofs)-fakez; | |
| 2656 | 64609 | w->z = (z+zofs); | |
| 2657 | 64609 | w->tile = t; | |
| 2658 | 64609 | w->flip = f; | |
| 2659 | 64609 | w->hit_width=20; | |
| 2660 | 64609 | w->hit_height=20; | |
| 2661 | |||
| 2662 |
2/2✓ Branch 0 taken 39107 times.
✓ Branch 1 taken 25502 times.
|
64609 | if(dir>down) |
| 2663 | { | ||
| 2664 | 39107 | w->hit_height-=6; | |
| 2665 | 39107 | } | |
| 2666 | else | ||
| 2667 | { | ||
| 2668 | 25502 | w->hit_width-=6; | |
| 2669 | 25502 | w->hyofs=4; | |
| 2670 | } | ||
| 2671 | |||
| 2672 | 64609 | w->power = weaponattackpower(itemid); | |
| 2673 | |||
| 2674 |
7/10✓ Branch 0 taken 2130 times.
✓ Branch 1 taken 62479 times.
✓ Branch 2 taken 2130 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2130 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5 times.
✓ Branch 7 taken 2125 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 5 times.
|
64609 | if(attackclk==15 && z==0 && fakez==0 && (sideviewhammerpound() || !isSideViewHero())) |
| 2675 | { | ||
| 2676 |
3/4✓ Branch 0 taken 2118 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 2130 times.
✗ Branch 3 not taken.
|
2130 | sfx(((iswaterex(MAPCOMBO(x+wx+8,y+wy), currmap, currscr, -1, x+wx+8, y+wy, true) || COMBOTYPE(x+wx+8,y+wy)==cSHALLOWWATER) && get_qr(qr_MORESOUNDS)) ? WAV_ZN1SPLASH : itemsbuf[itemid].usesound,pan(x.getInt())); |
| 2677 | 2130 | } | |
| 2678 | |||
| 2679 | 64609 | goto herodraw_end; | |
| 2680 | } | ||
| 2681 | 247979 | } | |
| 2682 |
2/4✓ Branch 0 taken 14944002 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 14944002 times.
|
14944002 | else if(!charging && !spins) // remove the sword |
| 2683 | { | ||
| 2684 |
2/2✓ Branch 0 taken 2942607 times.
✓ Branch 1 taken 14944002 times.
|
17886609 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 2685 | { | ||
| 2686 | 2942607 | weapon *w = (weapon*)Lwpns.spr(i); | |
| 2687 | |||
| 2688 |
6/6✓ Branch 0 taken 2941810 times.
✓ Branch 1 taken 797 times.
✓ Branch 2 taken 2940302 times.
✓ Branch 3 taken 1508 times.
✓ Branch 4 taken 31846 times.
✓ Branch 5 taken 2908456 times.
|
2942607 | if(w->id == wSword || w->id == wHammer || w->id==wWand) |
| 2689 | 34151 | w->dead=1; | |
| 2690 | 2942607 | } | |
| 2691 | 14944002 | } | |
| 2692 | |||
| 2693 |
2/2✓ Branch 0 taken 251172 times.
✓ Branch 1 taken 14940809 times.
|
15191981 | if(invisible) |
| 2694 | { | ||
| 2695 | 251172 | goto herodraw_end; | |
| 2696 | } | ||
| 2697 | |||
| 2698 |
3/4✓ Branch 0 taken 14937962 times.
✓ Branch 1 taken 2847 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 14937962 times.
|
14940809 | if(action != casting && action != sideswimcasting) |
| 2699 | { | ||
| 2700 | // Keep this consistent with checkspecial2, line 7800-ish... | ||
| 2701 |
6/6✓ Branch 0 taken 295974 times.
✓ Branch 1 taken 14641988 times.
✓ Branch 2 taken 285086 times.
✓ Branch 3 taken 10888 times.
✓ Branch 4 taken 12379 times.
✓ Branch 5 taken 272707 times.
|
14937962 | bool inwater = iswaterex(MAPCOMBO(x+4,y+9), currmap, currscr, -1, x+4, y+9, true, false) && iswaterex(MAPCOMBO(x+4,y+15), currmap, currscr, -1, x+4, y+15, true, false) && iswaterex(MAPCOMBO(x+11,y+9), currmap, currscr, -1, x+11, y+9, true, false) && iswaterex(MAPCOMBO(x+11,y+15), currmap, currscr, -1, x+11, y+15, true, false); |
| 2702 | |||
| 2703 | 14937962 | int32_t jumping2 = int32_t(jumping*((zinit.gravity / 100)/16.0)); | |
| 2704 | 14937962 | bool noliftspr = get_qr(qr_NO_LIFT_SPRITE); | |
| 2705 | 14937962 | bool advancetile = script_hero_sprite <= 0; | |
| 2706 | //if (jumping!=0) al_trace("%d %d %f %d\n",jumping,zinit.gravity,zinit.gravity/16.0,jumping2); | ||
| 2707 |
2/4✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 8443561 times.
✓ Branch 3 taken 6494401 times.
|
14937962 | switch(zinit.heroAnimationStyle) |
| 2708 | { | ||
| 2709 | case las_original: //normal | ||
| 2710 |
2/2✓ Branch 0 taken 3040 times.
✓ Branch 1 taken 8440521 times.
|
8443561 | if(action==drowning) |
| 2711 | { | ||
| 2712 |
1/2✓ Branch 0 taken 3040 times.
✗ Branch 1 not taken.
|
3040 | if(inwater) |
| 2713 | { | ||
| 2714 | 3040 | herotile(&tile, &flip, &extend, (drownclk > 60) ? ls_float : ls_drown, dir, zinit.heroAnimationStyle); | |
| 2715 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3040 times.
|
3040 | if(advancetile) tile+=((frame>>3) & 1)*(extend==2?2:1); |
| 2716 | 3040 | } | |
| 2717 | else | ||
| 2718 | { | ||
| 2719 | ✗ | goto herodraw_end; | |
| 2720 | } | ||
| 2721 | 3040 | } | |
| 2722 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 8440265 times.
|
8440521 | else if(action==lavadrowning) |
| 2723 | { | ||
| 2724 | 256 | herotile(&tile, &flip, &extend, (drownclk > 60) ? ls_float : ls_lavadrown, dir, zinit.heroAnimationStyle); | |
| 2725 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 256 times.
|
256 | if(advancetile) tile+=((frame>>3) & 1)*(extend==2?2:1); |
| 2726 | 256 | } | |
| 2727 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8440265 times.
|
8440265 | else if(action==sidedrowning) |
| 2728 | { | ||
| 2729 | ✗ | herotile(&tile, &flip, &extend, ls_sidedrown, down, zinit.heroAnimationStyle); | |
| 2730 | ✗ | if(advancetile) tile+=((frame>>3) & 1)*(extend==2?2:1); | |
| 2731 | ✗ | } | |
| 2732 |
2/4✓ Branch 0 taken 8440265 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 8440265 times.
|
8440265 | else if (action == sideswimming || action == sideswimhit) |
| 2733 | { | ||
| 2734 | ✗ | herotile(&tile, &flip, &extend, ls_sideswim, dir, zinit.heroAnimationStyle); | |
| 2735 | |||
| 2736 | ✗ | if(lstep>=6) | |
| 2737 | { | ||
| 2738 | ✗ | if(dir==up) | |
| 2739 | { | ||
| 2740 | ✗ | if(advancetile) ++flip; | |
| 2741 | ✗ | } | |
| 2742 | else | ||
| 2743 | { | ||
| 2744 | ✗ | if(advancetile) extend==2?tile+=2:++tile; | |
| 2745 | } | ||
| 2746 | ✗ | } | |
| 2747 | ✗ | } | |
| 2748 |
5/6✓ Branch 0 taken 8345628 times.
✓ Branch 1 taken 94637 times.
✓ Branch 2 taken 8344807 times.
✓ Branch 3 taken 821 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 8344807 times.
|
8440265 | else if(action==swimming || action==swimhit || hopclk==0xFF) |
| 2749 | { | ||
| 2750 | 95458 | herotile(&tile, &flip, &extend, is_moving()?ls_swim:ls_float, dir, zinit.heroAnimationStyle); | |
| 2751 | |||
| 2752 |
2/2✓ Branch 0 taken 47669 times.
✓ Branch 1 taken 47789 times.
|
95458 | if(lstep>=6) |
| 2753 | { | ||
| 2754 |
2/2✓ Branch 0 taken 9775 times.
✓ Branch 1 taken 38014 times.
|
47789 | if(dir==up) |
| 2755 | { | ||
| 2756 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9775 times.
|
9775 | if(advancetile) ++flip; |
| 2757 | 9775 | } | |
| 2758 | else | ||
| 2759 | { | ||
| 2760 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 38014 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 38014 times.
|
38014 | if(advancetile) extend==2?tile+=2:++tile; |
| 2761 | } | ||
| 2762 | 47789 | } | |
| 2763 | |||
| 2764 |
2/2✓ Branch 0 taken 90255 times.
✓ Branch 1 taken 5203 times.
|
95458 | if(isDiving()) |
| 2765 | { | ||
| 2766 | 5203 | herotile(&tile, &flip, &extend, ls_dive, dir, zinit.heroAnimationStyle); | |
| 2767 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5203 times.
|
5203 | if(advancetile) tile+=((frame>>3) & 1)*(extend==2?2:1); |
| 2768 | 5203 | } | |
| 2769 | 95458 | } | |
| 2770 |
3/4✓ Branch 0 taken 1618 times.
✓ Branch 1 taken 8343189 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1618 times.
|
8344807 | else if(charging > 0 && attack != wHammer) |
| 2771 | { | ||
| 2772 | 1618 | herotile(&tile, &flip, &extend, (IsSideSwim())?ls_sideswimcharge:ls_charge, dir, zinit.heroAnimationStyle); | |
| 2773 | |||
| 2774 |
2/2✓ Branch 0 taken 943 times.
✓ Branch 1 taken 675 times.
|
1618 | if(lstep>=6) |
| 2775 | { | ||
| 2776 |
2/2✓ Branch 0 taken 531 times.
✓ Branch 1 taken 144 times.
|
675 | if(dir==up) |
| 2777 | { | ||
| 2778 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 144 times.
|
144 | if(advancetile) ++flip; |
| 2779 | 144 | } | |
| 2780 | else | ||
| 2781 | { | ||
| 2782 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 531 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 531 times.
|
531 | if(advancetile) extend==2?tile+=2:++tile; |
| 2783 | } | ||
| 2784 | 675 | } | |
| 2785 | 1618 | } | |
| 2786 |
9/12✓ Branch 0 taken 8342947 times.
✓ Branch 1 taken 242 times.
✓ Branch 2 taken 8342947 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 85805 times.
✓ Branch 5 taken 8257384 times.
✓ Branch 6 taken 71761 times.
✓ Branch 7 taken 14044 times.
✓ Branch 8 taken 71761 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 71761 times.
|
8343189 | else if((z>0 || fakez>0 || isSideViewHero()) && jumping2>0 && jumping2<24 && game->get_life()>0 && action!=rafting) |
| 2787 | { | ||
| 2788 | 71761 | herotile(&tile, &flip, &extend, ls_jump, dir, zinit.heroAnimationStyle); | |
| 2789 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 71761 times.
|
71761 | if(advancetile) tile+=((int32_t)jumping2/8)*(extend==2?2:1); |
| 2790 | 71761 | } | |
| 2791 |
2/2✓ Branch 0 taken 1890 times.
✓ Branch 1 taken 8269538 times.
|
8271428 | else if(fallclk>0) |
| 2792 | { | ||
| 2793 | 1890 | herotile(&tile, &flip, &extend, ls_falling, dir, zinit.heroAnimationStyle); | |
| 2794 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1890 times.
|
1890 | if(advancetile) tile+=((PITFALL_FALL_FRAMES-fallclk)/10)*(extend==2?2:1); |
| 2795 | 1890 | } | |
| 2796 |
5/6✓ Branch 0 taken 419450 times.
✓ Branch 1 taken 7850088 times.
✓ Branch 2 taken 585 times.
✓ Branch 3 taken 418865 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 585 times.
|
8269538 | else if(!noliftspr&&action==lifting&&isLifting()) |
| 2797 | { | ||
| 2798 | 585 | herotile(&tile, &flip, &extend, ls_lifting, dir, zinit.heroAnimationStyle); | |
| 2799 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 585 times.
|
585 | if(script_hero_sprite <= 0) |
| 2800 | { | ||
| 2801 | 585 | auto frames = vbound(liftingspr[dir][spr_frames],1,255); | |
| 2802 | 585 | auto speed = tliftclk/frames; | |
| 2803 |
1/2✓ Branch 0 taken 585 times.
✗ Branch 1 not taken.
|
585 | if (speed < 1) speed = 1; |
| 2804 | 585 | auto curframe = (tliftclk - liftclk) / speed; | |
| 2805 |
1/2✓ Branch 0 taken 585 times.
✗ Branch 1 not taken.
|
585 | if (!tliftclk) curframe = frames - 1; |
| 2806 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 585 times.
|
585 | if(unsigned(curframe) < frames) |
| 2807 | 585 | tile += curframe * (extend == 2 ? 2 : 1); | |
| 2808 | 585 | } | |
| 2809 | 585 | } | |
| 2810 | else | ||
| 2811 | { | ||
| 2812 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8268953 times.
|
8268953 | if(IsSideSwim()) |
| 2813 | ✗ | herotile(&tile, &flip, &extend, ls_sideswim, dir, zinit.heroAnimationStyle); | |
| 2814 | else | ||
| 2815 | { | ||
| 2816 |
4/4✓ Branch 0 taken 418865 times.
✓ Branch 1 taken 7850088 times.
✓ Branch 2 taken 410269 times.
✓ Branch 3 taken 8596 times.
|
8268953 | if(!noliftspr&&isLifting()) |
| 2817 | 8596 | herotile(&tile, &flip, &extend, ls_liftwalk, dir, zinit.heroAnimationStyle); | |
| 2818 | 8260357 | else herotile(&tile, &flip, &extend, ls_walk, dir, zinit.heroAnimationStyle); | |
| 2819 | } | ||
| 2820 | |||
| 2821 |
2/2✓ Branch 0 taken 6133045 times.
✓ Branch 1 taken 2135908 times.
|
8268953 | if(dir>up) |
| 2822 | { | ||
| 2823 | 6133045 | useltm=true; | |
| 2824 | 6133045 | shieldModify=true; | |
| 2825 | 6133045 | } | |
| 2826 | |||
| 2827 |
3/4✓ Branch 0 taken 8268953 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4026929 times.
✓ Branch 3 taken 4242024 times.
|
8268953 | if(advancetile && lstep>=6) |
| 2828 | { | ||
| 2829 |
2/2✓ Branch 0 taken 1087025 times.
✓ Branch 1 taken 3154999 times.
|
4242024 | if(dir==up) |
| 2830 | { | ||
| 2831 | 1087025 | ++flip; | |
| 2832 | 1087025 | } | |
| 2833 | else | ||
| 2834 | { | ||
| 2835 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3154999 times.
|
3154999 | extend==2?tile+=2:++tile; |
| 2836 | } | ||
| 2837 | 4242024 | } | |
| 2838 | } | ||
| 2839 | |||
| 2840 | 8443561 | break; | |
| 2841 | |||
| 2842 | case las_bszelda: //BS | ||
| 2843 |
2/2✓ Branch 0 taken 2944 times.
✓ Branch 1 taken 6491457 times.
|
6494401 | if(action==drowning) |
| 2844 | { | ||
| 2845 |
1/2✓ Branch 0 taken 2944 times.
✗ Branch 1 not taken.
|
2944 | if(inwater) |
| 2846 | { | ||
| 2847 | 2944 | herotile(&tile, &flip, &extend, (drownclk > 60) ? ls_float : ls_drown, dir, zinit.heroAnimationStyle); | |
| 2848 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2944 times.
|
2944 | if(advancetile) tile += anim_3_4(lstep,7)*(extend==2?2:1); |
| 2849 | 2944 | } | |
| 2850 | else | ||
| 2851 | { | ||
| 2852 | ✗ | goto herodraw_end; | |
| 2853 | } | ||
| 2854 | 2944 | } | |
| 2855 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6491457 times.
|
6491457 | else if (action == sidedrowning) |
| 2856 | { | ||
| 2857 | ✗ | herotile(&tile, &flip, &extend, ls_sidedrown, down, zinit.heroAnimationStyle); | |
| 2858 | ✗ | if(advancetile) tile += anim_3_4(lstep,7)*(extend==2?2:1); | |
| 2859 | ✗ | } | |
| 2860 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6491457 times.
|
6491457 | else if(action==lavadrowning) |
| 2861 | { | ||
| 2862 | ✗ | herotile(&tile, &flip, &extend, (drownclk > 60) ? ls_float : ls_lavadrown, dir, zinit.heroAnimationStyle); | |
| 2863 | ✗ | if(advancetile) tile += anim_3_4(lstep,7)*(extend==2?2:1); | |
| 2864 | ✗ | } | |
| 2865 |
2/4✓ Branch 0 taken 6491457 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6491457 times.
|
6491457 | else if (action == sideswimming || action == sideswimhit) |
| 2866 | { | ||
| 2867 | ✗ | herotile(&tile, &flip, &extend, ls_sideswim, dir, zinit.heroAnimationStyle); | |
| 2868 | |||
| 2869 | ✗ | if(advancetile) tile += anim_3_4(lstep,7)*(extend==2?2:1); | |
| 2870 | ✗ | } | |
| 2871 |
6/6✓ Branch 0 taken 6429813 times.
✓ Branch 1 taken 61644 times.
✓ Branch 2 taken 6429382 times.
✓ Branch 3 taken 431 times.
✓ Branch 4 taken 157 times.
✓ Branch 5 taken 6429225 times.
|
6491457 | else if(action==swimming || action==swimhit || hopclk==0xFF) |
| 2872 | { | ||
| 2873 |
2/2✓ Branch 0 taken 15239 times.
✓ Branch 1 taken 46993 times.
|
62232 | if (get_qr(qr_COPIED_SWIM_SPRITES)) |
| 2874 | { | ||
| 2875 | 15239 | herotile(&tile, &flip, &extend, ls_walk, dir, zinit.heroAnimationStyle); | |
| 2876 | 15239 | } | |
| 2877 | else | ||
| 2878 | { | ||
| 2879 | 46993 | herotile(&tile, &flip, &extend, is_moving()?ls_swim:ls_float, dir, zinit.heroAnimationStyle); | |
| 2880 | } | ||
| 2881 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 62232 times.
|
62232 | if(advancetile) tile += anim_3_4(lstep,7)*(extend==2?2:1); |
| 2882 | |||
| 2883 |
2/2✓ Branch 0 taken 56358 times.
✓ Branch 1 taken 5874 times.
|
62232 | if(isDiving()) |
| 2884 | { | ||
| 2885 |
2/2✓ Branch 0 taken 840 times.
✓ Branch 1 taken 5034 times.
|
5874 | if (get_qr(qr_COPIED_SWIM_SPRITES)) |
| 2886 | { | ||
| 2887 | 840 | herotile(&tile, &flip, &extend, ls_walk, dir, zinit.heroAnimationStyle); | |
| 2888 | 840 | } | |
| 2889 | else | ||
| 2890 | { | ||
| 2891 | 5034 | herotile(&tile, &flip, &extend, ls_dive, dir, zinit.heroAnimationStyle); | |
| 2892 | } | ||
| 2893 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5874 times.
|
5874 | if(advancetile) tile += anim_3_4(lstep,7)*(extend==2?2:1); |
| 2894 | 5874 | } | |
| 2895 | 62232 | } | |
| 2896 |
3/4✓ Branch 0 taken 32285 times.
✓ Branch 1 taken 6396940 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 32285 times.
|
6429225 | else if(charging > 0 && attack != wHammer) |
| 2897 | { | ||
| 2898 | 32285 | herotile(&tile, &flip, &extend, (IsSideSwim())?ls_sideswimcharge:ls_charge, dir, zinit.heroAnimationStyle); | |
| 2899 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32285 times.
|
32285 | if(advancetile) tile += anim_3_4(lstep,7)*(extend==2?2:1); |
| 2900 | 32285 | } | |
| 2901 |
8/10✓ Branch 0 taken 6378855 times.
✓ Branch 1 taken 18085 times.
✓ Branch 2 taken 6378855 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 16366 times.
✓ Branch 5 taken 6380574 times.
✓ Branch 6 taken 10422 times.
✓ Branch 7 taken 5944 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 10422 times.
|
6396940 | else if((z>0 || fakez>0 || isSideViewHero()) && jumping2>0 && jumping2<24 && game->get_life()>0) |
| 2902 | { | ||
| 2903 | 10422 | herotile(&tile, &flip, &extend, ls_jump, dir, zinit.heroAnimationStyle); | |
| 2904 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 10353 times.
|
10422 | if(advancetile) tile+=((int32_t)jumping2/8)*(extend==2?2:1); |
| 2905 | 10422 | } | |
| 2906 |
2/2✓ Branch 0 taken 1610 times.
✓ Branch 1 taken 6384908 times.
|
6386518 | else if(fallclk>0) |
| 2907 | { | ||
| 2908 | 1610 | herotile(&tile, &flip, &extend, ls_falling, dir, zinit.heroAnimationStyle); | |
| 2909 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1610 times.
|
1610 | if(advancetile) tile += ((PITFALL_FALL_FRAMES-fallclk)/10)*(extend==2?2:1); |
| 2910 | 1610 | } | |
| 2911 |
5/6✓ Branch 0 taken 407379 times.
✓ Branch 1 taken 5977529 times.
✓ Branch 2 taken 289 times.
✓ Branch 3 taken 407090 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 289 times.
|
6384908 | else if(!noliftspr&&action==lifting&&isLifting()) |
| 2912 | { | ||
| 2913 | 289 | herotile(&tile, &flip, &extend, ls_lifting, dir, zinit.heroAnimationStyle); | |
| 2914 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 289 times.
|
289 | if(script_hero_sprite <= 0) |
| 2915 | { | ||
| 2916 | 289 | auto frames = vbound(liftingspr[dir][spr_frames],1,255); | |
| 2917 | 289 | auto speed = tliftclk/frames; | |
| 2918 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 289 times.
|
289 | if (speed < 1) speed = 1; |
| 2919 | 289 | auto curframe = (tliftclk - liftclk) / speed; | |
| 2920 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 289 times.
|
289 | if (!tliftclk) curframe = frames - 1; |
| 2921 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 289 times.
|
289 | if(unsigned(curframe) < frames) |
| 2922 | 289 | tile += curframe * (extend == 2 ? 2 : 1); | |
| 2923 | 289 | } | |
| 2924 | 289 | } | |
| 2925 | else | ||
| 2926 | { | ||
| 2927 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6384619 times.
|
6384619 | if(IsSideSwim()) |
| 2928 | ✗ | herotile(&tile, &flip, &extend, ls_sideswim, dir, zinit.heroAnimationStyle); | |
| 2929 | else | ||
| 2930 | { | ||
| 2931 |
4/4✓ Branch 0 taken 407090 times.
✓ Branch 1 taken 5977529 times.
✓ Branch 2 taken 405351 times.
✓ Branch 3 taken 1739 times.
|
6384619 | if(!noliftspr&&isLifting()) |
| 2932 | 1739 | herotile(&tile, &flip, &extend, ls_liftwalk, dir, zinit.heroAnimationStyle); | |
| 2933 | 6382880 | else herotile(&tile, &flip, &extend, ls_walk, dir, zinit.heroAnimationStyle); | |
| 2934 | } | ||
| 2935 | |||
| 2936 |
2/2✓ Branch 0 taken 1820208 times.
✓ Branch 1 taken 4564411 times.
|
6384619 | if(dir > up) |
| 2937 | { | ||
| 2938 | 4564411 | useltm=true; | |
| 2939 | 4564411 | shieldModify=true; | |
| 2940 | 4564411 | } | |
| 2941 |
2/2✓ Branch 0 taken 6489 times.
✓ Branch 1 taken 6378130 times.
|
6384619 | if(advancetile) tile += anim_3_4(lstep,7)*(extend==2?2:1); |
| 2942 | } | ||
| 2943 | |||
| 2944 | 6494401 | break; | |
| 2945 | |||
| 2946 | case las_zelda3slow: //8-frame Zelda 3 (slow) | ||
| 2947 | case las_zelda3: //8-frame Zelda 3 | ||
| 2948 | ✗ | if(action == drowning) | |
| 2949 | { | ||
| 2950 | ✗ | if(inwater) | |
| 2951 | { | ||
| 2952 | ✗ | herotile(&tile, &flip, &extend, (drownclk > 60) ? ls_float : ls_drown, dir, zinit.heroAnimationStyle); | |
| 2953 | ✗ | if (script_hero_sprite <= 0 ) tile += anim_3_4(lstep,7)*(extend==2?2:1); | |
| 2954 | ✗ | } | |
| 2955 | else | ||
| 2956 | { | ||
| 2957 | ✗ | goto herodraw_end; | |
| 2958 | } | ||
| 2959 | ✗ | } | |
| 2960 | ✗ | else if(action == lavadrowning) | |
| 2961 | { | ||
| 2962 | ✗ | herotile(&tile, &flip, &extend, (drownclk > 60) ? ls_float : ls_lavadrown, dir, zinit.heroAnimationStyle); | |
| 2963 | ✗ | if (script_hero_sprite <= 0 ) tile += anim_3_4(lstep,7)*(extend==2?2:1); | |
| 2964 | |||
| 2965 | ✗ | } | |
| 2966 | ✗ | else if(action == sidedrowning) | |
| 2967 | { | ||
| 2968 | ✗ | herotile(&tile, &flip, &extend, ls_sidedrown, down, zinit.heroAnimationStyle); | |
| 2969 | ✗ | if (script_hero_sprite <= 0 ) tile += anim_3_4(lstep,7)*(extend==2?2:1); | |
| 2970 | ✗ | } | |
| 2971 | ✗ | else if (action == sideswimming || action == sideswimhit) | |
| 2972 | { | ||
| 2973 | ✗ | herotile(&tile, &flip, &extend, ls_sideswim, dir, zinit.heroAnimationStyle); | |
| 2974 | |||
| 2975 | ✗ | if (script_hero_sprite <= 0 ) tile += anim_3_4(lstep,7)*(extend==2?2:1); | |
| 2976 | ✗ | } | |
| 2977 | ✗ | else if(action == swimming || action==swimhit || hopclk==0xFF) | |
| 2978 | { | ||
| 2979 | ✗ | herotile(&tile, &flip, &extend, is_moving()?ls_swim:ls_float, dir, zinit.heroAnimationStyle); | |
| 2980 | ✗ | if (script_hero_sprite <= 0 ) tile += anim_3_4(lstep,7)*(extend==2?2:1); | |
| 2981 | |||
| 2982 | ✗ | if(isDiving()) | |
| 2983 | { | ||
| 2984 | ✗ | herotile(&tile, &flip, &extend, ls_dive, dir, zinit.heroAnimationStyle); | |
| 2985 | ✗ | if (script_hero_sprite <= 0 ) tile += anim_3_4(lstep,7)*(extend==2?2:1); | |
| 2986 | ✗ | } | |
| 2987 | ✗ | } | |
| 2988 | ✗ | else if(charging > 0 && attack != wHammer) | |
| 2989 | { | ||
| 2990 | ✗ | herotile(&tile, &flip, &extend, (IsSideSwim())?ls_sideswimcharge:ls_charge, dir, zinit.heroAnimationStyle); | |
| 2991 | ✗ | if (script_hero_sprite <= 0 ) tile+=(extend==2?2:1); | |
| 2992 | //int32_t l=hero_count/hero_animation_speed; | ||
| 2993 | ✗ | int32_t l=(hero_count/hero_animation_speed)&15; | |
| 2994 | //int32_t l=((p[lt_clock]/hero_animation_speed)&15); | ||
| 2995 | ✗ | l-=((l>3)?1:0)+((l>12)?1:0); | |
| 2996 | ✗ | if (script_hero_sprite <= 0 ) tile+=(l/2)*(extend==2?2:1); | |
| 2997 | ✗ | } | |
| 2998 | ✗ | else if((z>0 || fakez>0 || isSideViewHero()) && jumping2>0 && jumping2<24 && game->get_life()>0) | |
| 2999 | { | ||
| 3000 | ✗ | herotile(&tile, &flip, &extend, ls_jump, dir, zinit.heroAnimationStyle); | |
| 3001 | ✗ | if (script_hero_sprite <= 0 ) tile+=((int32_t)jumping2/8)*(extend==2?2:1); | |
| 3002 | ✗ | } | |
| 3003 | ✗ | else if(fallclk>0) | |
| 3004 | { | ||
| 3005 | ✗ | herotile(&tile, &flip, &extend, ls_falling, dir, zinit.heroAnimationStyle); | |
| 3006 | ✗ | if (script_hero_sprite <= 0 ) tile += ((PITFALL_FALL_FRAMES-fallclk)/10)*(extend==2?2:1); | |
| 3007 | ✗ | } | |
| 3008 | ✗ | else if(!noliftspr&&action==lifting&&isLifting()) | |
| 3009 | { | ||
| 3010 | ✗ | herotile(&tile, &flip, &extend, ls_lifting, dir, zinit.heroAnimationStyle); | |
| 3011 | ✗ | if(script_hero_sprite <= 0) | |
| 3012 | { | ||
| 3013 | ✗ | auto frames = vbound(liftingspr[dir][spr_frames],1,255); | |
| 3014 | ✗ | auto speed = tliftclk/frames; | |
| 3015 | ✗ | if (speed < 1) speed = 1; | |
| 3016 | ✗ | auto curframe = (tliftclk-liftclk)/speed; | |
| 3017 | ✗ | if (!tliftclk) curframe = frames - 1; | |
| 3018 | ✗ | if(unsigned(curframe) < frames) | |
| 3019 | ✗ | tile += curframe * (extend == 2 ? 2 : 1); | |
| 3020 | ✗ | } | |
| 3021 | ✗ | } | |
| 3022 | else | ||
| 3023 | { | ||
| 3024 | ✗ | if(IsSideSwim()) | |
| 3025 | ✗ | herotile(&tile, &flip, &extend, ls_sideswim, dir, zinit.heroAnimationStyle); | |
| 3026 | else | ||
| 3027 | { | ||
| 3028 | ✗ | if(!noliftspr&&isLifting()) | |
| 3029 | ✗ | herotile(&tile, &flip, &extend, ls_liftwalk, dir, zinit.heroAnimationStyle); | |
| 3030 | ✗ | else herotile(&tile, &flip, &extend, ls_walk, dir, zinit.heroAnimationStyle); | |
| 3031 | } | ||
| 3032 | |||
| 3033 | ✗ | if(advancetile && (action == walking || action == climbcoverbottom || action == climbcovertop)) | |
| 3034 | { | ||
| 3035 | ✗ | tile += (extend == 2 ? 2 : 1); | |
| 3036 | ✗ | } | |
| 3037 | |||
| 3038 | ✗ | if(dir>up) | |
| 3039 | { | ||
| 3040 | ✗ | useltm=true; | |
| 3041 | ✗ | shieldModify=true; | |
| 3042 | ✗ | } | |
| 3043 | |||
| 3044 | ✗ | if(advancetile && (action == walking || action == hopping || action == climbcoverbottom || action == climbcovertop)) | |
| 3045 | { | ||
| 3046 | //tile+=(extend==2?2:1); | ||
| 3047 | //tile+=(((active_count>>2)%8)*(extend==2?2:1)); | ||
| 3048 | ✗ | int32_t l = hero_count / hero_animation_speed; | |
| 3049 | ✗ | l -= ((l > 3) ? 1 : 0) + ((l > 12) ? 1 : 0); | |
| 3050 | ✗ | tile += (l / 2) * (extend == 2 ? 2 : 1); | |
| 3051 | ✗ | } | |
| 3052 | } | ||
| 3053 | |||
| 3054 | ✗ | break; | |
| 3055 | |||
| 3056 | default: | ||
| 3057 | ✗ | break; | |
| 3058 | } | ||
| 3059 | 14937962 | } | |
| 3060 | |||
| 3061 |
6/6✓ Branch 0 taken 6689403 times.
✓ Branch 1 taken 8251406 times.
✓ Branch 2 taken 4246459 times.
✓ Branch 3 taken 2442944 times.
✓ Branch 4 taken 170841 times.
✓ Branch 5 taken 4075618 times.
|
14940809 | yofs = oyofs-((!BSZ && isdungeon() && currscr<128 && !get_qr(qr_HERODUNGEONPOSFIX)) ? 2 : 0); |
| 3062 | |||
| 3063 |
2/2✓ Branch 0 taken 14937505 times.
✓ Branch 1 taken 3304 times.
|
14940809 | if(action==won) |
| 3064 | { | ||
| 3065 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3304 times.
|
3304 | yofs=(get_qr(qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) - 2; |
| 3066 | 3304 | } | |
| 3067 | |||
| 3068 |
4/4✓ Branch 0 taken 14785713 times.
✓ Branch 1 taken 155096 times.
✓ Branch 2 taken 92822 times.
✓ Branch 3 taken 14692891 times.
|
14940809 | if(action==landhold1 || action==landhold2) |
| 3069 | { | ||
| 3070 | 247918 | useltm=(get_qr(qr_EXPANDEDLTM) != 0); | |
| 3071 |
6/6✓ Branch 0 taken 106761 times.
✓ Branch 1 taken 141157 times.
✓ Branch 2 taken 80905 times.
✓ Branch 3 taken 25856 times.
✓ Branch 4 taken 14607 times.
✓ Branch 5 taken 66298 times.
|
247918 | yofs = oyofs-((!BSZ && isdungeon() && currscr<128 && !get_qr(qr_HERODUNGEONPOSFIX)) ? 2 : 0); |
| 3072 | 247918 | herotile(&tile, &flip, &extend, (action==landhold1)?ls_landhold1:ls_landhold2, dir, zinit.heroAnimationStyle); | |
| 3073 | 247918 | } | |
| 3074 |
4/4✓ Branch 0 taken 14691536 times.
✓ Branch 1 taken 1355 times.
✓ Branch 2 taken 859 times.
✓ Branch 3 taken 14690677 times.
|
14692891 | else if(action==waterhold1 || action==waterhold2) |
| 3075 | { | ||
| 3076 | 2214 | useltm=(get_qr(qr_EXPANDEDLTM) != 0); | |
| 3077 | 2214 | herotile(&tile, &flip, &extend, (action==waterhold1)?ls_waterhold1:ls_waterhold2, dir, zinit.heroAnimationStyle); | |
| 3078 | 2214 | } | |
| 3079 |
2/4✓ Branch 0 taken 14690677 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 14690677 times.
|
14690677 | else if(action==sidewaterhold1 || action==sidewaterhold2) |
| 3080 | { | ||
| 3081 | ✗ | useltm=(get_qr(qr_EXPANDEDLTM) != 0); | |
| 3082 | ✗ | herotile(&tile, &flip, &extend, (action==sidewaterhold1)?ls_sidewaterhold1:ls_sidewaterhold2, dir, zinit.heroAnimationStyle); | |
| 3083 | ✗ | } | |
| 3084 | |||
| 3085 |
3/4✓ Branch 0 taken 14937962 times.
✓ Branch 1 taken 2847 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 14937962 times.
|
14940809 | if(action!=casting && action!=sideswimcasting) |
| 3086 | { | ||
| 3087 |
2/2✓ Branch 0 taken 2633095 times.
✓ Branch 1 taken 12304867 times.
|
14937962 | if(useltm) |
| 3088 | { | ||
| 3089 |
2/2✓ Branch 0 taken 6558 times.
✓ Branch 1 taken 12298309 times.
|
12304867 | if (script_hero_sprite <= 0 ) tile+=getTileModifier(); |
| 3090 | 12304867 | } | |
| 3091 | 14937962 | } | |
| 3092 | |||
| 3093 | // Stone of Agony | ||
| 3094 |
2/2✓ Branch 0 taken 14940777 times.
✓ Branch 1 taken 32 times.
|
14940809 | if(agony) |
| 3095 | { | ||
| 3096 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | yofs-=!(frame%zc_max(60-itemsbuf[agonyid].misc1,3))?1:0; |
| 3097 | 32 | } | |
| 3098 | |||
| 3099 |
2/2✓ Branch 0 taken 63499 times.
✓ Branch 1 taken 14877310 times.
|
14940809 | if(is_hitflickerframe()) |
| 3100 | { | ||
| 3101 |
4/6✓ Branch 0 taken 181 times.
✓ Branch 1 taken 63318 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 181 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 63318 times.
|
63499 | int32_t temp_flicker_color = (game->get_life() > 0 || immortal) ? (flickercolor < 0 ? game->get_spriteflickercolor() : flickercolor) : 0; |
| 3102 |
2/4✓ Branch 0 taken 63499 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 63499 times.
✗ Branch 3 not taken.
|
63499 | if((game->get_spriteflickercolor() || temp_flicker_color) && !superman) |
| 3103 | { | ||
| 3104 | ✗ | sprite_flicker_transp_passes = (flickertransp < 0 ? game->get_spriteflickertransp() : flickertransp); | |
| 3105 | ✗ | sprite_flicker_color = temp_flicker_color; | |
| 3106 | ✗ | masked_draw(dest); | |
| 3107 | ✗ | } | |
| 3108 | 63499 | } | |
| 3109 | else | ||
| 3110 | 14877310 | masked_draw(dest); | |
| 3111 | |||
| 3112 | //draw held items after Hero so they don't go behind his head | ||
| 3113 |
4/4✓ Branch 0 taken 14785713 times.
✓ Branch 1 taken 155096 times.
✓ Branch 2 taken 92822 times.
✓ Branch 3 taken 14692891 times.
|
14940809 | if(action==landhold1 || action==landhold2) |
| 3114 | { | ||
| 3115 |
2/2✓ Branch 0 taken 22 times.
✓ Branch 1 taken 247896 times.
|
247918 | if(holditem > -1) |
| 3116 | { | ||
| 3117 |
2/2✓ Branch 0 taken 136407 times.
✓ Branch 1 taken 111489 times.
|
247896 | if(get_qr(qr_HOLDITEMANIMATION)) |
| 3118 | { | ||
| 3119 | 136407 | putitem2(dest,x-((action==landhold1)?4:0),y+yofs-16-(get_qr(qr_NOITEMOFFSET))-fakez-z,holditem,lens_hint_item[holditem][0], lens_hint_item[holditem][1], 0); | |
| 3120 | 136407 | } | |
| 3121 | else | ||
| 3122 | { | ||
| 3123 | 111489 | putitem(dest,x-((action==landhold1)?4:0),y+yofs-16-(get_qr(qr_NOITEMOFFSET))-fakez-z,holditem); | |
| 3124 | } | ||
| 3125 | 247896 | } | |
| 3126 | 247918 | } | |
| 3127 |
4/4✓ Branch 0 taken 14691536 times.
✓ Branch 1 taken 1355 times.
✓ Branch 2 taken 859 times.
✓ Branch 3 taken 14690677 times.
|
14692891 | else if(action==waterhold1 || action==waterhold2) |
| 3128 | { | ||
| 3129 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2214 times.
|
2214 | if(holditem > -1) |
| 3130 | { | ||
| 3131 |
2/2✓ Branch 0 taken 1562 times.
✓ Branch 1 taken 652 times.
|
2214 | if(get_qr(qr_HOLDITEMANIMATION)) |
| 3132 | { | ||
| 3133 | 1562 | putitem2(dest,x-((action==waterhold1)?4:0),y+yofs-12-(get_qr(qr_NOITEMOFFSET))-fakez-z,holditem,lens_hint_item[holditem][0], lens_hint_item[holditem][1], 0); | |
| 3134 | 1562 | } | |
| 3135 | else | ||
| 3136 | { | ||
| 3137 | 652 | putitem(dest,x-((action==waterhold1)?4:0),y+yofs-12-(get_qr(qr_NOITEMOFFSET))-fakez-z,holditem); | |
| 3138 | } | ||
| 3139 | 2214 | } | |
| 3140 | 2214 | } | |
| 3141 |
2/4✓ Branch 0 taken 14690677 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 14690677 times.
|
14690677 | else if(action==sidewaterhold1 || action==sidewaterhold2) //!DIMITODO: Check to see if this looks right or if it needs waterhold's offset. |
| 3142 | { | ||
| 3143 | ✗ | if(holditem > -1) | |
| 3144 | { | ||
| 3145 | ✗ | if(get_qr(qr_HOLDITEMANIMATION)) | |
| 3146 | { | ||
| 3147 | ✗ | putitem2(dest,x-((action==sidewaterhold1)?4:0),y+yofs-16-(get_qr(qr_NOITEMOFFSET))-fakez-z,holditem,lens_hint_item[holditem][0], lens_hint_item[holditem][1], 0); | |
| 3148 | ✗ | } | |
| 3149 | else | ||
| 3150 | { | ||
| 3151 | ✗ | putitem(dest,x-((action==sidewaterhold1)?4:0),y+yofs-16-(get_qr(qr_NOITEMOFFSET))-fakez-z,holditem); | |
| 3152 | } | ||
| 3153 | ✗ | } | |
| 3154 | ✗ | } | |
| 3155 |
4/4✓ Branch 0 taken 23254 times.
✓ Branch 1 taken 14917555 times.
✓ Branch 2 taken 5125 times.
✓ Branch 3 taken 18129 times.
|
14940809 | if(fairyclk==0||(get_qr(qr_NOHEARTRING))) |
| 3156 | { | ||
| 3157 | 14922680 | goto herodraw_end; | |
| 3158 | } | ||
| 3159 | |||
| 3160 | 18129 | double a2 = fairyclk*4.5 + 90; | |
| 3161 | 18129 | int32_t hearts=0; | |
| 3162 | 18129 | int32_t htile = 2; | |
| 3163 | |||
| 3164 | 18129 | do | |
| 3165 | { | ||
| 3166 | 110312 | int32_t nx=125; | |
| 3167 | |||
| 3168 |
2/2✓ Branch 0 taken 64232 times.
✓ Branch 1 taken 46080 times.
|
110312 | if(get_qr(qr_HEARTRINGFIX)) |
| 3169 | { | ||
| 3170 | 46080 | nx=x; | |
| 3171 | 46080 | } | |
| 3172 | |||
| 3173 | 110312 | int32_t ny=88; | |
| 3174 | |||
| 3175 |
2/2✓ Branch 0 taken 64232 times.
✓ Branch 1 taken 46080 times.
|
110312 | if(get_qr(qr_HEARTRINGFIX)) |
| 3176 | { | ||
| 3177 | 46080 | ny=y; | |
| 3178 | 46080 | } | |
| 3179 | |||
| 3180 | 110312 | int32_t tx = zc::math::CosD(a2)*53 +nx; | |
| 3181 | 110312 | int32_t ty = -zc::math::SinD(a2)*53 +ny+playing_field_offset; | |
| 3182 | 110312 | overtile8(dest,htile,tx,ty,1,0); | |
| 3183 | 110312 | a2-=45; | |
| 3184 | 110312 | ++hearts; | |
| 3185 |
2/2✓ Branch 0 taken 92183 times.
✓ Branch 1 taken 18129 times.
|
220624 | } |
| 3186 |
2/2✓ Branch 0 taken 9920 times.
✓ Branch 1 taken 100392 times.
|
110312 | while(a2>90 && hearts<8); |
| 3187 | 18129 | } | |
| 3188 | herodraw_end: | ||
| 3189 | 16688623 | xofs=oxofs; | |
| 3190 | 16688623 | yofs=oyofs; | |
| 3191 | 16688623 | do_primitives(dest, SPLAYER_PLAYER_DRAW, tmpscr, 0, playing_field_offset); | |
| 3192 | 16688623 | } | |
| 3193 | |||
| 3194 | 16344590 | void HeroClass::masked_draw(BITMAP* dest) | |
| 3195 | { | ||
| 3196 | // The first sprite::draw in this function uses sprite_flicker_color | ||
| 3197 | // This is intended to be the player, handle this if this changes. -Moosh | ||
| 3198 | 16344590 | zfix lz, lfz; | |
| 3199 |
2/2✓ Branch 0 taken 16333381 times.
✓ Branch 1 taken 11209 times.
|
16344590 | if(lift_wpn) |
| 3200 | { | ||
| 3201 | 11209 | lz = lift_wpn->z; | |
| 3202 | 11209 | lfz = lift_wpn->fakez; | |
| 3203 | 11209 | } | |
| 3204 | |||
| 3205 |
12/12✓ Branch 0 taken 6912581 times.
✓ Branch 1 taken 9432009 times.
✓ Branch 2 taken 6666363 times.
✓ Branch 3 taken 246218 times.
✓ Branch 4 taken 6573166 times.
✓ Branch 5 taken 93197 times.
✓ Branch 6 taken 6478852 times.
✓ Branch 7 taken 94314 times.
✓ Branch 8 taken 6341505 times.
✓ Branch 9 taken 137347 times.
✓ Branch 10 taken 6464406 times.
✓ Branch 11 taken 201957 times.
|
16344590 | if(isdungeon() && currscr<128 && (x<16 || x>224 || y<18 || y>146) && !get_qr(qr_FREEFORM)) |
| 3206 | { | ||
| 3207 | // clip under doorways | ||
| 3208 | 201957 | BITMAP *sub=create_sub_bitmap(dest,16,playing_field_offset+16,224,144); | |
| 3209 | |||
| 3210 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 201957 times.
|
201957 | if(sub!=NULL) |
| 3211 | { | ||
| 3212 | 201957 | yofs -= (playing_field_offset+16); | |
| 3213 | 201957 | xofs -= 16; | |
| 3214 | 201957 | sprite::draw(sub); | |
| 3215 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 201957 times.
|
201957 | if(lift_wpn) |
| 3216 | { | ||
| 3217 | ✗ | handle_lift(false); | |
| 3218 | ✗ | bool shad = lift_wpn->has_shadow; | |
| 3219 | ✗ | lift_wpn->has_shadow = false; | |
| 3220 | ✗ | lift_wpn->z += z; | |
| 3221 | ✗ | lift_wpn->fakez += fakez; | |
| 3222 | ✗ | lift_wpn->draw(sub); | |
| 3223 | ✗ | lift_wpn->has_shadow = shad; | |
| 3224 | ✗ | } | |
| 3225 | 201957 | prompt_draw(sub); | |
| 3226 | 201957 | xofs+=16; | |
| 3227 | 201957 | yofs += (playing_field_offset+16); | |
| 3228 | 201957 | destroy_bitmap(sub); | |
| 3229 | 201957 | } | |
| 3230 | 201957 | } | |
| 3231 | else | ||
| 3232 | { | ||
| 3233 | 16142633 | sprite::draw(dest); | |
| 3234 |
2/2✓ Branch 0 taken 16131424 times.
✓ Branch 1 taken 11209 times.
|
16142633 | if(lift_wpn) |
| 3235 | { | ||
| 3236 | 11209 | handle_lift(false); | |
| 3237 | 11209 | bool shad = lift_wpn->has_shadow; | |
| 3238 | 11209 | lift_wpn->has_shadow = false; | |
| 3239 | 11209 | lift_wpn->z += z; | |
| 3240 | 11209 | lift_wpn->fakez += fakez; | |
| 3241 | 11209 | lift_wpn->draw(dest); | |
| 3242 | 11209 | lift_wpn->has_shadow = shad; | |
| 3243 | 11209 | } | |
| 3244 | 16142633 | prompt_draw(dest); | |
| 3245 | } | ||
| 3246 | |||
| 3247 |
2/2✓ Branch 0 taken 16333381 times.
✓ Branch 1 taken 11209 times.
|
16344590 | if(lift_wpn) |
| 3248 | { | ||
| 3249 | 11209 | lift_wpn->z = lz; | |
| 3250 | 11209 | lift_wpn->fakez = lfz; | |
| 3251 | 11209 | } | |
| 3252 | 16344590 | return; | |
| 3253 | } | ||
| 3254 | 16344590 | void HeroClass::prompt_draw(BITMAP* dest) | |
| 3255 | { | ||
| 3256 |
2/2✓ Branch 0 taken 16334977 times.
✓ Branch 1 taken 9613 times.
|
16344590 | if(!prompt_combo) return; |
| 3257 | 9613 | int32_t sx = real_x(x+xofs+prompt_x); | |
| 3258 | 9613 | int32_t sy = real_y(y + yofs + prompt_y) - real_z(z + zofs); | |
| 3259 | 9613 | sy -= fake_z(fakez); | |
| 3260 | 9613 | overcombo(dest, sx, sy, prompt_combo, prompt_cset); | |
| 3261 | 9613 | return; | |
| 3262 | 16344590 | } | |
| 3263 | |||
| 3264 | 21258 | void collectitem_script(int32_t id) | |
| 3265 | { | ||
| 3266 |
2/2✓ Branch 0 taken 20961 times.
✓ Branch 1 taken 297 times.
|
21258 | if(itemsbuf[id].collect_script) |
| 3267 | { | ||
| 3268 | //clear item script stack. | ||
| 3269 | 297 | FFCore.ref(ScriptType::Item, -id).Clear(); | |
| 3270 | |||
| 3271 |
2/6✓ Branch 0 taken 297 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 297 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
297 | if ( id > 0 && !(FFCore.doscript(ScriptType::Item, -id) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING)) ) //No collect script on item 0. |
| 3272 | { | ||
| 3273 | 297 | int i = -id; | |
| 3274 | 297 | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 3275 | 297 | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[id].collect_script, i); | |
| 3276 | 297 | FFCore.deallocateAllScriptOwned(ScriptType::Item, i); | |
| 3277 | 297 | } | |
| 3278 | ✗ | else if (id == 0 && !(FFCore.doscript(ScriptType::Item, -id) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING))) //item 0 | |
| 3279 | { | ||
| 3280 | ✗ | int i = COLLECT_SCRIPT_ITEM_ZERO; | |
| 3281 | ✗ | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 3282 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[id].collect_script, i); | |
| 3283 | ✗ | FFCore.deallocateAllScriptOwned(ScriptType::Item, i); | |
| 3284 | ✗ | } | |
| 3285 | //runningItemScripts[id] = 0; | ||
| 3286 | 297 | } | |
| 3287 | 21258 | } | |
| 3288 | 2031 | void passiveitem_script(int32_t id, bool doRun = false) | |
| 3289 | { | ||
| 3290 | //Passive item scripts on colelction | ||
| 3291 |
3/6✓ Branch 0 taken 60 times.
✓ Branch 1 taken 1971 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 60 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
2031 | if(itemsbuf[id].script && ( (itemsbuf[id].flags&item_passive_script) && (get_qr(qr_ITEMSCRIPTSKEEPRUNNING)) )) |
| 3292 | { | ||
| 3293 | ✗ | FFCore.reset_script_engine_data(ScriptType::Item, id); | |
| 3294 | |||
| 3295 | ✗ | if(get_qr(qr_PASSIVE_ITEM_SCRIPT_ONLY_HIGHEST) | |
| 3296 | ✗ | && current_item(itemsbuf[id].family) > itemsbuf[id].fam_type) | |
| 3297 | { | ||
| 3298 | ✗ | FFCore.doscript(ScriptType::Item, id) = false; | |
| 3299 | ✗ | return; | |
| 3300 | } | ||
| 3301 | ✗ | if(doRun) | |
| 3302 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[id].script, id); | |
| 3303 | ✗ | } | |
| 3304 | 2031 | } | |
| 3305 | |||
| 3306 | // separate case for sword/wand/hammer/slashed weapons only | ||
| 3307 | // the main weapon checking is in the global function check_collisions() | ||
| 3308 | 14151802 | bool HeroClass::checkstab() | |
| 3309 | { | ||
| 3310 |
14/14✓ Branch 0 taken 12532063 times.
✓ Branch 1 taken 1619739 times.
✓ Branch 2 taken 364352 times.
✓ Branch 3 taken 1255387 times.
✓ Branch 4 taken 338883 times.
✓ Branch 5 taken 25469 times.
✓ Branch 6 taken 274524 times.
✓ Branch 7 taken 64359 times.
✓ Branch 8 taken 274496 times.
✓ Branch 9 taken 28 times.
✓ Branch 10 taken 253177 times.
✓ Branch 11 taken 21319 times.
✓ Branch 12 taken 374173 times.
✓ Branch 13 taken 992389 times.
|
14151802 | if(action!=attacking && action!=sideswimattacking || (attack!=wSword && attack!=wWand && attack!=wHammer && attack!=wCByrna && attack!=wFire && attack != wBugNet) |
| 3311 | 1619739 | || (attackclk<=4)) | |
| 3312 | 13159413 | return false; | |
| 3313 | |||
| 3314 | 992389 | weapon *w=NULL; | |
| 3315 | |||
| 3316 | 992389 | int32_t wx=0,wy=0,wz=0,wxsz=0,wysz=0; | |
| 3317 | 992389 | bool found = false; | |
| 3318 | 992389 | int32_t melee_weapon_index = 0; | |
| 3319 | 992389 | int32_t parentitem=-1; | |
| 3320 | 992389 | weapon* meleeweap = nullptr; | |
| 3321 |
2/2✓ Branch 0 taken 60613 times.
✓ Branch 1 taken 1102826 times.
|
1163439 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 3322 | { | ||
| 3323 | 1102826 | w = (weapon*)Lwpns.spr(i); | |
| 3324 | |||
| 3325 |
6/6✓ Branch 0 taken 1102788 times.
✓ Branch 1 taken 38 times.
✓ Branch 2 taken 19001 times.
✓ Branch 3 taken 1083787 times.
✓ Branch 4 taken 171050 times.
✓ Branch 5 taken 931776 times.
|
1102826 | if(w->id == (attack==wCByrna || attack==wFire ? wWand : attack)) // Kludge: Byrna and Candle sticks are wWand-type. |
| 3326 | { | ||
| 3327 | 931776 | found = true; | |
| 3328 | 931776 | melee_weapon_index = i+1; | |
| 3329 | 931776 | meleeweap = w; | |
| 3330 | // Position the sword as Hero slashes with it. | ||
| 3331 |
4/4✓ Branch 0 taken 876400 times.
✓ Branch 1 taken 55376 times.
✓ Branch 2 taken 114 times.
✓ Branch 3 taken 876286 times.
|
931776 | if(w->id!=wHammer&&w->id!=wBugNet) |
| 3332 | 876286 | positionSword(w,w->parentitem); | |
| 3333 | |||
| 3334 | 931776 | wx=w->x; | |
| 3335 | 931776 | wy=w->y; | |
| 3336 | 931776 | wz=w->z; | |
| 3337 | 931776 | wxsz = w->hit_width; | |
| 3338 | 931776 | wysz = w->hit_height; | |
| 3339 | 931776 | parentitem = w->parentitem; | |
| 3340 | 931776 | break; | |
| 3341 | } | ||
| 3342 | 171050 | } | |
| 3343 | |||
| 3344 |
6/6✓ Branch 0 taken 904075 times.
✓ Branch 1 taken 88314 times.
✓ Branch 2 taken 134885 times.
✓ Branch 3 taken 769190 times.
✓ Branch 4 taken 39264 times.
✓ Branch 5 taken 95621 times.
|
992389 | if(attack==wSword && attackclk>=14 && charging==0) |
| 3345 | 95621 | return false; | |
| 3346 | |||
| 3347 |
2/2✓ Branch 0 taken 836155 times.
✓ Branch 1 taken 60613 times.
|
896768 | if(!found) |
| 3348 | 60613 | return false; | |
| 3349 | |||
| 3350 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 835732 times.
|
836155 | if(attack == wFire) |
| 3351 | 423 | return false; | |
| 3352 | |||
| 3353 |
2/2✓ Branch 0 taken 780356 times.
✓ Branch 1 taken 55376 times.
|
835732 | if(attack==wHammer) |
| 3354 | { | ||
| 3355 |
2/2✓ Branch 0 taken 21946 times.
✓ Branch 1 taken 33430 times.
|
55376 | if(attackclk<15) |
| 3356 | { | ||
| 3357 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 3427 times.
✓ Branch 2 taken 5263 times.
✓ Branch 3 taken 7197 times.
✓ Branch 4 taken 6059 times.
|
21946 | switch(w->dir) |
| 3358 | { | ||
| 3359 | case up: | ||
| 3360 | 3427 | wx=x-1; | |
| 3361 | 3427 | wy=y-4; | |
| 3362 | 3427 | break; | |
| 3363 | |||
| 3364 | case down: | ||
| 3365 | 5263 | wx=x+8; | |
| 3366 | 5263 | wy=y+28; | |
| 3367 | 5263 | break; // This is consistent with 2.10 | |
| 3368 | |||
| 3369 | case left: | ||
| 3370 | 7197 | wx=x-13; | |
| 3371 | 7197 | wy=y+14; | |
| 3372 | 7197 | break; | |
| 3373 | |||
| 3374 | case right: | ||
| 3375 | 6059 | wx=x+21; | |
| 3376 | 6059 | wy=y+14; | |
| 3377 | 6059 | break; | |
| 3378 | } | ||
| 3379 | |||
| 3380 |
6/8✓ Branch 0 taken 2170 times.
✓ Branch 1 taken 19776 times.
✓ Branch 2 taken 2170 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2170 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5 times.
✓ Branch 7 taken 2165 times.
|
21946 | if(attackclk==12 && z==0 && fakez==0 && sideviewhammerpound()) |
| 3381 | { | ||
| 3382 | //decorations.add(new dHammerSmack((zfix)wx, (zfix)wy, dHAMMERSMACK, 0)); | ||
| 3383 | /* The hammer smack sprites weren't being positioned properly if Hero changed directions on the same frame that they are created. | ||
| 3384 | switch(dir) | ||
| 3385 | { | ||
| 3386 | case up: | ||
| 3387 | decorations.add(new dHammerSmack(x-1, y-4, dHAMMERSMACK, 0)); | ||
| 3388 | break; | ||
| 3389 | |||
| 3390 | case down: | ||
| 3391 | decorations.add(new dHammerSmack(x+8, y+28, dHAMMERSMACK, 0)); | ||
| 3392 | break; | ||
| 3393 | |||
| 3394 | case left: | ||
| 3395 | decorations.add(new dHammerSmack(x-13, y+14, dHAMMERSMACK, 0)); | ||
| 3396 | break; | ||
| 3397 | |||
| 3398 | case right: | ||
| 3399 | decorations.add(new dHammerSmack(x+21, y+14, dHAMMERSMACK, 0)); | ||
| 3400 | break; | ||
| 3401 | } | ||
| 3402 | */ | ||
| 3403 | 2165 | } | |
| 3404 | |||
| 3405 | 21946 | return false; | |
| 3406 | } | ||
| 3407 |
2/2✓ Branch 0 taken 31300 times.
✓ Branch 1 taken 2130 times.
|
33430 | else if(attackclk==15) |
| 3408 | { | ||
| 3409 | // Hammer's reach needs adjusted slightly for backward compatibility | ||
| 3410 |
2/2✓ Branch 0 taken 1793 times.
✓ Branch 1 taken 337 times.
|
2130 | if(w->dir==up) |
| 3411 | 337 | w->hyofs-=1; | |
| 3412 |
2/2✓ Branch 0 taken 1097 times.
✓ Branch 1 taken 696 times.
|
1793 | else if(w->dir==left) |
| 3413 | 696 | w->hxofs-=2; | |
| 3414 | 2130 | } | |
| 3415 | 33430 | } | |
| 3416 | |||
| 3417 | // The return of Spaghetti Code Constants! | ||
| 3418 |
6/6✓ Branch 0 taken 16297 times.
✓ Branch 1 taken 797489 times.
✓ Branch 2 taken 763927 times.
✓ Branch 3 taken 33562 times.
✓ Branch 4 taken 18 times.
✓ Branch 5 taken 33544 times.
|
813786 | int32_t itype = (attack==wWand ? itype_wand : attack==wSword ? itype_sword : attack==wCByrna ? itype_cbyrna : attack==wBugNet ? itype_bugnet : itype_hammer); |
| 3419 |
4/4✓ Branch 0 taken 80798 times.
✓ Branch 1 taken 732988 times.
✓ Branch 2 taken 28 times.
✓ Branch 3 taken 80770 times.
|
813786 | int32_t itemid = (directWpn>-1 && itemsbuf[directWpn].family==itype) ? directWpn : current_item_id(itype); |
| 3420 | 813786 | itemid = vbound(itemid, 0, MAXITEMS-1); | |
| 3421 | |||
| 3422 | // The sword offsets aren't based on anything other than what felt about right | ||
| 3423 | // compared to the NES game and what mostly kept it from hitting things that | ||
| 3424 | // should clearly be out of range. They could probably still use more tweaking. | ||
| 3425 | // Don't use 2.10 for reference; it's pretty far off. | ||
| 3426 | // - Saf | ||
| 3427 | |||
| 3428 |
6/6✓ Branch 0 taken 431413 times.
✓ Branch 1 taken 382373 times.
✓ Branch 2 taken 24750 times.
✓ Branch 3 taken 406663 times.
✓ Branch 4 taken 405892 times.
✓ Branch 5 taken 25521 times.
|
813786 | if(game->get_canslash() && (attack==wSword || attack==wWand) && itemsbuf[itemid].flags & item_flag4) |
| 3429 | { | ||
| 3430 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 70674 times.
✓ Branch 2 taken 89080 times.
✓ Branch 3 taken 125048 times.
✓ Branch 4 taken 121090 times.
|
405892 | switch(w->dir) |
| 3431 | { | ||
| 3432 | case up: | ||
| 3433 |
2/2✓ Branch 0 taken 48286 times.
✓ Branch 1 taken 22388 times.
|
70674 | if(attackclk<8) |
| 3434 | { | ||
| 3435 | 22388 | wy-=4; | |
| 3436 | 22388 | } | |
| 3437 | |||
| 3438 | 70674 | break; | |
| 3439 | |||
| 3440 | case down: | ||
| 3441 | //if(attackclk<8) | ||
| 3442 | { | ||
| 3443 | 89080 | wy-=2; | |
| 3444 | } | ||
| 3445 | 89080 | break; | |
| 3446 | |||
| 3447 | case left: | ||
| 3448 | |||
| 3449 | //if(attackclk<8) | ||
| 3450 | { | ||
| 3451 | 125048 | wx+=2; | |
| 3452 | } | ||
| 3453 | |||
| 3454 | 125048 | break; | |
| 3455 | |||
| 3456 | case right: | ||
| 3457 | |||
| 3458 | //if(attackclk<8) | ||
| 3459 | { | ||
| 3460 | 121090 | wx-=3; | |
| 3461 | //wy+=((spins>0 || get_qr(qr_SLASHFLIPFIX)) ? -4 : 4); | ||
| 3462 | } | ||
| 3463 | |||
| 3464 | 121090 | break; | |
| 3465 | } | ||
| 3466 | 405892 | } | |
| 3467 | |||
| 3468 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 165130 times.
✓ Branch 2 taken 175929 times.
✓ Branch 3 taken 236576 times.
✓ Branch 4 taken 236151 times.
|
813786 | switch(w->dir) |
| 3469 | { | ||
| 3470 | case up: | ||
| 3471 | 165130 | wx+=2; | |
| 3472 | 165130 | break; | |
| 3473 | |||
| 3474 | case down: | ||
| 3475 | 175929 | break; | |
| 3476 | |||
| 3477 | case left: | ||
| 3478 | 236576 | wy-=3; | |
| 3479 | 236576 | break; | |
| 3480 | |||
| 3481 | case right: | ||
| 3482 | 236151 | wy-=3; | |
| 3483 | 236151 | break; | |
| 3484 | } | ||
| 3485 | |||
| 3486 | 813786 | wx+=w->hxofs; | |
| 3487 | 813786 | wy+=w->hyofs; | |
| 3488 | 813786 | wy-=(w->fakez).getInt(); | |
| 3489 | |||
| 3490 |
2/2✓ Branch 0 taken 807357 times.
✓ Branch 1 taken 3490883 times.
|
4298240 | for(int32_t i=0; i<guys.Count(); i++) |
| 3491 | { | ||
| 3492 |
2/2✓ Branch 0 taken 3490788 times.
✓ Branch 1 taken 95 times.
|
3490883 | if(attack==wBugNet) break; |
| 3493 | // So that Hero can actually hit peahats while jumping, his weapons' hzsz becomes 16 in midair. | ||
| 3494 |
6/6✓ Branch 0 taken 74095 times.
✓ Branch 1 taken 3416693 times.
✓ Branch 2 taken 73500 times.
✓ Branch 3 taken 595 times.
✓ Branch 4 taken 71823 times.
✓ Branch 5 taken 1677 times.
|
3491344 | if((guys.spr(i)->hit(wx,wy,wz,wxsz,wysz,wz>0?16:8) && ((attack!=wWand && attack!=wHammer && attack!=wCByrna) || !(itemsbuf[itemid].flags & item_flag3))) |
| 3495 |
5/6✓ Branch 0 taken 708 times.
✓ Branch 1 taken 2506 times.
✓ Branch 2 taken 3313553 times.
✓ Branch 3 taken 103848 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 3417401 times.
|
3418965 | || ((attack==wWand || attack==wCByrna) && guys.spr(i)->hit(wx,wy-8,z,16,24,z>8) && !(itemsbuf[itemid].flags & item_flag3)) |
| 3496 |
4/4✓ Branch 0 taken 120214 times.
✓ Branch 1 taken 3297187 times.
✓ Branch 2 taken 556 times.
✓ Branch 3 taken 119658 times.
|
3417401 | || (attack==wHammer && guys.spr(i)->hit(wx,wy-8,z,16,24,z>0?16:8) && !(itemsbuf[itemid].flags & item_flag3))) |
| 3497 | { | ||
| 3498 | // Checking the whimsical ring for every collision check causes | ||
| 3499 | // an odd bug. It's much more likely to activate on a 0-damage | ||
| 3500 | // weapon, since a 0-damage hit won't make the enemy invulnerable | ||
| 3501 | // to damaging hits in the following frames. | ||
| 3502 | |||
| 3503 | 74329 | int32_t whimsyid = current_item_id(itype_whimsicalring); | |
| 3504 | |||
| 3505 | 74329 | int32_t dmg = weaponattackpower(itemid); | |
| 3506 |
2/2✓ Branch 0 taken 72420 times.
✓ Branch 1 taken 1909 times.
|
74329 | if(whimsyid>-1) |
| 3507 | { | ||
| 3508 |
3/4✓ Branch 0 taken 1909 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1793 times.
✓ Branch 3 taken 116 times.
|
1909 | if(!(zc_oldrand()%zc_max(itemsbuf[whimsyid].misc1,1))) |
| 3509 | 116 | dmg += current_item_power(itype_whimsicalring); | |
| 3510 | 1793 | else whimsyid = -1; | |
| 3511 | 1909 | } | |
| 3512 | 74329 | int32_t atkringid = current_item_id(itype_atkring); | |
| 3513 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 74321 times.
|
74329 | if(atkringid>-1) |
| 3514 | { | ||
| 3515 | 8 | dmg *= itemsbuf[atkringid].misc2; //Multiplier | |
| 3516 | 8 | dmg += itemsbuf[atkringid].misc1; //Additive | |
| 3517 | 8 | } | |
| 3518 | |||
| 3519 | 74329 | int32_t h = hit_enemy(i,attack,dmg*game->get_hero_dmgmult(),wx,wy,dir,directWpn,w); | |
| 3520 | 74329 | enemy *e = (enemy*)guys.spr(i); | |
| 3521 |
2/2✓ Branch 0 taken 25189 times.
✓ Branch 1 taken 49140 times.
|
74329 | if (h == -1) |
| 3522 | { | ||
| 3523 | 49140 | e->hitby[HIT_BY_LWEAPON] = melee_weapon_index; | |
| 3524 | 49140 | e->hitby[HIT_BY_LWEAPON_UID] = w->script_UID; | |
| 3525 | 49140 | e->hitby[HIT_BY_LWEAPON_TYPE] = w->id; | |
| 3526 |
1/2✓ Branch 0 taken 49140 times.
✗ Branch 1 not taken.
|
49140 | if (w->parentitem > -1) e->hitby[HIT_BY_LWEAPON_PARENT_FAMILY] = itemsbuf[w->parentitem].family; |
| 3527 | ✗ | else e->hitby[HIT_BY_LWEAPON_PARENT_FAMILY] = -1; | |
| 3528 | 49140 | e->hitby[HIT_BY_LWEAPON_PARENT_ID] = w->parentitem; | |
| 3529 | 49140 | e->hitby[HIT_BY_LWEAPON_ENGINE_UID] = w->getUID(); | |
| 3530 | 49140 | } //temp_hit = true; } | |
| 3531 | //melee weapons and non-melee weapons both writing to this index may be a problem. It needs to be cleared by something earlier than this check. | ||
| 3532 | |||
| 3533 |
4/4✓ Branch 0 taken 49140 times.
✓ Branch 1 taken 25189 times.
✓ Branch 2 taken 45 times.
✓ Branch 3 taken 49095 times.
|
74329 | if(h<0 && whimsyid>-1) |
| 3534 | { | ||
| 3535 | 45 | sfx(itemsbuf[whimsyid].usesound); | |
| 3536 | 45 | } | |
| 3537 | |||
| 3538 |
4/4✓ Branch 0 taken 63085 times.
✓ Branch 1 taken 11244 times.
✓ Branch 2 taken 62605 times.
✓ Branch 3 taken 480 times.
|
74329 | if(h && charging>0) |
| 3539 | { | ||
| 3540 | 480 | attackclk = SWORDTAPFRAME; | |
| 3541 | 480 | spins=0; | |
| 3542 | 480 | } | |
| 3543 | |||
| 3544 |
8/8✓ Branch 0 taken 63085 times.
✓ Branch 1 taken 11244 times.
✓ Branch 2 taken 53449 times.
✓ Branch 3 taken 9636 times.
✓ Branch 4 taken 53415 times.
✓ Branch 5 taken 34 times.
✓ Branch 6 taken 1216 times.
✓ Branch 7 taken 52199 times.
|
74329 | if(h && hclk==0 && inlikelike != 1 && !get_qr(qr_DYING_ENEMIES_IGNORE_STUN)) |
| 3545 | { | ||
| 3546 |
2/2✓ Branch 0 taken 52042 times.
✓ Branch 1 taken 157 times.
|
52199 | if(GuyHit(i,x+7,y+7-fakez,z,2,2,hzsz)!=-1) |
| 3547 | { | ||
| 3548 | 157 | hithero(i); | |
| 3549 | 157 | } | |
| 3550 | 52199 | } | |
| 3551 | |||
| 3552 |
2/2✓ Branch 0 taken 67053 times.
✓ Branch 1 taken 7276 times.
|
74329 | if(h==2) |
| 3553 | 7276 | break; | |
| 3554 | 67053 | } | |
| 3555 | 3484454 | } | |
| 3556 | |||
| 3557 |
2/2✓ Branch 0 taken 18938 times.
✓ Branch 1 taken 794734 times.
|
1628400 | if(attack == wBugNet |
| 3558 |
3/4✓ Branch 0 taken 813672 times.
✓ Branch 1 taken 1056 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 813672 times.
|
814728 | || (parentitem==-1&&!get_qr(qr_NOITEMMELEE)) |
| 3559 |
1/2✓ Branch 0 taken 813672 times.
✗ Branch 1 not taken.
|
813672 | || (parentitem>-1&&!(itemsbuf[parentitem].flags & item_flag7))) |
| 3560 | { | ||
| 3561 |
3/4✓ Branch 0 taken 795676 times.
✓ Branch 1 taken 114 times.
✓ Branch 2 taken 114 times.
✗ Branch 3 not taken.
|
795790 | int32_t bugnetid = attack != wBugNet ? -1 : (parentitem > -1 ? parentitem : current_item_id(itype_bugnet)); |
| 3562 |
2/2✓ Branch 0 taken 795790 times.
✓ Branch 1 taken 254215 times.
|
1050005 | for(int32_t j=0; j<items.Count(); j++) |
| 3563 | { | ||
| 3564 | 254215 | item* ptr = (item*)items.spr(j); | |
| 3565 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 254195 times.
|
254216 | bool dofairy = (attack==wBugNet && itemsbuf[ptr->id].family == itype_fairy) |
| 3566 |
3/4✓ Branch 0 taken 19 times.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
|
20 | && (bugnetid > -1 && !(itemsbuf[bugnetid].flags & item_flag1)); |
| 3567 | |||
| 3568 |
2/4✓ Branch 0 taken 254215 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 254215 times.
✗ Branch 3 not taken.
|
254215 | if((itemsbuf[ptr->id].family == itype_bottlefill || dofairy) && !game->canFillBottle()) |
| 3569 | ✗ | continue; //No picking these up unless you have a bottle to fill! | |
| 3570 |
5/6✓ Branch 0 taken 254188 times.
✓ Branch 1 taken 27 times.
✓ Branch 2 taken 46889 times.
✓ Branch 3 taken 207299 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 46889 times.
|
254215 | if((ptr->pickup & ipCANGRAB) || (ptr->pickup & ipTIMER) || dofairy) |
| 3571 | { | ||
| 3572 |
7/8✓ Branch 0 taken 207299 times.
✓ Branch 1 taken 27 times.
✓ Branch 2 taken 96779 times.
✓ Branch 3 taken 110520 times.
✓ Branch 4 taken 110547 times.
✓ Branch 5 taken 96779 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 110547 times.
|
207326 | if(((ptr->pickup & ipCANGRAB) || ptr->clk2 >= 32 || dofairy) && !ptr->fallclk && !ptr->drownclk) |
| 3573 | { | ||
| 3574 |
6/6✓ Branch 0 taken 103623 times.
✓ Branch 1 taken 6924 times.
✓ Branch 2 taken 981 times.
✓ Branch 3 taken 102642 times.
✓ Branch 4 taken 103608 times.
✓ Branch 5 taken 6939 times.
|
214167 | if(ptr->hit(wx,wy,z,wxsz,wysz,1) || (attack==wWand && ptr->hit(x,y-8-fakez,z,wxsz,wysz,1)) |
| 3575 |
4/4✓ Branch 0 taken 3 times.
✓ Branch 1 taken 978 times.
✓ Branch 2 taken 100869 times.
✓ Branch 3 taken 2751 times.
|
103623 | || (attack==wHammer && ptr->hit(x,y-8-fakez,z,wxsz,wysz,1))) |
| 3576 | { | ||
| 3577 | 6939 | int32_t pickup = ptr->pickup; | |
| 3578 | 6939 | int32_t id2 = ptr->id; | |
| 3579 | 6939 | int32_t pstr = ptr->pstring; | |
| 3580 | 6939 | int32_t pstr_flags = ptr->pickup_string_flags; | |
| 3581 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 6938 times.
|
6939 | if(!dofairy) |
| 3582 | { | ||
| 3583 | 6938 | std::vector<int32_t> &ev = FFCore.eventData; | |
| 3584 | 6938 | ev.clear(); | |
| 3585 | 6938 | ev.push_back(id2*10000); | |
| 3586 | 6938 | ev.push_back(pickup*10000); | |
| 3587 | 6938 | ev.push_back(pstr*10000); | |
| 3588 | 6938 | ev.push_back(pstr_flags*10000); | |
| 3589 | 6938 | ev.push_back(0); | |
| 3590 | 6938 | ev.push_back(ptr->getUID()); | |
| 3591 | 6938 | ev.push_back(GENEVT_ICTYPE_MELEE*10000); | |
| 3592 | 6938 | ev.push_back(w->getUID()); | |
| 3593 | |||
| 3594 | 6938 | throwGenScriptEvent(GENSCR_EVENT_COLLECT_ITEM); | |
| 3595 | 6938 | bool nullify = ev[4] != 0; | |
| 3596 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6938 times.
|
6938 | if(nullify) continue; |
| 3597 | 6938 | id2 = ev[0]/10000; | |
| 3598 | 6938 | pickup = (pickup&(ipCHECK|ipDUMMY)) | (ev[1]/10000); | |
| 3599 | 6938 | pstr = ev[2] / 10000; | |
| 3600 | 6938 | pstr_flags = ev[3] / 10000; | |
| 3601 | 6938 | } | |
| 3602 | |||
| 3603 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6939 times.
|
6939 | if(pickup&ipONETIME) // set mITEM for one-time-only items |
| 3604 | ✗ | setmapflag(mITEM); | |
| 3605 |
1/2✓ Branch 0 taken 6939 times.
✗ Branch 1 not taken.
|
6939 | else if(pickup&ipONETIME2) // set mSPECIALITEM flag for other one-time-only items |
| 3606 | ✗ | setmapflag((currscr < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM); | |
| 3607 | |||
| 3608 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 6939 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
6939 | if(ptr->pickupexstate > -1 && ptr->pickupexstate < 32) |
| 3609 | ✗ | setxmapflag(1<<ptr->pickupexstate); | |
| 3610 |
1/2✓ Branch 0 taken 6939 times.
✗ Branch 1 not taken.
|
6939 | if(pickup&ipSECRETS) // Trigger secrets if this item has the secret pickup |
| 3611 | { | ||
| 3612 | ✗ | if(tmpscr->flags9&fITEMSECRETPERM) setmapflag(mSECRET); | |
| 3613 | ✗ | hidden_entrance(0, true, false, -5); | |
| 3614 | ✗ | } | |
| 3615 | //!DIMI | ||
| 3616 | |||
| 3617 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 6938 times.
|
6939 | if(dofairy) |
| 3618 | { | ||
| 3619 | 1 | game->fillBottle(itemsbuf[ptr->id].misc4); | |
| 3620 | 1 | } | |
| 3621 | else | ||
| 3622 | { | ||
| 3623 | 6938 | collectitem_script(id2); | |
| 3624 | |||
| 3625 | 6938 | getitem(id2, ptr->noSound, true); | |
| 3626 | } | ||
| 3627 | 6939 | items.del(j); | |
| 3628 | |||
| 3629 |
2/2✓ Branch 0 taken 7995 times.
✓ Branch 1 taken 6939 times.
|
14934 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 3630 | { | ||
| 3631 | 7995 | weapon *w2 = (weapon*)Lwpns.spr(i); | |
| 3632 | |||
| 3633 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7995 times.
|
7995 | if(w2->dragging==j) |
| 3634 | { | ||
| 3635 | ✗ | w2->dragging=-1; | |
| 3636 | ✗ | } | |
| 3637 |
1/2✓ Branch 0 taken 7995 times.
✗ Branch 1 not taken.
|
7995 | else if(w2->dragging>j) |
| 3638 | { | ||
| 3639 | ✗ | w2->dragging-=1; | |
| 3640 | ✗ | } | |
| 3641 | 7995 | } | |
| 3642 | |||
| 3643 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 6939 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
6939 | if ( (pstr > 0 && pstr < msg_count) ) |
| 3644 | { | ||
| 3645 | ✗ | if ( ( (!(pstr_flags&itemdataPSTRING_IP_HOLDUP)) && ( pstr_flags&itemdataPSTRING_NOMARK || pstr_flags&itemdataPSTRING_ALWAYS || (!(FFCore.GetItemMessagePlayed(id2))) ) ) ) | |
| 3646 | { | ||
| 3647 | ✗ | if ( (!(pstr_flags&itemdataPSTRING_NOMARK)) ) | |
| 3648 | ✗ | FFCore.SetItemMessagePlayed(id2); | |
| 3649 | ✗ | donewmsg(pstr); | |
| 3650 | ✗ | break; | |
| 3651 | } | ||
| 3652 | ✗ | } | |
| 3653 | |||
| 3654 | 6939 | --j; | |
| 3655 | 6939 | } | |
| 3656 | 110547 | } | |
| 3657 | 207326 | } | |
| 3658 | 254215 | } | |
| 3659 | 795790 | } | |
| 3660 | |||
| 3661 |
4/4✓ Branch 0 taken 813768 times.
✓ Branch 1 taken 960 times.
✓ Branch 2 taken 114 times.
✓ Branch 3 taken 813654 times.
|
814728 | if(attack==wCByrna || attack==wBugNet) |
| 3662 | 1074 | return false; | |
| 3663 | |||
| 3664 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 813654 times.
|
813654 | if(meleeweap->no_triggers()) |
| 3665 | ✗ | return false; | |
| 3666 | |||
| 3667 |
2/2✓ Branch 0 taken 763927 times.
✓ Branch 1 taken 49727 times.
|
813654 | if(attack==wSword) |
| 3668 | { | ||
| 3669 |
2/2✓ Branch 0 taken 677792 times.
✓ Branch 1 taken 86135 times.
|
763927 | if(attackclk == 6) |
| 3670 | { | ||
| 3671 |
2/2✓ Branch 0 taken 15159760 times.
✓ Branch 1 taken 86135 times.
|
15245895 | for(int32_t q=0; q<176; q++) |
| 3672 | { | ||
| 3673 | 15159760 | set_bit(screengrid,q,0); | |
| 3674 | 15159760 | set_bit(screengrid_layer[0],q,0); | |
| 3675 | 15159760 | set_bit(screengrid_layer[1],q,0); | |
| 3676 | 15159760 | } | |
| 3677 | |||
| 3678 |
2/2✓ Branch 0 taken 1378160 times.
✓ Branch 1 taken 86135 times.
|
1464295 | for(dword q = MAXFFCS/8; q > 0; --q) |
| 3679 | 1378160 | ffcgrid[q-1] = 0; | |
| 3680 | 86135 | } | |
| 3681 | |||
| 3682 |
4/4✓ Branch 0 taken 156755 times.
✓ Branch 1 taken 607172 times.
✓ Branch 2 taken 72500 times.
✓ Branch 3 taken 84255 times.
|
763927 | if(dir==up && ((x.getInt()&15)==0)) |
| 3683 | { | ||
| 3684 | 72500 | check_slash_block(wx,wy); | |
| 3685 | 72500 | check_slash_block(wx,wy+8); | |
| 3686 | |||
| 3687 | //layers | ||
| 3688 | 72500 | check_slash_block_layer(wx,wy,1); | |
| 3689 | 72500 | check_slash_block_layer(wx,wy+8,1); | |
| 3690 | 72500 | check_slash_block_layer(wx,wy,1); | |
| 3691 | 72500 | check_slash_block_layer(wx,wy+8,1); | |
| 3692 | //2 | ||
| 3693 | 72500 | check_slash_block_layer(wx,wy,2); | |
| 3694 | 72500 | check_slash_block_layer(wx,wy+8,2); | |
| 3695 | 72500 | check_slash_block_layer(wx,wy,2); | |
| 3696 | 72500 | check_slash_block_layer(wx,wy+8,2); | |
| 3697 | 72500 | } | |
| 3698 |
8/10✓ Branch 0 taken 84255 times.
✓ Branch 1 taken 607172 times.
✓ Branch 2 taken 26086 times.
✓ Branch 3 taken 58169 times.
✓ Branch 4 taken 240 times.
✓ Branch 5 taken 25846 times.
✓ Branch 6 taken 240 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 240 times.
|
691427 | else if(dir==up && ((x.getInt()&15)==8||diagonalMovement||NO_GRIDLOCK)) |
| 3699 | { | ||
| 3700 | 84015 | check_slash_block(wx,wy); | |
| 3701 | 84015 | check_slash_block(wx,wy+8); | |
| 3702 | 84015 | check_slash_block(wx+8,wy); | |
| 3703 | 84015 | check_slash_block(wx+8,wy+8); | |
| 3704 | ///layer 1 | ||
| 3705 | 84015 | check_slash_block_layer(wx,wy,1); | |
| 3706 | 84015 | check_slash_block_layer(wx,wy+8,1); | |
| 3707 | 84015 | check_slash_block_layer(wx+8,wy,1); | |
| 3708 | 84015 | check_slash_block_layer(wx+8,wy+8,1); | |
| 3709 | ///layer 2 | ||
| 3710 | 84015 | check_slash_block_layer(wx,wy,2); | |
| 3711 | 84015 | check_slash_block_layer(wx,wy+8,2); | |
| 3712 | 84015 | check_slash_block_layer(wx+8,wy,2); | |
| 3713 | 84015 | check_slash_block_layer(wx+8,wy+8,2); | |
| 3714 | 84015 | } | |
| 3715 |
4/4✓ Branch 0 taken 165479 times.
✓ Branch 1 taken 598448 times.
✓ Branch 2 taken 86439 times.
✓ Branch 3 taken 79040 times.
|
763927 | if(dir==down && ((x.getInt()&15)==0)) |
| 3716 | { | ||
| 3717 | 79040 | check_slash_block(wx,wy+wysz-8); | |
| 3718 | 79040 | check_slash_block(wx,wy+wysz); | |
| 3719 | |||
| 3720 | //layer 1 | ||
| 3721 | 79040 | check_slash_block_layer(wx,wy+wysz-8,1); | |
| 3722 | 79040 | check_slash_block_layer(wx,wy+wysz,1); | |
| 3723 | //layer 2 | ||
| 3724 | 79040 | check_slash_block_layer(wx,wy+wysz-8,2); | |
| 3725 | 79040 | check_slash_block_layer(wx,wy+wysz,2); | |
| 3726 | 79040 | } | |
| 3727 |
8/10✓ Branch 0 taken 86439 times.
✓ Branch 1 taken 598448 times.
✓ Branch 2 taken 34908 times.
✓ Branch 3 taken 51531 times.
✓ Branch 4 taken 333 times.
✓ Branch 5 taken 34575 times.
✓ Branch 6 taken 333 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 333 times.
|
684887 | else if(dir==down && ((x.getInt()&15)==8||diagonalMovement||NO_GRIDLOCK)) |
| 3728 | { | ||
| 3729 | 86106 | check_slash_block(wx,wy+wysz-8); | |
| 3730 | 86106 | check_slash_block(wx,wy+wysz); | |
| 3731 | 86106 | check_slash_block(wx+8,wy+wysz-8); | |
| 3732 | 86106 | check_slash_block(wx+8,wy+wysz); | |
| 3733 | //layer 1 | ||
| 3734 | 86106 | check_slash_block_layer(wx,wy+wysz-8,1); | |
| 3735 | 86106 | check_slash_block_layer(wx,wy+wysz,1); | |
| 3736 | 86106 | check_slash_block_layer(wx+8,wy+wysz-8,1); | |
| 3737 | 86106 | check_slash_block_layer(wx+8,wy+wysz,1); | |
| 3738 | //layer 2 | ||
| 3739 | 86106 | check_slash_block_layer(wx,wy+wysz-8,2); | |
| 3740 | 86106 | check_slash_block_layer(wx,wy+wysz,2); | |
| 3741 | 86106 | check_slash_block_layer(wx+8,wy+wysz-8,2); | |
| 3742 | 86106 | check_slash_block_layer(wx+8,wy+wysz,2); | |
| 3743 | 86106 | } | |
| 3744 | |||
| 3745 |
2/2✓ Branch 0 taken 544407 times.
✓ Branch 1 taken 219520 times.
|
763927 | if(dir==left) |
| 3746 | { | ||
| 3747 | 219520 | check_slash_block(wx,wy+8); | |
| 3748 | 219520 | check_slash_block(wx+8,wy+8); | |
| 3749 | //layer 1 | ||
| 3750 | 219520 | check_slash_block_layer(wx,wy+8,1); | |
| 3751 | 219520 | check_slash_block_layer(wx+8,wy+8,1); | |
| 3752 | //layer 2 | ||
| 3753 | 219520 | check_slash_block_layer(wx,wy+8,2); | |
| 3754 | 219520 | check_slash_block_layer(wx+8,wy+8,2); | |
| 3755 | 219520 | } | |
| 3756 | |||
| 3757 |
2/2✓ Branch 0 taken 541754 times.
✓ Branch 1 taken 222173 times.
|
763927 | if(dir==right) |
| 3758 | { | ||
| 3759 | 222173 | check_slash_block(wx+wxsz,wy+8); | |
| 3760 | 222173 | check_slash_block(wx+wxsz-8,wy+8); | |
| 3761 | //layer 1 | ||
| 3762 | 222173 | check_slash_block_layer(wx+wxsz,wy+8,1); | |
| 3763 | 222173 | check_slash_block_layer(wx+wxsz-8,wy+8,1); | |
| 3764 | //layer 2 | ||
| 3765 | 222173 | check_slash_block_layer(wx+wxsz,wy+8,2); | |
| 3766 | 222173 | check_slash_block_layer(wx+wxsz-8,wy+8,2); | |
| 3767 | 222173 | } | |
| 3768 | 763927 | } | |
| 3769 |
2/2✓ Branch 0 taken 16297 times.
✓ Branch 1 taken 33430 times.
|
49727 | else if(attack==wWand) |
| 3770 | { | ||
| 3771 |
1/2✓ Branch 0 taken 16297 times.
✗ Branch 1 not taken.
|
16297 | if(attackclk == 5) |
| 3772 | { | ||
| 3773 | ✗ | for(int32_t q=0; q<176; q++) | |
| 3774 | { | ||
| 3775 | ✗ | set_bit(screengrid,q,0); | |
| 3776 | ✗ | set_bit(screengrid_layer[0],q,0); | |
| 3777 | ✗ | set_bit(screengrid_layer[1],q,0); | |
| 3778 | ✗ | } | |
| 3779 | |||
| 3780 | ✗ | for(dword q = MAXFFCS/8; q > 0; --q) | |
| 3781 | ✗ | ffcgrid[q-1] = 0; | |
| 3782 | ✗ | } | |
| 3783 | |||
| 3784 | // cutable blocks | ||
| 3785 |
4/4✓ Branch 0 taken 3074 times.
✓ Branch 1 taken 13223 times.
✓ Branch 2 taken 1386 times.
✓ Branch 3 taken 1688 times.
|
16297 | if(dir==up && (x.getInt()&15)==0) |
| 3786 | { | ||
| 3787 | 1386 | check_wand_block(wx,wy); | |
| 3788 | 1386 | check_wand_block(wx,wy+8); | |
| 3789 | 1386 | } | |
| 3790 |
5/10✓ Branch 0 taken 1688 times.
✓ Branch 1 taken 13223 times.
✓ Branch 2 taken 813 times.
✓ Branch 3 taken 875 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 813 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
14911 | else if(dir==up && ((x.getInt()&15)==8||diagonalMovement||NO_GRIDLOCK)) |
| 3791 | { | ||
| 3792 | 1688 | check_wand_block(wx,wy); | |
| 3793 | 1688 | check_wand_block(wx,wy+8); | |
| 3794 | 1688 | check_wand_block(wx+8,wy); | |
| 3795 | 1688 | check_wand_block(wx+8,wy+8); | |
| 3796 | 1688 | } | |
| 3797 | |||
| 3798 |
4/4✓ Branch 0 taken 2366 times.
✓ Branch 1 taken 13931 times.
✓ Branch 2 taken 1135 times.
✓ Branch 3 taken 1231 times.
|
16297 | if(dir==down && (x.getInt()&15)==0) |
| 3799 | { | ||
| 3800 | 1231 | check_wand_block(wx,wy+wysz-8); | |
| 3801 | 1231 | check_wand_block(wx,wy+wysz); | |
| 3802 | 1231 | } | |
| 3803 |
5/10✓ Branch 0 taken 1135 times.
✓ Branch 1 taken 13931 times.
✓ Branch 2 taken 307 times.
✓ Branch 3 taken 828 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 307 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
15066 | else if(dir==down && ((x.getInt()&15)==8||diagonalMovement||NO_GRIDLOCK)) |
| 3804 | { | ||
| 3805 | 1135 | check_wand_block(wx,wy+wysz-8); | |
| 3806 | 1135 | check_wand_block(wx,wy+wysz); | |
| 3807 | 1135 | check_wand_block(wx+8,wy+wysz-8); | |
| 3808 | 1135 | check_wand_block(wx+8,wy+wysz); | |
| 3809 | 1135 | } | |
| 3810 | |||
| 3811 |
2/2✓ Branch 0 taken 10184 times.
✓ Branch 1 taken 6113 times.
|
16297 | if(dir==left) |
| 3812 | { | ||
| 3813 | 6113 | check_wand_block(wx,y+8); | |
| 3814 | 6113 | check_wand_block(wx+8,y+8); | |
| 3815 | 6113 | } | |
| 3816 | |||
| 3817 |
2/2✓ Branch 0 taken 11553 times.
✓ Branch 1 taken 4744 times.
|
16297 | if(dir==right) |
| 3818 | { | ||
| 3819 | 4744 | check_wand_block(wx+wxsz,y+8); | |
| 3820 | 4744 | check_wand_block(wx+wxsz-8,y+8); | |
| 3821 | 4744 | } | |
| 3822 | 16297 | } | |
| 3823 |
4/8✓ Branch 0 taken 33430 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 31300 times.
✓ Branch 3 taken 2130 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 31300 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
33430 | else if((attack==wHammer) && ((attackclk==15) || ( spins>0 && attackclk >=15 ))) |
| 3824 | { | ||
| 3825 | // poundable blocks | ||
| 3826 |
2/2✓ Branch 0 taken 374880 times.
✓ Branch 1 taken 2130 times.
|
377010 | for(int32_t q=0; q<176; q++) |
| 3827 | { | ||
| 3828 | 374880 | set_bit(screengrid,q,0); | |
| 3829 | 374880 | set_bit(screengrid_layer[0],q,0); | |
| 3830 | 374880 | set_bit(screengrid_layer[1],q,0); | |
| 3831 | 374880 | } | |
| 3832 | |||
| 3833 |
2/2✓ Branch 0 taken 34080 times.
✓ Branch 1 taken 2130 times.
|
36210 | for(dword q = MAXFFCS/8; q > 0; --q) |
| 3834 | 34080 | ffcgrid[q-1] = 0; | |
| 3835 | |||
| 3836 |
4/4✓ Branch 0 taken 338 times.
✓ Branch 1 taken 1792 times.
✓ Branch 2 taken 174 times.
✓ Branch 3 taken 164 times.
|
2130 | if(dir==up && (x.getInt()&15)==0) |
| 3837 | { | ||
| 3838 | 164 | check_pound_block(wx,wy); | |
| 3839 | 164 | check_pound_block(wx,wy+8); | |
| 3840 | 164 | } | |
| 3841 |
5/10✓ Branch 0 taken 174 times.
✓ Branch 1 taken 1792 times.
✓ Branch 2 taken 47 times.
✓ Branch 3 taken 127 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 47 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
1966 | else if(dir==up && ((x.getInt()&15)==8||diagonalMovement||NO_GRIDLOCK)) |
| 3842 | { | ||
| 3843 | 174 | check_pound_block(wx,wy); | |
| 3844 | 174 | check_pound_block(wx,wy+8); | |
| 3845 | 174 | check_pound_block(wx+8,wy); | |
| 3846 | 174 | check_pound_block(wx+8,wy+8); | |
| 3847 | 174 | } | |
| 3848 | |||
| 3849 |
4/4✓ Branch 0 taken 498 times.
✓ Branch 1 taken 1632 times.
✓ Branch 2 taken 258 times.
✓ Branch 3 taken 240 times.
|
2130 | if(dir==down && (x.getInt()&15)==0) |
| 3850 | { | ||
| 3851 | 240 | check_pound_block(wx,wy+wysz-8); | |
| 3852 | 240 | check_pound_block(wx,wy+wysz); | |
| 3853 | 240 | } | |
| 3854 |
8/10✓ Branch 0 taken 258 times.
✓ Branch 1 taken 1632 times.
✓ Branch 2 taken 106 times.
✓ Branch 3 taken 152 times.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 105 times.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
|
1890 | else if(dir==down && ((x.getInt()&15)==8||diagonalMovement||NO_GRIDLOCK)) |
| 3855 | { | ||
| 3856 | 257 | check_pound_block(wx,wy+wysz-8); | |
| 3857 | 257 | check_pound_block(wx,wy+wysz); | |
| 3858 | 257 | check_pound_block(wx+8,wy+wysz-8); | |
| 3859 | 257 | check_pound_block(wx+8,wy+wysz); | |
| 3860 | 257 | } | |
| 3861 | |||
| 3862 |
2/2✓ Branch 0 taken 1429 times.
✓ Branch 1 taken 701 times.
|
2130 | if(dir==left) |
| 3863 | { | ||
| 3864 | 701 | check_pound_block(wx,y+8); | |
| 3865 | 701 | check_pound_block(wx+8,y+8); | |
| 3866 | 701 | } | |
| 3867 | |||
| 3868 |
2/2✓ Branch 0 taken 1537 times.
✓ Branch 1 taken 593 times.
|
2130 | if(dir==right) |
| 3869 | { | ||
| 3870 | 593 | check_pound_block(wx+wxsz,y+8); | |
| 3871 | 593 | check_pound_block(wx+wxsz-8,y+8); | |
| 3872 | 593 | } | |
| 3873 | 2130 | } | |
| 3874 | 31300 | else return false; | |
| 3875 | |||
| 3876 | 782354 | return true; | |
| 3877 | 14152744 | } | |
| 3878 | |||
| 3879 | 4023900 | void HeroClass::check_slash_block_layer(int32_t bx, int32_t by, int32_t layer) | |
| 3880 | { | ||
| 3881 |
2/2✓ Branch 0 taken 3828576 times.
✓ Branch 1 taken 195324 times.
|
4023900 | if(!(get_qr(qr_BUSHESONLAYERS1AND2))) |
| 3882 | { | ||
| 3883 | 3828576 | return; | |
| 3884 | } | ||
| 3885 | //keep things inside the screen boundaries | ||
| 3886 | 195324 | bx=vbound(bx, 0, 255); | |
| 3887 | 195324 | by=vbound(by, 0, 176); | |
| 3888 | 195324 | int32_t fx=vbound(bx, 0, 255); | |
| 3889 | 195324 | int32_t fy=vbound(by, 0, 176); | |
| 3890 | //first things first | ||
| 3891 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 195324 times.
|
195324 | if(attack!=wSword) |
| 3892 | ✗ | return; | |
| 3893 | |||
| 3894 |
4/6✓ Branch 0 taken 195324 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 195324 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1984 times.
✓ Branch 5 taken 20224 times.
|
217532 | if(z>8||fakez>8 || attackclk==SWORDCHARGEFRAME // is not charging>0, as tapping a wall reduces attackclk but retains charging |
| 3895 |
4/4✓ Branch 0 taken 179972 times.
✓ Branch 1 taken 15352 times.
✓ Branch 2 taken 22208 times.
✓ Branch 3 taken 157764 times.
|
195324 | || (attackclk>SWORDTAPFRAME && tapping)) |
| 3896 | 17336 | return; | |
| 3897 | |||
| 3898 | //find out which combo row/column the coordinates are in | ||
| 3899 | 177988 | bx &= 0xF0; | |
| 3900 | 177988 | by &= 0xF0; | |
| 3901 | |||
| 3902 | |||
| 3903 | 177988 | int32_t flag = MAPFLAGL(layer,bx,by); | |
| 3904 | 177988 | int32_t flag2 = MAPCOMBOFLAGL(layer,bx,by); | |
| 3905 | 177988 | int32_t cid = MAPCOMBOL(layer,bx,by); | |
| 3906 | 177988 | int32_t type = combobuf[cid].type; | |
| 3907 |
1/2✓ Branch 0 taken 177988 times.
✗ Branch 1 not taken.
|
177988 | if(combobuf[cid].triggerflags[0] & combotriggerONLYGENTRIG) |
| 3908 | ✗ | type = cNONE; | |
| 3909 | 177988 | int32_t i = (bx>>4) + by; | |
| 3910 | |||
| 3911 |
2/2✓ Branch 0 taken 30 times.
✓ Branch 1 taken 177958 times.
|
177988 | if(i > 175) |
| 3912 | 30 | return; | |
| 3913 | |||
| 3914 | 177958 | bool ignorescreen=false; | |
| 3915 | |||
| 3916 |
4/4✓ Branch 0 taken 177256 times.
✓ Branch 1 taken 702 times.
✓ Branch 2 taken 176971 times.
✓ Branch 3 taken 285 times.
|
177958 | if((get_bit(screengrid_layer[layer-1], i) != 0) || (!isCuttableType(type))) |
| 3917 | 177673 | return; | |
| 3918 | |||
| 3919 |
3/4✓ Branch 0 taken 98 times.
✓ Branch 1 taken 187 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 98 times.
|
285 | int32_t sworditem = (directWpn>-1 && itemsbuf[directWpn].family==itype_sword) ? itemsbuf[directWpn].fam_type : current_item(itype_sword); |
| 3920 | |||
| 3921 |
3/4✓ Branch 0 taken 188 times.
✓ Branch 1 taken 97 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 188 times.
|
285 | if(!isTouchyType(type) && !get_qr(qr_CONT_SWORD_TRIGGERS)) set_bit(screengrid_layer[layer-1],i,1); |
| 3922 |
1/2✓ Branch 0 taken 285 times.
✗ Branch 1 not taken.
|
285 | if(isCuttableNextType(type)) |
| 3923 | { | ||
| 3924 | 285 | FFCore.tempScreens[layer]->data[i]++; | |
| 3925 | 285 | } | |
| 3926 | else | ||
| 3927 | { | ||
| 3928 | ✗ | FFCore.tempScreens[layer]->data[i] = tmpscr->undercombo; | |
| 3929 | ✗ | FFCore.tempScreens[layer]->cset[i] = tmpscr->undercset; | |
| 3930 | ✗ | FFCore.tempScreens[layer]->sflag[i] = 0; | |
| 3931 | } | ||
| 3932 |
2/8✓ Branch 0 taken 285 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 285 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
285 | if((flag==mfARMOS_ITEM||flag2==mfARMOS_ITEM) && (!getmapflag((currscr < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM) || (tmpscr->flags9&fBELOWRETURN))) |
| 3933 | { | ||
| 3934 | ✗ | items.add(new item((zfix)bx, (zfix)by,(zfix)0, tmpscr->catchall, ipONETIME2 + ipBIGRANGE + ipHOLDUP | ((tmpscr->flags8&fITEMSECRET) ? ipSECRETS : 0), 0)); | |
| 3935 | ✗ | sfx(tmpscr->secretsfx); | |
| 3936 | ✗ | } | |
| 3937 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 285 times.
|
285 | else if(isCuttableItemType(type)) |
| 3938 | { | ||
| 3939 | 285 | int32_t it = -1; | |
| 3940 | 285 | int32_t thedropset = -1; | |
| 3941 | |||
| 3942 | //select_dropitem( (combobuf[MAPCOMBO(bx,by)-1].usrflags&cflag2) ? (combobuf[MAPCOMBO(bx,by)-1].attributes[1])/10000L : 12, bx, by); | ||
| 3943 |
2/2✓ Branch 0 taken 31 times.
✓ Branch 1 taken 254 times.
|
285 | if ( (combobuf[cid].usrflags&cflag2) ) |
| 3944 | { | ||
| 3945 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 31 times.
|
31 | if(combobuf[cid].usrflags&cflag11) |
| 3946 | ✗ | it = combobuf[cid].attribytes[1]; | |
| 3947 | else | ||
| 3948 | { | ||
| 3949 | 31 | it = select_dropitem(combobuf[cid].attribytes[1]); | |
| 3950 | 31 | thedropset = combobuf[cid].attribytes[1]; | |
| 3951 | } | ||
| 3952 | 31 | } | |
| 3953 | else | ||
| 3954 | { | ||
| 3955 | 254 | it = select_dropitem(12); | |
| 3956 | 254 | thedropset = 12; | |
| 3957 | } | ||
| 3958 |
2/2✓ Branch 0 taken 189 times.
✓ Branch 1 taken 96 times.
|
285 | if(it!=-1) |
| 3959 | { | ||
| 3960 |
4/8✓ Branch 0 taken 96 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 96 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 96 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 96 times.
✗ Branch 7 not taken.
|
96 | item* itm = (new item((zfix)bx, (zfix)by,(zfix)0, it, ipBIGRANGE + ipTIMER, 0)); |
| 3961 | 96 | itm->from_dropset = thedropset; | |
| 3962 | 96 | items.add(itm); | |
| 3963 | 96 | } | |
| 3964 | 285 | } | |
| 3965 | |||
| 3966 | 285 | putcombo(scrollbuf,(i&15)<<4,i&0xF0,tmpscr->data[i],tmpscr->cset[i]); | |
| 3967 | |||
| 3968 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 285 times.
|
285 | if(get_qr(qr_MORESOUNDS)) |
| 3969 | { | ||
| 3970 |
5/6✓ Branch 0 taken 187 times.
✓ Branch 1 taken 98 times.
✓ Branch 2 taken 187 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 153 times.
✓ Branch 5 taken 34 times.
|
285 | if (!isBushType(type) && !isFlowersType(type) && !isGrassType(type)) |
| 3971 | { | ||
| 3972 |
1/2✓ Branch 0 taken 34 times.
✗ Branch 1 not taken.
|
34 | if (combobuf[cid].usrflags&cflag3) |
| 3973 | { | ||
| 3974 | ✗ | sfx(combobuf[cid].attribytes[2],int32_t(bx)); | |
| 3975 | ✗ | } | |
| 3976 | 34 | } | |
| 3977 | else | ||
| 3978 | { | ||
| 3979 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 251 times.
|
251 | if (combobuf[cid].usrflags&cflag3) |
| 3980 | { | ||
| 3981 | ✗ | sfx(combobuf[cid].attribytes[2],int32_t(bx)); | |
| 3982 | ✗ | } | |
| 3983 | 251 | else sfx(QMisc.miscsfx[sfxBUSHGRASS],int32_t(bx)); | |
| 3984 | } | ||
| 3985 | 285 | } | |
| 3986 | |||
| 3987 | 285 | spawn_decoration_xy(combobuf[cid], fx, fy); | |
| 3988 | 4023900 | } | |
| 3989 | |||
| 3990 | 1866950 | void HeroClass::check_slash_block(int32_t bx, int32_t by) | |
| 3991 | { | ||
| 3992 | //keep things inside the screen boundaries | ||
| 3993 | 1866950 | bx=vbound(bx, 0, 255); | |
| 3994 | 1866950 | by=vbound(by, 0, 176); | |
| 3995 | 1866950 | int32_t fx=vbound(bx, 0, 255); | |
| 3996 | 1866950 | int32_t fy=vbound(by, 0, 176); | |
| 3997 | //first things first | ||
| 3998 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1866950 times.
|
1866950 | if(attack!=wSword) |
| 3999 | ✗ | return; | |
| 4000 | |||
| 4001 |
5/6✓ Branch 0 taken 1866806 times.
✓ Branch 1 taken 144 times.
✓ Branch 2 taken 1866806 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 9720 times.
✓ Branch 5 taken 208924 times.
|
2085594 | if(z>8||fakez>8 || attackclk==SWORDCHARGEFRAME // is not charging>0, as tapping a wall reduces attackclk but retains charging |
| 4002 |
4/4✓ Branch 0 taken 1781514 times.
✓ Branch 1 taken 85292 times.
✓ Branch 2 taken 218644 times.
✓ Branch 3 taken 1562870 times.
|
1866806 | || (attackclk>SWORDTAPFRAME && tapping)) |
| 4003 | 95156 | return; | |
| 4004 | |||
| 4005 | //find out which combo row/column the coordinates are in | ||
| 4006 | 1771794 | bx &= 0xF0; | |
| 4007 | 1771794 | by &= 0xF0; | |
| 4008 | |||
| 4009 | 1771794 | int cid = MAPCOMBO(bx,by); | |
| 4010 | 1771794 | int cid_ff = MAPFFCOMBO(fx,fy); | |
| 4011 | 1771794 | int current_ffcombo = getFFCAt(fx,fy); | |
| 4012 | 1771794 | newcombo const& cmb = combobuf[cid]; | |
| 4013 | 1771794 | newcombo const& cmb_ff = combobuf[cid_ff]; | |
| 4014 | 1771794 | int type = cmb.type; | |
| 4015 | 1771794 | int type2 = cmb_ff.type; | |
| 4016 | 1771794 | int flag = MAPFLAG(bx,by); | |
| 4017 | 1771794 | int flag2 = cmb.flag; | |
| 4018 | 1771794 | int flag3 = cmb_ff.flag; | |
| 4019 | 1771794 | int i = (bx>>4) + by; | |
| 4020 | |||
| 4021 |
2/2✓ Branch 0 taken 193 times.
✓ Branch 1 taken 1771601 times.
|
1771794 | if(i > 175) |
| 4022 | 193 | return; | |
| 4023 | |||
| 4024 | 1771601 | bool ignorescreen=false; | |
| 4025 | 1771601 | bool ignoreffc=false; | |
| 4026 | |||
| 4027 |
2/2✓ Branch 0 taken 1746007 times.
✓ Branch 1 taken 25594 times.
|
1771601 | if(get_bit(screengrid, i) != 0) |
| 4028 | { | ||
| 4029 | 25594 | ignorescreen = true; | |
| 4030 | 25594 | } | |
| 4031 |
2/2✓ Branch 0 taken 1746002 times.
✓ Branch 1 taken 5 times.
|
1746007 | else if(cmb.triggerflags[0] & combotriggerONLYGENTRIG) |
| 4032 | 5 | ignorescreen = true; | |
| 4033 | |||
| 4034 | |||
| 4035 | |||
| 4036 |
3/4✓ Branch 0 taken 12071 times.
✓ Branch 1 taken 1759530 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 12071 times.
|
1771601 | if(current_ffcombo == -1 || get_bit(ffcgrid, current_ffcombo) != 0) |
| 4037 | { | ||
| 4038 | 1759530 | ignoreffc = true; | |
| 4039 | 1759530 | } | |
| 4040 |
2/2✓ Branch 0 taken 12052 times.
✓ Branch 1 taken 19 times.
|
12071 | else if(cmb_ff.triggerflags[0] & combotriggerONLYGENTRIG) |
| 4041 | 19 | ignoreffc = true; | |
| 4042 | |||
| 4043 |
4/4✓ Branch 0 taken 1753863 times.
✓ Branch 1 taken 17738 times.
✓ Branch 2 taken 46 times.
✓ Branch 3 taken 1753449 times.
|
3525096 | if(!isCuttableType(type) && |
| 4044 |
6/6✓ Branch 0 taken 3935 times.
✓ Branch 1 taken 1749928 times.
✓ Branch 2 taken 1753495 times.
✓ Branch 3 taken 368 times.
✓ Branch 4 taken 4688 times.
✓ Branch 5 taken 1748807 times.
|
1753863 | (flag<mfSWORD || flag>mfXSWORD) && flag!=mfSTRIKE && (flag2<mfSWORD || flag2>mfXSWORD) && flag2!=mfSTRIKE) |
| 4045 | { | ||
| 4046 | 1753449 | ignorescreen = true; | |
| 4047 | 1753449 | } | |
| 4048 | |||
| 4049 |
4/4✓ Branch 0 taken 1771582 times.
✓ Branch 1 taken 19 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 1771581 times.
|
3543183 | if(!isCuttableType(type2) && |
| 4050 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1771581 times.
|
1771582 | (flag3<mfSWORD || flag3>mfXSWORD) && flag3!=mfSTRIKE) |
| 4051 | { | ||
| 4052 | 1771581 | ignoreffc = true; | |
| 4053 | 1771581 | } | |
| 4054 | |||
| 4055 | 1771601 | mapscr *s = tmpscr + ((currscr>=128) ? 1 : 0); | |
| 4056 | |||
| 4057 |
4/4✓ Branch 0 taken 71758 times.
✓ Branch 1 taken 1699843 times.
✓ Branch 2 taken 56 times.
✓ Branch 3 taken 71702 times.
|
1771601 | int32_t sworditem = (directWpn>-1 && itemsbuf[directWpn].family==itype_sword) ? itemsbuf[directWpn].fam_type : current_item(itype_sword); |
| 4058 | 1771601 | byte skipsecrets = 0; | |
| 4059 | |||
| 4060 |
2/2✓ Branch 0 taken 1764964 times.
✓ Branch 1 taken 6637 times.
|
1771601 | if ( isNextType(type) ) //->Next combos should not trigger secrets. Their child combo, may want to do that! -Z 17th December, 2019 |
| 4061 | { | ||
| 4062 |
2/2✓ Branch 0 taken 5639 times.
✓ Branch 1 taken 998 times.
|
6637 | if (get_qr(qr_OLD_SLASHNEXT_SECRETS)) |
| 4063 | { | ||
| 4064 | 5639 | skipsecrets = 0; | |
| 4065 | 5639 | } | |
| 4066 | 998 | else skipsecrets = 1; ; | |
| 4067 | 6637 | } | |
| 4068 | |||
| 4069 |
6/6✓ Branch 0 taken 16569 times.
✓ Branch 1 taken 1755032 times.
✓ Branch 2 taken 993 times.
✓ Branch 3 taken 15576 times.
✓ Branch 4 taken 44 times.
✓ Branch 5 taken 1037 times.
|
1771601 | if(!ignorescreen && (!skipsecrets || !get_qr(qr_BUGGY_BUGGY_SLASH_TRIGGERS))) |
| 4070 | { | ||
| 4071 |
6/6✓ Branch 0 taken 1955 times.
✓ Branch 1 taken 14658 times.
✓ Branch 2 taken 1526 times.
✓ Branch 3 taken 429 times.
✓ Branch 4 taken 30 times.
✓ Branch 5 taken 1496 times.
|
16613 | if((flag >= 16)&&(flag <= 31) && !skipsecrets) |
| 4072 | { | ||
| 4073 | 1496 | s->data[i] = s->secretcombo[(s->sflag[i])-16+4]; | |
| 4074 | 1496 | s->cset[i] = s->secretcset[(s->sflag[i])-16+4]; | |
| 4075 | 1496 | s->sflag[i] = s->secretflag[(s->sflag[i])-16+4]; | |
| 4076 | 1496 | } | |
| 4077 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 15113 times.
|
15117 | else if(flag == mfARMOS_SECRET) |
| 4078 | { | ||
| 4079 | 4 | s->data[i] = s->secretcombo[sSTAIRS]; | |
| 4080 | 4 | s->cset[i] = s->secretcset[sSTAIRS]; | |
| 4081 | 4 | s->sflag[i] = s->secretflag[sSTAIRS]; | |
| 4082 | 4 | sfx(tmpscr->secretsfx); | |
| 4083 | 4 | } | |
| 4084 |
4/4✓ Branch 0 taken 393 times.
✓ Branch 1 taken 14720 times.
✓ Branch 2 taken 22 times.
✓ Branch 3 taken 14698 times.
|
15113 | else if(((flag>=mfSWORD&&flag<=mfXSWORD)||(flag==mfSTRIKE))) |
| 4085 | { | ||
| 4086 |
4/4✓ Branch 0 taken 1074 times.
✓ Branch 1 taken 155 times.
✓ Branch 2 taken 858 times.
✓ Branch 3 taken 371 times.
|
1273 | for(int32_t i2=0; i2<=zc_min(sworditem-1,3); i2++) |
| 4087 | { | ||
| 4088 | 858 | findentrance(bx,by,mfSWORD+i2,true); | |
| 4089 | 858 | } | |
| 4090 | |||
| 4091 | 371 | findentrance(bx,by,mfSTRIKE,true); | |
| 4092 | 371 | } | |
| 4093 |
3/4✓ Branch 0 taken 12 times.
✓ Branch 1 taken 14686 times.
✓ Branch 2 taken 12 times.
✗ Branch 3 not taken.
|
14698 | else if(((flag2 >= 16)&&(flag2 <= 31))) |
| 4094 | { | ||
| 4095 | ✗ | s->data[i] = s->secretcombo[(s->sflag[i])-16+4]; | |
| 4096 | ✗ | s->cset[i] = s->secretcset[(s->sflag[i])-16+4]; | |
| 4097 | ✗ | s->sflag[i] = s->secretflag[(s->sflag[i])-16+4]; | |
| 4098 | ✗ | } | |
| 4099 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14698 times.
|
14698 | else if(flag2 == mfARMOS_SECRET) |
| 4100 | { | ||
| 4101 | ✗ | s->data[i] = s->secretcombo[sSTAIRS]; | |
| 4102 | ✗ | s->cset[i] = s->secretcset[sSTAIRS]; | |
| 4103 | ✗ | s->sflag[i] = s->secretflag[sSTAIRS]; | |
| 4104 | ✗ | sfx(tmpscr->secretsfx); | |
| 4105 | ✗ | } | |
| 4106 |
3/4✓ Branch 0 taken 12 times.
✓ Branch 1 taken 14686 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 14686 times.
|
14698 | else if(((flag2>=mfSWORD&&flag2<=mfXSWORD)||(flag2==mfSTRIKE))) |
| 4107 | { | ||
| 4108 |
3/4✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 20 times.
✓ Branch 3 taken 12 times.
|
32 | for(int32_t i2=0; i2<=zc_min(sworditem-1,3); i2++) |
| 4109 | { | ||
| 4110 | 20 | findentrance(bx,by,mfSWORD+i2,true); | |
| 4111 | 20 | } | |
| 4112 | |||
| 4113 | 12 | findentrance(bx,by,mfSTRIKE,true); | |
| 4114 | 12 | } | |
| 4115 | else | ||
| 4116 | { | ||
| 4117 |
2/2✓ Branch 0 taken 5079 times.
✓ Branch 1 taken 9607 times.
|
14686 | if(isCuttableNextType(type)) |
| 4118 | { | ||
| 4119 | 5079 | s->data[i]++; | |
| 4120 | 5079 | } | |
| 4121 | else | ||
| 4122 | { | ||
| 4123 | 9607 | s->data[i] = s->undercombo; | |
| 4124 | 9607 | s->cset[i] = s->undercset; | |
| 4125 | 9607 | s->sflag[i] = 0; | |
| 4126 | } | ||
| 4127 | |||
| 4128 | //pausenow=true; | ||
| 4129 | } | ||
| 4130 | 16569 | } | |
| 4131 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1755076 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1755076 | else if(!ignorescreen && skipsecrets) |
| 4132 | { | ||
| 4133 | ✗ | if(isCuttableNextType(type)) | |
| 4134 | { | ||
| 4135 | ✗ | s->data[i]++; | |
| 4136 | ✗ | } | |
| 4137 | else | ||
| 4138 | { | ||
| 4139 | ✗ | s->data[i] = s->undercombo; | |
| 4140 | ✗ | s->cset[i] = s->undercset; | |
| 4141 | ✗ | s->sflag[i] = 0; | |
| 4142 | } | ||
| 4143 | ✗ | } | |
| 4144 | |||
| 4145 |
3/4✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1771644 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1771644 times.
|
1771645 | if(((flag3>=mfSWORD&&flag3<=mfXSWORD)||(flag3==mfSTRIKE)) && !ignoreffc) |
| 4146 | { | ||
| 4147 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 1 times.
|
5 | for(int32_t i2=0; i2<=zc_min(sworditem-1,3); i2++) |
| 4148 | { | ||
| 4149 | 4 | findentrance(bx,by,mfSWORD+i2,true); | |
| 4150 | 4 | } | |
| 4151 | |||
| 4152 | 1 | findentrance(fx,fy,mfSTRIKE,true); | |
| 4153 | 1 | } | |
| 4154 |
1/2✓ Branch 0 taken 1771644 times.
✗ Branch 1 not taken.
|
1771644 | else if(!ignoreffc) |
| 4155 | { | ||
| 4156 | ✗ | ffcdata& ffc = s->getFFC(current_ffcombo); | |
| 4157 | ✗ | if(isCuttableNextType(type2)) | |
| 4158 | { | ||
| 4159 | ✗ | zc_ffc_modify(ffc, 1); | |
| 4160 | ✗ | } | |
| 4161 | else | ||
| 4162 | { | ||
| 4163 | ✗ | zc_ffc_set(ffc, s->undercombo); | |
| 4164 | ✗ | ffc.cset = s->undercset; | |
| 4165 | } | ||
| 4166 | ✗ | } | |
| 4167 | |||
| 4168 |
2/2✓ Branch 0 taken 1755076 times.
✓ Branch 1 taken 16569 times.
|
1771645 | if(!ignorescreen) |
| 4169 | { | ||
| 4170 |
4/4✓ Branch 0 taken 5433 times.
✓ Branch 1 taken 11136 times.
✓ Branch 2 taken 290 times.
✓ Branch 3 taken 5143 times.
|
16569 | if(!isTouchyType(type) && !get_qr(qr_CONT_SWORD_TRIGGERS)) set_bit(screengrid,i,1); |
| 4171 | |||
| 4172 |
8/8✓ Branch 0 taken 16264 times.
✓ Branch 1 taken 305 times.
✓ Branch 2 taken 45 times.
✓ Branch 3 taken 16309 times.
✓ Branch 4 taken 45 times.
✓ Branch 5 taken 305 times.
✓ Branch 6 taken 45 times.
✓ Branch 7 taken 215 times.
|
16569 | if((flag==mfARMOS_ITEM||flag2==mfARMOS_ITEM) && (!getmapflag((currscr < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM) || (tmpscr->flags9&fBELOWRETURN))) |
| 4173 | { | ||
| 4174 |
4/8✓ Branch 0 taken 260 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 260 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 260 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 260 times.
✗ Branch 7 not taken.
|
260 | items.add(new item((zfix)bx, (zfix)by,(zfix)0, tmpscr->catchall, ipONETIME2 + ipBIGRANGE + ipHOLDUP | ((tmpscr->flags8&fITEMSECRET) ? ipSECRETS : 0), 0)); |
| 4175 | 260 | sfx(tmpscr->secretsfx); | |
| 4176 | 260 | } | |
| 4177 |
2/2✓ Branch 0 taken 420 times.
✓ Branch 1 taken 15889 times.
|
16309 | else if(isCuttableItemType(type)) |
| 4178 | { | ||
| 4179 | 15889 | int32_t it = -1; | |
| 4180 | 15889 | int32_t thedropset = -1; | |
| 4181 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 15841 times.
|
15889 | if ( (cmb.usrflags&cflag2) ) //specific dropset or item |
| 4182 | { | ||
| 4183 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
|
48 | if ( cmb.usrflags&cflag11 ) |
| 4184 | { | ||
| 4185 | ✗ | it = cmb.attribytes[1]; | |
| 4186 | ✗ | } | |
| 4187 | else | ||
| 4188 | { | ||
| 4189 | 48 | it = select_dropitem(cmb.attribytes[1]); | |
| 4190 | 48 | thedropset = cmb.attribytes[1]; | |
| 4191 | } | ||
| 4192 | 48 | } | |
| 4193 | else | ||
| 4194 | { | ||
| 4195 | 15841 | it = select_dropitem(12); | |
| 4196 | 15841 | thedropset = 12; | |
| 4197 | } | ||
| 4198 | |||
| 4199 |
2/2✓ Branch 0 taken 11114 times.
✓ Branch 1 taken 4775 times.
|
15889 | if(it!=-1) |
| 4200 | { | ||
| 4201 |
4/8✓ Branch 0 taken 4775 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4775 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4775 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 4775 times.
✗ Branch 7 not taken.
|
4775 | item* itm = (new item((zfix)bx, (zfix)by,(zfix)0, it, ipBIGRANGE + ipTIMER, 0)); |
| 4202 | 4775 | itm->from_dropset = thedropset; | |
| 4203 | 4775 | items.add(itm); | |
| 4204 | 4775 | } | |
| 4205 | 15889 | } | |
| 4206 | |||
| 4207 | 16569 | putcombo(scrollbuf,(i&15)<<4,i&0xF0,s->data[i],s->cset[i]); | |
| 4208 | |||
| 4209 |
2/2✓ Branch 0 taken 8270 times.
✓ Branch 1 taken 8299 times.
|
16569 | if(get_qr(qr_MORESOUNDS)) |
| 4210 | { | ||
| 4211 |
6/6✓ Branch 0 taken 6765 times.
✓ Branch 1 taken 1534 times.
✓ Branch 2 taken 4720 times.
✓ Branch 3 taken 2045 times.
✓ Branch 4 taken 4095 times.
✓ Branch 5 taken 625 times.
|
8299 | if (!isBushType(type) && !isFlowersType(type) && !isGrassType(type)) |
| 4212 | { | ||
| 4213 |
2/2✓ Branch 0 taken 581 times.
✓ Branch 1 taken 44 times.
|
625 | if (cmb.usrflags&cflag3) |
| 4214 | { | ||
| 4215 | 44 | sfx(cmb.attribytes[2],int32_t(bx)); | |
| 4216 | 44 | } | |
| 4217 | 625 | } | |
| 4218 | else | ||
| 4219 | { | ||
| 4220 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7674 times.
|
7674 | if (cmb.usrflags&cflag3) |
| 4221 | { | ||
| 4222 | ✗ | sfx(cmb.attribytes[2],int32_t(bx)); | |
| 4223 | ✗ | } | |
| 4224 | 7674 | else sfx(QMisc.miscsfx[sfxBUSHGRASS],int32_t(bx)); | |
| 4225 | } | ||
| 4226 | 8299 | } | |
| 4227 | |||
| 4228 | 16569 | spawn_decoration_xy(cmb, fx, fy); | |
| 4229 | 16569 | } | |
| 4230 | |||
| 4231 |
2/2✓ Branch 0 taken 1771644 times.
✓ Branch 1 taken 1 times.
|
1771645 | if(!ignoreffc) |
| 4232 | { | ||
| 4233 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
|
1 | if(!isTouchyType(type2) && !get_qr(qr_CONT_SWORD_TRIGGERS)) set_bit(ffcgrid, current_ffcombo, 1); |
| 4234 | |||
| 4235 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if(isCuttableItemType(type2)) |
| 4236 | { | ||
| 4237 | ✗ | int32_t it=-1; | |
| 4238 | ✗ | int32_t thedropset=-1; | |
| 4239 | ✗ | if ( (cmb_ff.usrflags&cflag2) ) | |
| 4240 | { | ||
| 4241 | ✗ | if(cmb_ff.usrflags&cflag11) | |
| 4242 | ✗ | it = cmb_ff.attribytes[1]; | |
| 4243 | else | ||
| 4244 | { | ||
| 4245 | ✗ | it = select_dropitem(cmb_ff.attribytes[1]); | |
| 4246 | ✗ | thedropset = cmb_ff.attribytes[1]; | |
| 4247 | } | ||
| 4248 | ✗ | } | |
| 4249 | else | ||
| 4250 | { | ||
| 4251 | ✗ | if(get_qr(qr_HARDCODED_FFC_BUSH_DROPS)) | |
| 4252 | { | ||
| 4253 | ✗ | int32_t r=zc_oldrand()%100; | |
| 4254 | |||
| 4255 | ✗ | if(r<15) | |
| 4256 | ✗ | it=iHeart; // 15% | |
| 4257 | ✗ | else if(r<35) | |
| 4258 | ✗ | it=iRupy; // 20% | |
| 4259 | ✗ | } | |
| 4260 | else | ||
| 4261 | { | ||
| 4262 | ✗ | it = select_dropitem(12); | |
| 4263 | ✗ | thedropset = 12; | |
| 4264 | } | ||
| 4265 | } | ||
| 4266 | |||
| 4267 | ✗ | if(it!=-1 && itemsbuf[it].family != itype_misc) // Don't drop non-gameplay items | |
| 4268 | { | ||
| 4269 | ✗ | item* itm = (new item((zfix)fx, (zfix)fy,(zfix)0, it, ipBIGRANGE + ipTIMER, 0)); | |
| 4270 | ✗ | itm->from_dropset = thedropset; | |
| 4271 | ✗ | items.add(itm); | |
| 4272 | ✗ | } | |
| 4273 | ✗ | } | |
| 4274 | |||
| 4275 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if(get_qr(qr_MORESOUNDS)) |
| 4276 | { | ||
| 4277 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
|
1 | if (!isBushType(type2) && !isFlowersType(type2) && !isGrassType(type2)) |
| 4278 | { | ||
| 4279 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if (cmb_ff.usrflags&cflag3) |
| 4280 | { | ||
| 4281 | ✗ | sfx(cmb_ff.attribytes[2],int32_t(bx)); | |
| 4282 | ✗ | } | |
| 4283 | 1 | } | |
| 4284 | else | ||
| 4285 | { | ||
| 4286 | ✗ | if (cmb_ff.usrflags&cflag3) | |
| 4287 | { | ||
| 4288 | ✗ | sfx(cmb_ff.attribytes[2],int32_t(bx)); | |
| 4289 | ✗ | } | |
| 4290 | ✗ | else sfx(QMisc.miscsfx[sfxBUSHGRASS],int32_t(bx)); | |
| 4291 | } | ||
| 4292 | 1 | } | |
| 4293 | |||
| 4294 | 1 | spawn_decoration_xy(cmb_ff, fx, fy); | |
| 4295 | 1 | } | |
| 4296 | 1866994 | } | |
| 4297 | |||
| 4298 | 25051020 | void HeroClass::check_wpn_triggers(int32_t bx, int32_t by, weapon *w) | |
| 4299 | { | ||
| 4300 | /* | ||
| 4301 | int32_t par_item = w->parentitem; | ||
| 4302 | al_trace("check_wpn_triggers(weapon *w): par_item is: %d\n", par_item); | ||
| 4303 | int32_t usewpn = -1; | ||
| 4304 | if ( par_item > -1 ) | ||
| 4305 | { | ||
| 4306 | usewpn = itemsbuf[par_item].useweapon; | ||
| 4307 | } | ||
| 4308 | else if ( par_item == -1 && w->ScriptGenerated ) | ||
| 4309 | { | ||
| 4310 | usewpn = w->useweapon; | ||
| 4311 | } | ||
| 4312 | al_trace("check_wpn_triggers(weapon *w): usewpn is: %d\n", usewpn); | ||
| 4313 | |||
| 4314 | */ | ||
| 4315 | 25051020 | bx=vbound(bx, 0, 255); | |
| 4316 | 25051020 | by=vbound(by, 0, 176); | |
| 4317 | 25051020 | int32_t cid = MAPCOMBO(bx,by); | |
| 4318 |
4/30✓ Branch 0 taken 3120 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 201384 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✓ Branch 26 taken 24841852 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 4664 times.
✗ Branch 29 not taken.
|
25051020 | switch(w->useweapon) |
| 4319 | { | ||
| 4320 | case wArrow: | ||
| 4321 | 3120 | findentrance(bx,by,mfARROW,true); | |
| 4322 | 3120 | findentrance(bx,by,mfSARROW,true); | |
| 4323 | 3120 | findentrance(bx,by,mfGARROW,true); | |
| 4324 | 3120 | break; | |
| 4325 | case wBeam: | ||
| 4326 | ✗ | for(int32_t i = 0; i <4; i++) findentrance(bx,by,mfSWORDBEAM+i,true); | |
| 4327 | ✗ | break; | |
| 4328 | case wHookshot: | ||
| 4329 | ✗ | findentrance(bx,by,mfHOOKSHOT,true); | |
| 4330 | ✗ | break; | |
| 4331 | case wBrang: | ||
| 4332 | ✗ | for(int32_t i = 0; i <3; i++) findentrance(bx,by,mfBRANG+i,true); | |
| 4333 | ✗ | break; | |
| 4334 | case wMagic: | ||
| 4335 | ✗ | findentrance(bx,by,mfWANDMAGIC,true); | |
| 4336 | ✗ | break; | |
| 4337 | case wRefMagic: | ||
| 4338 | ✗ | findentrance(bx,by,mfWANDMAGIC,true); | |
| 4339 | ✗ | break; | |
| 4340 | case wRefBeam: | ||
| 4341 | ✗ | for(int32_t i = 0; i <4; i++) findentrance(bx,by,mfSWORDBEAM+i,true); | |
| 4342 | ✗ | break; | |
| 4343 | //reflected magic needs to happen in mirrors: | ||
| 4344 | // | ||
| 4345 | //findentrance(bx,by,mfREFMAGIC,true) | ||
| 4346 | case wRefFireball: | ||
| 4347 | ✗ | findentrance(bx,by,mfREFFIREBALL,true); | |
| 4348 | ✗ | break; | |
| 4349 | case wBomb: | ||
| 4350 | ✗ | findentrance(bx+w->txsz,by+tysz+(isSideViewGravity()?2:-3),mfBOMB,true); | |
| 4351 | ✗ | break; | |
| 4352 | |||
| 4353 | case wSBomb: | ||
| 4354 | ✗ | findentrance(bx+w->txsz,by+tysz+(isSideViewGravity()?2:-3),mfSBOMB,true); | |
| 4355 | ✗ | break; | |
| 4356 | |||
| 4357 | case wFire: | ||
| 4358 | 201384 | findentrance(bx,by,mfANYFIRE,true); | |
| 4359 | 201384 | findentrance(bx,by,mfSTRONGFIRE,true); | |
| 4360 | 201384 | findentrance(bx,by,mfMAGICFIRE,true); | |
| 4361 | /* if we want the weapon to die | ||
| 4362 | if (findentrance(bx,by,mfANYFIRE,true) ) dead = 1; | ||
| 4363 | if (findentrance(bx,by,mfSTRONGFIRE,true) ) dead = 1; | ||
| 4364 | if (findentrance(bx,by,mfMAGICFIRE,true)) dead = 1; | ||
| 4365 | */ | ||
| 4366 | 201384 | break; | |
| 4367 | |||
| 4368 | case wScript1: | ||
| 4369 | ✗ | break; | |
| 4370 | case wScript2: | ||
| 4371 | ✗ | break; | |
| 4372 | case wScript3: | ||
| 4373 | ✗ | break; | |
| 4374 | case wScript4: | ||
| 4375 | ✗ | break; | |
| 4376 | case wScript5: | ||
| 4377 | ✗ | break; | |
| 4378 | case wScript6: | ||
| 4379 | ✗ | break; | |
| 4380 | case wScript7: | ||
| 4381 | ✗ | break; | |
| 4382 | case wScript8: | ||
| 4383 | ✗ | break; | |
| 4384 | case wScript9: | ||
| 4385 | ✗ | break; | |
| 4386 | case wScript10: | ||
| 4387 | ✗ | break; | |
| 4388 | case wIce: | ||
| 4389 | ✗ | break; | |
| 4390 | case wCByrna: | ||
| 4391 | ✗ | break; | |
| 4392 | case wWhistle: | ||
| 4393 | ✗ | break; | |
| 4394 | case wSSparkle: | ||
| 4395 | case wFSparkle: | ||
| 4396 | ✗ | break; | |
| 4397 | case wWind: | ||
| 4398 | ✗ | break; | |
| 4399 | case wBait: | ||
| 4400 | ✗ | break; | |
| 4401 | case wFlame: | ||
| 4402 | case wThrown: | ||
| 4403 | case wBombos: | ||
| 4404 | case wEther: | ||
| 4405 | case wQuake: | ||
| 4406 | case wSwordLA: | ||
| 4407 | case wSword180: | ||
| 4408 | case wStomp: | ||
| 4409 | ✗ | break; | |
| 4410 | case wSword: | ||
| 4411 | case wWand: | ||
| 4412 | //case wCandle: | ||
| 4413 | case wHSHandle: | ||
| 4414 | case wLitBomb: | ||
| 4415 | case wLitSBomb: | ||
| 4416 | 4664 | break; | |
| 4417 | 24841852 | default: break; | |
| 4418 | |||
| 4419 | } | ||
| 4420 | 25051020 | } | |
| 4421 | |||
| 4422 | 50102040 | void HeroClass::check_slash_block_layer2(int32_t bx, int32_t by, weapon *w, int32_t layer) | |
| 4423 | { | ||
| 4424 |
2/2✓ Branch 0 taken 1937162 times.
✓ Branch 1 taken 48164878 times.
|
50102040 | if(!(get_qr(qr_BUSHESONLAYERS1AND2))) |
| 4425 | { | ||
| 4426 | 48164878 | return; | |
| 4427 | } | ||
| 4428 | //keep things inside the screen boundaries | ||
| 4429 | 1937162 | bx=vbound(bx, 0, 255); | |
| 4430 | 1937162 | by=vbound(by, 0, 176); | |
| 4431 | 1937162 | int32_t fx=vbound(bx, 0, 255); | |
| 4432 | 1937162 | int32_t fy=vbound(by, 0, 176); | |
| 4433 | //first things first | ||
| 4434 |
2/2✓ Branch 0 taken 1930330 times.
✓ Branch 1 taken 6832 times.
|
1937162 | if(w->useweapon != wSword) |
| 4435 | 1930330 | return; | |
| 4436 | |||
| 4437 | //find out which combo row/column the coordinates are in | ||
| 4438 | 6832 | bx &= 0xF0; | |
| 4439 | 6832 | by &= 0xF0; | |
| 4440 | |||
| 4441 | |||
| 4442 | 6832 | int32_t flag = MAPFLAGL(layer,bx,by); | |
| 4443 | 6832 | int32_t flag2 = MAPCOMBOFLAGL(layer,bx,by); | |
| 4444 | 6832 | int32_t cid = MAPCOMBOL(layer,bx,by); | |
| 4445 | 6832 | int32_t type = combobuf[cid].type; | |
| 4446 |
1/2✓ Branch 0 taken 6832 times.
✗ Branch 1 not taken.
|
6832 | if(combobuf[cid].triggerflags[0] & combotriggerONLYGENTRIG) |
| 4447 | ✗ | type = cNONE; | |
| 4448 | 6832 | int32_t i = (bx>>4) + by; | |
| 4449 | |||
| 4450 |
2/2✓ Branch 0 taken 384 times.
✓ Branch 1 taken 6448 times.
|
6832 | if(i > 175) |
| 4451 | 384 | return; | |
| 4452 | |||
| 4453 |
4/4✓ Branch 0 taken 6436 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 6430 times.
✓ Branch 3 taken 6 times.
|
6448 | if((get_bit(w->wscreengrid_layer[layer-1], i) != 0) || (!isCuttableType(type))) |
| 4454 | { | ||
| 4455 | 6442 | return; | |
| 4456 | } | ||
| 4457 | |||
| 4458 |
2/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
6 | int32_t sworditem = (directWpn>-1 && itemsbuf[directWpn].family==itype_sword) ? itemsbuf[directWpn].fam_type : current_item(itype_sword); |
| 4459 | |||
| 4460 | { | ||
| 4461 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
6 | if(!isTouchyType(type) && !get_qr(qr_CONT_SWORD_TRIGGERS)) set_bit(w->wscreengrid_layer[layer-1],i,1); |
| 4462 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
6 | if(isCuttableNextType(type) || isCuttableNextType(type)) |
| 4463 | { | ||
| 4464 | 6 | FFCore.tempScreens[layer]->data[i]++; | |
| 4465 | 6 | } | |
| 4466 | else | ||
| 4467 | { | ||
| 4468 | ✗ | FFCore.tempScreens[layer]->data[i] = tmpscr->undercombo; | |
| 4469 | ✗ | FFCore.tempScreens[layer]->cset[i] = tmpscr->undercset; | |
| 4470 | ✗ | FFCore.tempScreens[layer]->sflag[i] = 0; | |
| 4471 | } | ||
| 4472 |
2/8✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
6 | if((flag==mfARMOS_ITEM||flag2==mfARMOS_ITEM) && (!getmapflag((currscr < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM) || (tmpscr->flags9&fBELOWRETURN))) |
| 4473 | { | ||
| 4474 | ✗ | items.add(new item((zfix)bx, (zfix)by,(zfix)0, tmpscr->catchall, ipONETIME2 + ipBIGRANGE + ipHOLDUP | ((tmpscr->flags8&fITEMSECRET) ? ipSECRETS : 0), 0)); | |
| 4475 | ✗ | sfx(tmpscr->secretsfx); | |
| 4476 | ✗ | } | |
| 4477 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | else if(isCuttableItemType(type)) |
| 4478 | { | ||
| 4479 | 6 | int32_t it = -1; | |
| 4480 | 6 | int32_t thedropset = -1; | |
| 4481 | |||
| 4482 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | if ( (combobuf[cid].usrflags&cflag2) ) |
| 4483 | { | ||
| 4484 | ✗ | if(combobuf[cid].usrflags&cflag11) | |
| 4485 | ✗ | it = combobuf[cid].attribytes[1]; | |
| 4486 | else | ||
| 4487 | { | ||
| 4488 | ✗ | it = select_dropitem(combobuf[cid].attribytes[1]); | |
| 4489 | ✗ | thedropset = combobuf[cid].attribytes[1]; | |
| 4490 | } | ||
| 4491 | ✗ | } | |
| 4492 | else | ||
| 4493 | { | ||
| 4494 | 6 | it = select_dropitem(12); | |
| 4495 | 6 | thedropset = 12; | |
| 4496 | } | ||
| 4497 | |||
| 4498 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 2 times.
|
6 | if(it!=-1) |
| 4499 | { | ||
| 4500 |
4/8✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
|
2 | item* itm = (new item((zfix)bx, (zfix)by,(zfix)0, it, ipBIGRANGE + ipTIMER, 0)); |
| 4501 | 2 | itm->from_dropset = thedropset; | |
| 4502 | 2 | items.add(itm); | |
| 4503 | 2 | } | |
| 4504 | 6 | } | |
| 4505 | |||
| 4506 | 6 | putcombo(scrollbuf,(i&15)<<4,i&0xF0,tmpscr->data[i],tmpscr->cset[i]); | |
| 4507 | |||
| 4508 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | if(get_qr(qr_MORESOUNDS)) |
| 4509 | { | ||
| 4510 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
6 | if (!isBushType(type) && !isFlowersType(type) && !isGrassType(type)) |
| 4511 | { | ||
| 4512 | ✗ | if (combobuf[cid].usrflags&cflag3) | |
| 4513 | { | ||
| 4514 | ✗ | sfx(combobuf[cid].attribytes[2],int32_t(bx)); | |
| 4515 | ✗ | } | |
| 4516 | ✗ | } | |
| 4517 | else | ||
| 4518 | { | ||
| 4519 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | if (combobuf[cid].usrflags&cflag3) |
| 4520 | { | ||
| 4521 | ✗ | sfx(combobuf[cid].attribytes[2],int32_t(bx)); | |
| 4522 | ✗ | } | |
| 4523 | 6 | else sfx(QMisc.miscsfx[sfxBUSHGRASS],int32_t(bx)); | |
| 4524 | } | ||
| 4525 | 6 | } | |
| 4526 | |||
| 4527 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
6 | int16_t decotype = (combobuf[cid].usrflags & cflag1) ? ((combobuf[cid].usrflags & cflag10) ? (combobuf[cid].attribytes[0]) : (-1)) : (0); |
| 4528 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | if(decotype > 3) decotype = 0; |
| 4529 |
2/8✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
6 | if(!decotype) decotype = (isBushType(type) ? 1 : (isFlowersType(type) ? 2 : (isGrassType(type) ? 3 : ((combobuf[cid].usrflags & cflag1) ? -1 : -2)))); |
| 4530 |
1/6✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
6 | switch(decotype) |
| 4531 | { | ||
| 4532 | ✗ | case -2: break; //nothing | |
| 4533 | case -1: | ||
| 4534 | ✗ | decorations.add(new comboSprite((zfix)fx, (zfix)fy, dCOMBOSPRITE, 0, combobuf[cid].attribytes[0])); | |
| 4535 | ✗ | break; | |
| 4536 |
3/6✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
|
6 | case 1: decorations.add(new dBushLeaves((zfix)fx, (zfix)fy, dBUSHLEAVES, 0, 0)); break; |
| 4537 | ✗ | case 2: decorations.add(new dFlowerClippings((zfix)fx, (zfix)fy, dFLOWERCLIPPINGS, 0, 0)); break; | |
| 4538 | ✗ | case 3: decorations.add(new dGrassClippings((zfix)fx, (zfix)fy, dGRASSCLIPPINGS, 0, 0)); break; | |
| 4539 | } | ||
| 4540 | |||
| 4541 | } | ||
| 4542 | |||
| 4543 | 50102040 | } | |
| 4544 | |||
| 4545 | 25051130 | void HeroClass::check_slash_block2(int32_t bx, int32_t by, weapon *w) | |
| 4546 | { | ||
| 4547 | /* | ||
| 4548 | int32_t par_item = w->parentitem; | ||
| 4549 | al_trace("check_slash_block(weapon *w): par_item is: %d\n", par_item); | ||
| 4550 | int32_t usewpn = -1; | ||
| 4551 | if ( par_item > -1 ) | ||
| 4552 | { | ||
| 4553 | usewpn = itemsbuf[par_item].useweapon; | ||
| 4554 | } | ||
| 4555 | else if ( par_item == -1 && w->ScriptGenerated ) | ||
| 4556 | { | ||
| 4557 | usewpn = w->useweapon; | ||
| 4558 | } | ||
| 4559 | al_trace("check_slash_block(weapon *w): usewpn is: %d\n", usewpn); | ||
| 4560 | */ | ||
| 4561 | |||
| 4562 | |||
| 4563 | //keep things inside the screen boundaries | ||
| 4564 | 25051130 | bx=vbound(bx, 0, 255); | |
| 4565 | 25051130 | by=vbound(by, 0, 176); | |
| 4566 | 25051130 | int32_t fx=vbound(bx, 0, 255); | |
| 4567 | 25051130 | int32_t fy=vbound(by, 0, 176); | |
| 4568 | 25051130 | int32_t cid = MAPCOMBO(bx,by); | |
| 4569 | |||
| 4570 | //find out which combo row/column the coordinates are in | ||
| 4571 | 25051130 | bx &= 0xF0; | |
| 4572 | 25051130 | by &= 0xF0; | |
| 4573 | |||
| 4574 | 25051130 | int32_t type = COMBOTYPE(bx,by); | |
| 4575 | 25051130 | int32_t type2 = FFCOMBOTYPE(fx,fy); | |
| 4576 | 25051130 | int32_t flag = MAPFLAG(bx,by); | |
| 4577 | 25051130 | int32_t flag2 = MAPCOMBOFLAG(bx,by); | |
| 4578 | 25051130 | int32_t flag3 = MAPFFCOMBOFLAG(fx,fy); | |
| 4579 |
2/2✓ Branch 0 taken 25050916 times.
✓ Branch 1 taken 214 times.
|
25051130 | if(combobuf[cid].triggerflags[0] & combotriggerONLYGENTRIG) |
| 4580 | 214 | type = cNONE; | |
| 4581 | 25051130 | byte dontignore = 0; | |
| 4582 | 25051130 | byte dontignoreffc = 0; | |
| 4583 | |||
| 4584 |
4/4✓ Branch 0 taken 428050 times.
✓ Branch 1 taken 24623080 times.
✓ Branch 2 taken 427452 times.
✓ Branch 3 taken 598 times.
|
25051130 | if (isCuttableType(type) && MatchComboTrigger(w, combobuf.data(), cid)) |
| 4585 | { | ||
| 4586 | 598 | al_trace("This weapon (%d) can slash the combo: combobuf[%d].\n", w->id, cid); | |
| 4587 | 598 | dontignore = 1; | |
| 4588 | 598 | } | |
| 4589 | |||
| 4590 | /*to-do, ffcs | ||
| 4591 | if (isCuttableType(type2) && MatchComboTrigger(w, combobuf, cid)) | ||
| 4592 | { | ||
| 4593 | al_trace("This weapon (%d) can slash the combo: combobuf[%d].\n", w->id, cid); | ||
| 4594 | dontignoreffc = 1; | ||
| 4595 | }*/ | ||
| 4596 |
4/4✓ Branch 0 taken 25046356 times.
✓ Branch 1 taken 4774 times.
✓ Branch 2 taken 25045758 times.
✓ Branch 3 taken 598 times.
|
25051130 | if(w->useweapon != wSword && !dontignore) return; |
| 4597 | |||
| 4598 | |||
| 4599 | 5372 | int32_t i = (bx>>4) + by; | |
| 4600 |
2/2✓ Branch 0 taken 21 times.
✓ Branch 1 taken 5351 times.
|
5372 | if (get_bit(w->wscreengrid,(((bx>>4) + by))) ) return; |
| 4601 | |||
| 4602 |
2/2✓ Branch 0 taken 192 times.
✓ Branch 1 taken 5159 times.
|
5351 | if(i > 175) |
| 4603 | 192 | return; | |
| 4604 | |||
| 4605 | 5159 | bool ignorescreen=false; | |
| 4606 | 5159 | bool ignoreffc=false; | |
| 4607 | |||
| 4608 |
1/2✓ Branch 0 taken 5159 times.
✗ Branch 1 not taken.
|
5159 | if(get_bit(w->wscreengrid, i) != 0) |
| 4609 | { | ||
| 4610 | ✗ | ignorescreen = true; dontignore = 0; | |
| 4611 | ✗ | } | |
| 4612 | |||
| 4613 | 5159 | int32_t current_ffcombo = getFFCAt(fx,fy); | |
| 4614 | |||
| 4615 |
3/4✓ Branch 0 taken 266 times.
✓ Branch 1 taken 4893 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 266 times.
|
5159 | if(current_ffcombo == -1 || get_bit(ffcgrid, current_ffcombo) != 0) |
| 4616 | { | ||
| 4617 | 4893 | ignoreffc = true; | |
| 4618 | 4893 | } | |
| 4619 |
1/2✓ Branch 0 taken 266 times.
✗ Branch 1 not taken.
|
266 | else if(combobuf[tmpscr->ffcs[current_ffcombo].data].triggerflags[0] & combotriggerONLYGENTRIG) |
| 4620 | ✗ | type2 = cNONE; | |
| 4621 |
3/4✓ Branch 0 taken 4439 times.
✓ Branch 1 taken 720 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4439 times.
|
9598 | if(!isCuttableType(type) && |
| 4622 |
5/6✓ Branch 0 taken 100 times.
✓ Branch 1 taken 4339 times.
✓ Branch 2 taken 4439 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 718 times.
✓ Branch 5 taken 3721 times.
|
4439 | (flag<mfSWORD || flag>mfXSWORD) && flag!=mfSTRIKE && (flag2<mfSWORD || flag2>mfXSWORD) && flag2!=mfSTRIKE) |
| 4623 | { | ||
| 4624 | 4439 | ignorescreen = true; | |
| 4625 | 4439 | } | |
| 4626 | |||
| 4627 |
3/4✓ Branch 0 taken 5049 times.
✓ Branch 1 taken 110 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5049 times.
|
10208 | if(!isCuttableType(type2) && |
| 4628 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5049 times.
|
5049 | (flag3<mfSWORD || flag3>mfXSWORD) && flag3!=mfSTRIKE) |
| 4629 | { | ||
| 4630 | 5049 | ignoreffc = true; | |
| 4631 | 5049 | } | |
| 4632 | |||
| 4633 | 5159 | mapscr *s = tmpscr + ((currscr>=128) ? 1 : 0); | |
| 4634 | |||
| 4635 |
4/4✓ Branch 0 taken 4659 times.
✓ Branch 1 taken 316 times.
✓ Branch 2 taken 233 times.
✓ Branch 3 taken 4426 times.
|
5159 | int32_t sworditem = (directWpn>-1 && itemsbuf[directWpn].family==itype_sword) ? itemsbuf[directWpn].fam_type : current_item(itype_sword); |
| 4636 | 4975 | byte skipsecrets = 0; | |
| 4637 |
2/2✓ Branch 0 taken 4438 times.
✓ Branch 1 taken 501 times.
|
4975 | if ( isNextType(type) ) //->Next combos should not trigger secrets. Their child combo, may want to do that! -Z 17th December, 2019 |
| 4638 | { | ||
| 4639 |
2/2✓ Branch 0 taken 498 times.
✓ Branch 1 taken 3 times.
|
501 | if (get_qr(qr_OLD_SLASHNEXT_SECRETS)) |
| 4640 | { | ||
| 4641 | 498 | skipsecrets = 0; | |
| 4642 | 498 | } | |
| 4643 | 3 | else skipsecrets = 1; | |
| 4644 | 501 | } | |
| 4645 |
6/6✓ Branch 0 taken 3 times.
✓ Branch 1 taken 4936 times.
✓ Branch 2 taken 4439 times.
✓ Branch 3 taken 4436 times.
✓ Branch 4 taken 4439 times.
✓ Branch 5 taken 4933 times.
|
4939 | if((!skipsecrets || !get_qr(qr_BUGGY_BUGGY_SLASH_TRIGGERS)) && (!ignorescreen || dontignore)) |
| 4646 | { | ||
| 4647 |
3/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 608 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
9372 | if((flag >= 16)&&(flag <= 31)&&!skipsecrets) |
| 4648 | { | ||
| 4649 | ✗ | s->data[i] = s->secretcombo[(s->sflag[i])-16+4]; | |
| 4650 | ✗ | s->cset[i] = s->secretcset[(s->sflag[i])-16+4]; | |
| 4651 | ✗ | s->sflag[i] = s->secretflag[(s->sflag[i])-16+4]; | |
| 4652 | ✗ | } | |
| 4653 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 610 times.
|
610 | else if(flag == mfARMOS_SECRET) |
| 4654 | { | ||
| 4655 | ✗ | s->data[i] = s->secretcombo[sSTAIRS]; | |
| 4656 | ✗ | s->cset[i] = s->secretcset[sSTAIRS]; | |
| 4657 | ✗ | s->sflag[i] = s->secretflag[sSTAIRS]; | |
| 4658 | ✗ | sfx(tmpscr->secretsfx); | |
| 4659 | ✗ | } | |
| 4660 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 610 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 610 times.
|
610 | else if(((flag>=mfSWORD&&flag<=mfXSWORD)||(flag==mfSTRIKE))) |
| 4661 | { | ||
| 4662 | ✗ | for(int32_t i2=0; i2<=zc_min(sworditem-1,3); i2++) | |
| 4663 | { | ||
| 4664 | ✗ | findentrance(bx,by,mfSWORD+i2,true); | |
| 4665 | ✗ | } | |
| 4666 | |||
| 4667 | ✗ | findentrance(bx,by,mfSTRIKE,true); | |
| 4668 | ✗ | } | |
| 4669 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 610 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
610 | else if(((flag2 >= 16)&&(flag2 <= 31))) |
| 4670 | { | ||
| 4671 | ✗ | s->data[i] = s->secretcombo[(s->sflag[i])-16+4]; | |
| 4672 | ✗ | s->cset[i] = s->secretcset[(s->sflag[i])-16+4]; | |
| 4673 | ✗ | s->sflag[i] = s->secretflag[(s->sflag[i])-16+4]; | |
| 4674 | ✗ | } | |
| 4675 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 610 times.
|
610 | else if(flag2 == mfARMOS_SECRET) |
| 4676 | { | ||
| 4677 | ✗ | s->data[i] = s->secretcombo[sSTAIRS]; | |
| 4678 | ✗ | s->cset[i] = s->secretcset[sSTAIRS]; | |
| 4679 | ✗ | s->sflag[i] = s->secretflag[sSTAIRS]; | |
| 4680 | ✗ | sfx(tmpscr->secretsfx); | |
| 4681 | ✗ | } | |
| 4682 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 610 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 610 times.
|
610 | else if(((flag2>=mfSWORD&&flag2<=mfXSWORD)||(flag2==mfSTRIKE))) |
| 4683 | { | ||
| 4684 | ✗ | for(int32_t i2=0; i2<=zc_min(sworditem-1,3); i2++) | |
| 4685 | { | ||
| 4686 | ✗ | findentrance(bx,by,mfSWORD+i2,true); | |
| 4687 | ✗ | } | |
| 4688 | |||
| 4689 | ✗ | findentrance(bx,by,mfSTRIKE,true); | |
| 4690 | ✗ | } | |
| 4691 | else | ||
| 4692 | { | ||
| 4693 |
2/2✓ Branch 0 taken 501 times.
✓ Branch 1 taken 109 times.
|
610 | if(isCuttableNextType(type)) |
| 4694 | { | ||
| 4695 | 501 | s->data[i]++; | |
| 4696 | 501 | } | |
| 4697 | else | ||
| 4698 | { | ||
| 4699 | 109 | s->data[i] = s->undercombo; | |
| 4700 | 109 | s->cset[i] = s->undercset; | |
| 4701 | 109 | s->sflag[i] = 0; | |
| 4702 | } | ||
| 4703 | |||
| 4704 | //pausenow=true; | ||
| 4705 | } | ||
| 4706 | 610 | } | |
| 4707 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 4439 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
4439 | else if(skipsecrets && (!ignorescreen || dontignore)) |
| 4708 | { | ||
| 4709 | ✗ | if(isCuttableNextType(type)) | |
| 4710 | { | ||
| 4711 | ✗ | s->data[i]++; | |
| 4712 | ✗ | } | |
| 4713 | else | ||
| 4714 | { | ||
| 4715 | ✗ | s->data[i] = s->undercombo; | |
| 4716 | ✗ | s->cset[i] = s->undercset; | |
| 4717 | ✗ | s->sflag[i] = 0; | |
| 4718 | } | ||
| 4719 | ✗ | } | |
| 4720 | |||
| 4721 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 5049 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5049 times.
|
5049 | if(((flag3>=mfSWORD&&flag3<=mfXSWORD)||(flag3==mfSTRIKE)) && !ignoreffc) |
| 4722 | { | ||
| 4723 | ✗ | for(int32_t i2=0; i2<=zc_min(sworditem-1,3); i2++) | |
| 4724 | { | ||
| 4725 | ✗ | findentrance(bx,by,mfSWORD+i2,true); | |
| 4726 | ✗ | } | |
| 4727 | |||
| 4728 | ✗ | findentrance(fx,fy,mfSTRIKE,true); | |
| 4729 | ✗ | } | |
| 4730 |
1/2✓ Branch 0 taken 5049 times.
✗ Branch 1 not taken.
|
5049 | else if(!ignoreffc) |
| 4731 | { | ||
| 4732 | ✗ | ffcdata& ffc = s->getFFC(current_ffcombo); | |
| 4733 | ✗ | if(isCuttableNextType(type2)) | |
| 4734 | { | ||
| 4735 | ✗ | zc_ffc_modify(ffc, 1); | |
| 4736 | ✗ | } | |
| 4737 | else | ||
| 4738 | { | ||
| 4739 | ✗ | zc_ffc_set(ffc, s->undercombo); | |
| 4740 | ✗ | ffc.cset = s->undercset; | |
| 4741 | } | ||
| 4742 | ✗ | } | |
| 4743 | |||
| 4744 |
3/4✓ Branch 0 taken 4439 times.
✓ Branch 1 taken 610 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4439 times.
|
5049 | if(!ignorescreen || dontignore) |
| 4745 | { | ||
| 4746 |
3/4✓ Branch 0 taken 425 times.
✓ Branch 1 taken 185 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 425 times.
|
610 | if(!isTouchyType(type) && !get_qr(qr_CONT_SWORD_TRIGGERS)) set_bit(w->wscreengrid,i,1); |
| 4747 | |||
| 4748 |
2/8✓ Branch 0 taken 610 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 610 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
610 | if((flag==mfARMOS_ITEM||flag2==mfARMOS_ITEM) && (!getmapflag((currscr < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM) || (tmpscr->flags9&fBELOWRETURN))) |
| 4749 | { | ||
| 4750 | ✗ | items.add(new item((zfix)bx, (zfix)by,(zfix)0, tmpscr->catchall, ipONETIME2 + ipBIGRANGE + ipHOLDUP | ((tmpscr->flags8&fITEMSECRET) ? ipSECRETS : 0), 0)); | |
| 4751 | ✗ | sfx(tmpscr->secretsfx); | |
| 4752 | ✗ | } | |
| 4753 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 610 times.
|
610 | else if(isCuttableItemType(type)) |
| 4754 | { | ||
| 4755 | 610 | int32_t it = -1; | |
| 4756 | 610 | int32_t thedropset = -1; | |
| 4757 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 601 times.
|
610 | if ( (combobuf[cid].usrflags&cflag2) ) //specific dropset or item |
| 4758 | { | ||
| 4759 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
|
9 | if ( combobuf[cid].usrflags&cflag11 ) |
| 4760 | { | ||
| 4761 | ✗ | it = combobuf[cid].attribytes[1]; | |
| 4762 | ✗ | } | |
| 4763 | else | ||
| 4764 | { | ||
| 4765 | 9 | it = select_dropitem(combobuf[cid].attribytes[1]); | |
| 4766 | 9 | thedropset = combobuf[cid].attribytes[1]; | |
| 4767 | } | ||
| 4768 | 9 | } | |
| 4769 | else | ||
| 4770 | { | ||
| 4771 | 601 | it = select_dropitem(12); | |
| 4772 | 601 | thedropset = 12; | |
| 4773 | } | ||
| 4774 | |||
| 4775 |
2/2✓ Branch 0 taken 412 times.
✓ Branch 1 taken 198 times.
|
610 | if(it!=-1) |
| 4776 | { | ||
| 4777 |
4/8✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 198 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 198 times.
✗ Branch 7 not taken.
|
198 | item* itm = (new item((zfix)bx, (zfix)by,(zfix)0, it, ipBIGRANGE + ipTIMER, 0)); |
| 4778 | 198 | itm->from_dropset = thedropset; | |
| 4779 | 198 | items.add(itm); | |
| 4780 | 198 | } | |
| 4781 | 610 | } | |
| 4782 | |||
| 4783 | |||
| 4784 | 610 | putcombo(scrollbuf,(i&15)<<4,i&0xF0,s->data[i],s->cset[i]); | |
| 4785 | |||
| 4786 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 610 times.
|
610 | if(get_qr(qr_MORESOUNDS)) |
| 4787 | { | ||
| 4788 |
5/6✓ Branch 0 taken 431 times.
✓ Branch 1 taken 179 times.
✓ Branch 2 taken 331 times.
✓ Branch 3 taken 100 times.
✓ Branch 4 taken 331 times.
✗ Branch 5 not taken.
|
610 | if (!isBushType(type) && !isFlowersType(type) && !isGrassType(type)) |
| 4789 | { | ||
| 4790 | ✗ | if (combobuf[cid].usrflags&cflag3) | |
| 4791 | { | ||
| 4792 | ✗ | sfx(combobuf[cid].attribytes[2],int32_t(bx)); | |
| 4793 | ✗ | } | |
| 4794 | ✗ | } | |
| 4795 | else | ||
| 4796 | { | ||
| 4797 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 610 times.
|
610 | if (combobuf[cid].usrflags&cflag3) |
| 4798 | { | ||
| 4799 | ✗ | sfx(combobuf[cid].attribytes[2],int32_t(bx)); | |
| 4800 | ✗ | } | |
| 4801 | 610 | else sfx(QMisc.miscsfx[sfxBUSHGRASS],int32_t(bx)); | |
| 4802 | } | ||
| 4803 | 610 | } | |
| 4804 | |||
| 4805 |
3/4✓ Branch 0 taken 598 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 598 times.
✗ Branch 3 not taken.
|
610 | int16_t decotype = (combobuf[cid].usrflags & cflag1) ? ((combobuf[cid].usrflags & cflag10) ? (combobuf[cid].attribytes[0]) : (-1)) : (0); |
| 4806 |
1/2✓ Branch 0 taken 610 times.
✗ Branch 1 not taken.
|
610 | if(decotype > 3) decotype = 0; |
| 4807 |
6/8✓ Branch 0 taken 598 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 9 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 9 times.
✓ Branch 6 taken 9 times.
✗ Branch 7 not taken.
|
610 | if(!decotype) decotype = (isBushType(type) ? 1 : (isFlowersType(type) ? 2 : (isGrassType(type) ? 3 : ((combobuf[cid].usrflags & cflag1) ? -1 : -2)))); |
| 4808 |
3/6✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 501 times.
✓ Branch 4 taken 100 times.
✓ Branch 5 taken 9 times.
|
610 | switch(decotype) |
| 4809 | { | ||
| 4810 | ✗ | case -2: break; //nothing | |
| 4811 | case -1: | ||
| 4812 | ✗ | decorations.add(new comboSprite((zfix)fx, (zfix)fy, dCOMBOSPRITE, 0, combobuf[cid].attribytes[0])); | |
| 4813 | ✗ | break; | |
| 4814 |
3/6✓ Branch 0 taken 501 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 501 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 501 times.
✗ Branch 5 not taken.
|
501 | case 1: decorations.add(new dBushLeaves((zfix)fx, (zfix)fy, dBUSHLEAVES, 0, 0)); break; |
| 4815 |
3/6✓ Branch 0 taken 100 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 100 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 100 times.
✗ Branch 5 not taken.
|
100 | case 2: decorations.add(new dFlowerClippings((zfix)fx, (zfix)fy, dFLOWERCLIPPINGS, 0, 0)); break; |
| 4816 |
3/6✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
|
9 | case 3: decorations.add(new dGrassClippings((zfix)fx, (zfix)fy, dGRASSCLIPPINGS, 0, 0)); break; |
| 4817 | } | ||
| 4818 | 610 | } | |
| 4819 | |||
| 4820 |
1/2✓ Branch 0 taken 5049 times.
✗ Branch 1 not taken.
|
5049 | if(!ignoreffc) |
| 4821 | { | ||
| 4822 | ✗ | if(!isTouchyType(type2) && !get_qr(qr_CONT_SWORD_TRIGGERS)) set_bit(ffcgrid, current_ffcombo, 1); | |
| 4823 | |||
| 4824 | ✗ | if(isCuttableItemType(type2)) | |
| 4825 | { | ||
| 4826 | ✗ | int32_t it=-1; | |
| 4827 | ✗ | int32_t thedropset=-1; | |
| 4828 | ✗ | if ( (combobuf[cid].usrflags&cflag2) ) | |
| 4829 | { | ||
| 4830 | ✗ | if(combobuf[cid].usrflags&cflag11) | |
| 4831 | ✗ | it = combobuf[cid].attribytes[1]; | |
| 4832 | else | ||
| 4833 | { | ||
| 4834 | ✗ | it = select_dropitem(combobuf[cid].attribytes[1]); | |
| 4835 | ✗ | thedropset = combobuf[cid].attribytes[1]; | |
| 4836 | } | ||
| 4837 | ✗ | } | |
| 4838 | else | ||
| 4839 | { | ||
| 4840 | ✗ | int32_t r=zc_oldrand()%100; | |
| 4841 | |||
| 4842 | ✗ | if(r<15) | |
| 4843 | { | ||
| 4844 | ✗ | it=iHeart; // 15% | |
| 4845 | ✗ | } | |
| 4846 | ✗ | else if(r<35) | |
| 4847 | { | ||
| 4848 | ✗ | it=iRupy; // 20% | |
| 4849 | ✗ | } | |
| 4850 | } | ||
| 4851 | |||
| 4852 | ✗ | if(it!=-1 && itemsbuf[it].family != itype_misc) // Don't drop non-gameplay items | |
| 4853 | { | ||
| 4854 | ✗ | item* itm = (new item((zfix)fx, (zfix)fy,(zfix)0, it, ipBIGRANGE + ipTIMER, 0)); | |
| 4855 | ✗ | itm->from_dropset = thedropset; | |
| 4856 | ✗ | items.add(itm); | |
| 4857 | ✗ | } | |
| 4858 | ✗ | } | |
| 4859 | |||
| 4860 | ✗ | if(get_qr(qr_MORESOUNDS)) | |
| 4861 | { | ||
| 4862 | ✗ | if (!isBushType(type2) && !isFlowersType(type2) && !isGrassType(type2)) | |
| 4863 | { | ||
| 4864 | ✗ | if (combobuf[cid].usrflags&cflag3) | |
| 4865 | { | ||
| 4866 | ✗ | sfx(combobuf[cid].attribytes[2],int32_t(bx)); | |
| 4867 | ✗ | } | |
| 4868 | ✗ | } | |
| 4869 | else | ||
| 4870 | { | ||
| 4871 | ✗ | if (combobuf[cid].usrflags&cflag3) | |
| 4872 | { | ||
| 4873 | ✗ | sfx(combobuf[cid].attribytes[2],int32_t(bx)); | |
| 4874 | ✗ | } | |
| 4875 | ✗ | else sfx(QMisc.miscsfx[sfxBUSHGRASS],int32_t(bx)); | |
| 4876 | } | ||
| 4877 | ✗ | } | |
| 4878 | |||
| 4879 | ✗ | int16_t decotype = (combobuf[cid].usrflags & cflag1) ? ((combobuf[cid].usrflags & cflag10) ? (combobuf[cid].attribytes[0]) : (-1)) : (0); | |
| 4880 | ✗ | if(decotype > 3) decotype = 0; | |
| 4881 | ✗ | if(!decotype) decotype = (isBushType(type2) ? 1 : (isFlowersType(type2) ? 2 : (isGrassType(type2) ? 3 : ((combobuf[cid].usrflags & cflag1) ? -1 : -2)))); | |
| 4882 | ✗ | switch(decotype) | |
| 4883 | { | ||
| 4884 | ✗ | case -2: break; //nothing | |
| 4885 | case -1: | ||
| 4886 | ✗ | decorations.add(new comboSprite((zfix)fx, (zfix)fy, dCOMBOSPRITE, 0, combobuf[cid].attribytes[0])); | |
| 4887 | ✗ | break; | |
| 4888 | ✗ | case 1: decorations.add(new dBushLeaves((zfix)fx, (zfix)fy, dBUSHLEAVES, 0, 0)); break; | |
| 4889 | ✗ | case 2: decorations.add(new dFlowerClippings((zfix)fx, (zfix)fy, dFLOWERCLIPPINGS, 0, 0)); break; | |
| 4890 | ✗ | case 3: decorations.add(new dGrassClippings((zfix)fx, (zfix)fy, dGRASSCLIPPINGS, 0, 0)); break; | |
| 4891 | } | ||
| 4892 | ✗ | } | |
| 4893 | 25051020 | } | |
| 4894 | |||
| 4895 | 25051020 | void HeroClass::check_wand_block2(int32_t bx, int32_t by, weapon *w) | |
| 4896 | { | ||
| 4897 | /* | ||
| 4898 | int32_t par_item = w->parentitem; | ||
| 4899 | al_trace("check_wand_block(weapon *w): par_item is: %d\n", par_item); | ||
| 4900 | int32_t usewpn = -1; | ||
| 4901 | if ( par_item > -1 ) | ||
| 4902 | { | ||
| 4903 | usewpn = itemsbuf[par_item].useweapon; | ||
| 4904 | } | ||
| 4905 | else if ( par_item == -1 && w->ScriptGenerated ) | ||
| 4906 | { | ||
| 4907 | usewpn = w->useweapon; | ||
| 4908 | } | ||
| 4909 | al_trace("check_wand_block(weapon *w): usewpn is: %d\n", usewpn); | ||
| 4910 | */ | ||
| 4911 | |||
| 4912 | 25051020 | byte dontignore = 0; | |
| 4913 | 25051020 | byte dontignoreffc = 0; | |
| 4914 | |||
| 4915 | |||
| 4916 | |||
| 4917 | |||
| 4918 | |||
| 4919 | //keep things inside the screen boundaries | ||
| 4920 | 25051020 | bx=vbound(bx, 0, 255); | |
| 4921 | 25051020 | by=vbound(by, 0, 176); | |
| 4922 | 25051020 | int32_t fx=vbound(bx, 0, 255); | |
| 4923 | 25051020 | int32_t fy=vbound(by, 0, 176); | |
| 4924 | 25051020 | int32_t cid = MAPCOMBO(bx,by); | |
| 4925 | |||
| 4926 | //Z_scripterrlog("check_wand_block2 MatchComboTrigger() returned: %d\n", ); | ||
| 4927 |
3/4✓ Branch 0 taken 25051020 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2588 times.
✓ Branch 3 taken 25048432 times.
|
25051020 | if(w->useweapon != wWand && !MatchComboTrigger (w, combobuf.data(), cid)) return; |
| 4928 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2588 times.
|
2588 | if ( MatchComboTrigger (w, combobuf.data(), cid) ) dontignore = 1; |
| 4929 | |||
| 4930 | //first things first | ||
| 4931 |
2/4✓ Branch 0 taken 2588 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2588 times.
|
2588 | if(z>8||fakez>8) return; |
| 4932 | |||
| 4933 | //find out which combo row/column the coordinates are in | ||
| 4934 | 2588 | bx &= 0xF0; | |
| 4935 | 2588 | by &= 0xF0; | |
| 4936 | |||
| 4937 | 2588 | int32_t flag = MAPFLAG(bx,by); | |
| 4938 | 2588 | int32_t flag2 = MAPCOMBOFLAG(bx,by); | |
| 4939 | 2588 | int32_t flag3=0; | |
| 4940 | 2588 | int32_t flag31 = MAPFFCOMBOFLAG(fx,fy); | |
| 4941 | 2588 | int32_t flag32 = MAPFFCOMBOFLAG(fx,fy); | |
| 4942 | 2588 | int32_t flag33 = MAPFFCOMBOFLAG(fx,fy); | |
| 4943 | 2588 | int32_t flag34 = MAPFFCOMBOFLAG(fx,fy); | |
| 4944 | |||
| 4945 |
4/8✓ Branch 0 taken 2588 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2588 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2588 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 2588 times.
|
2588 | if(flag31==mfWAND||flag32==mfWAND||flag33==mfWAND||flag34==mfWAND) |
| 4946 | ✗ | flag3=mfWAND; | |
| 4947 | |||
| 4948 |
4/8✓ Branch 0 taken 2588 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2588 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2588 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 2588 times.
|
2588 | if(flag31==mfSTRIKE||flag32==mfSTRIKE||flag33==mfSTRIKE||flag34==mfSTRIKE) |
| 4949 | ✗ | flag3=mfSTRIKE; | |
| 4950 | |||
| 4951 | 2588 | int32_t i = (bx>>4) + by; | |
| 4952 | |||
| 4953 |
6/12✓ Branch 0 taken 2588 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2588 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2588 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2588 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2588 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2588 times.
|
2588 | if(flag!=mfWAND&&flag2!=mfWAND&&flag3!=mfWAND&&flag!=mfSTRIKE&&flag2!=mfSTRIKE&&flag3!=mfSTRIKE) |
| 4954 | 2588 | return; | |
| 4955 | |||
| 4956 | ✗ | if(i > 175) | |
| 4957 | ✗ | return; | |
| 4958 | |||
| 4959 | //mapscr *s = tmpscr + ((currscr>=128) ? 1 : 0); | ||
| 4960 | |||
| 4961 | //findentrance(bx,by,mfWAND,true); | ||
| 4962 | //findentrance(bx,by,mfSTRIKE,true); | ||
| 4963 | ✗ | if((findentrance(bx,by,mfWAND,true)==false)&&(findentrance(bx,by,mfSTRIKE,true)==false)) | |
| 4964 | { | ||
| 4965 | ✗ | if(flag3==mfWAND||flag3==mfSTRIKE) | |
| 4966 | { | ||
| 4967 | ✗ | findentrance(fx,fy,mfWAND,true); | |
| 4968 | ✗ | findentrance(fx,fy,mfSTRIKE,true); | |
| 4969 | ✗ | } | |
| 4970 | ✗ | } | |
| 4971 | |||
| 4972 | ✗ | if(dontignore) { findentrance(bx,by,mfWAND,true); } | |
| 4973 | |||
| 4974 | //putcombo(scrollbuf,(i&15)<<4,i&0xF0,s->data[i],s->cset[i]); | ||
| 4975 | 25051020 | } | |
| 4976 | |||
| 4977 | ✗ | void HeroClass::check_slash_block(weapon *w) | |
| 4978 | { | ||
| 4979 | //first things | ||
| 4980 | |||
| 4981 | ✗ | int32_t par_item = w->parentitem; | |
| 4982 | ✗ | al_trace("check_slash_block(weapon *w): par_item is: %d\n", par_item); | |
| 4983 | ✗ | int32_t usewpn = -1; | |
| 4984 | ✗ | if ( par_item > -1 ) | |
| 4985 | { | ||
| 4986 | ✗ | usewpn = itemsbuf[par_item].useweapon; | |
| 4987 | ✗ | } | |
| 4988 | ✗ | else if ( par_item == -1 && w->ScriptGenerated ) | |
| 4989 | { | ||
| 4990 | ✗ | usewpn = w->useweapon; | |
| 4991 | ✗ | } | |
| 4992 | ✗ | al_trace("check_slash_block(weapon *w): usewpn is: %d\n", usewpn); | |
| 4993 | ✗ | if(usewpn != wSword) return; | |
| 4994 | |||
| 4995 | |||
| 4996 | ✗ | int32_t bx = 0, by = 0; | |
| 4997 | ✗ | bx = ((int32_t)w->x) + (((int32_t)w->hit_width)/2); | |
| 4998 | ✗ | by = ((int32_t)w->y) + (((int32_t)w->hit_height)/2); | |
| 4999 | ✗ | al_trace("check_slash_block(weapon *w): bx is: %d\n", bx); | |
| 5000 | ✗ | al_trace("check_slash_block(weapon *w): by is: %d\n", by); | |
| 5001 | //keep things inside the screen boundaries | ||
| 5002 | ✗ | bx=vbound(bx, 0, 255); | |
| 5003 | ✗ | by=vbound(by, 0, 176); | |
| 5004 | ✗ | int32_t fx=vbound(bx, 0, 255); | |
| 5005 | ✗ | int32_t fy=vbound(by, 0, 176); | |
| 5006 | |||
| 5007 | ✗ | int32_t cid = MAPCOMBO(bx,by); | |
| 5008 | |||
| 5009 | //find out which combo row/column the coordinates are in | ||
| 5010 | ✗ | bx &= 0xF0; | |
| 5011 | ✗ | by &= 0xF0; | |
| 5012 | |||
| 5013 | ✗ | int32_t type = COMBOTYPE(bx,by); | |
| 5014 | ✗ | int32_t type2 = FFCOMBOTYPE(fx,fy); | |
| 5015 | ✗ | int32_t flag = MAPFLAG(bx,by); | |
| 5016 | ✗ | int32_t flag2 = MAPCOMBOFLAG(bx,by); | |
| 5017 | ✗ | int32_t flag3 = MAPFFCOMBOFLAG(fx,fy); | |
| 5018 | ✗ | int32_t i = (bx>>4) + by; | |
| 5019 | |||
| 5020 | ✗ | if(i > 175) | |
| 5021 | { | ||
| 5022 | ✗ | al_trace("check_slash_block(weapon *w): %s\n", "i > 175"); | |
| 5023 | ✗ | return; | |
| 5024 | } | ||
| 5025 | |||
| 5026 | ✗ | if(combobuf[cid].triggerflags[0] & combotriggerONLYGENTRIG) | |
| 5027 | ✗ | type = cNONE; | |
| 5028 | ✗ | bool ignorescreen=false; | |
| 5029 | ✗ | bool ignoreffc=false; | |
| 5030 | |||
| 5031 | ✗ | if(get_bit(screengrid, i) != 0) | |
| 5032 | { | ||
| 5033 | ✗ | ignorescreen = true; | |
| 5034 | ✗ | } | |
| 5035 | |||
| 5036 | ✗ | int32_t current_ffcombo = getFFCAt(fx,fy); | |
| 5037 | |||
| 5038 | ✗ | if(current_ffcombo == -1 || get_bit(ffcgrid, current_ffcombo) != 0) | |
| 5039 | { | ||
| 5040 | ✗ | ignoreffc = true; | |
| 5041 | ✗ | } | |
| 5042 | ✗ | else if(combobuf[tmpscr->ffcs[current_ffcombo].data].triggerflags[0] & combotriggerONLYGENTRIG) | |
| 5043 | ✗ | type2 = cNONE; | |
| 5044 | ✗ | if(!isCuttableType(type) && | |
| 5045 | ✗ | (flag<mfSWORD || flag>mfXSWORD) && flag!=mfSTRIKE && (flag2<mfSWORD || flag2>mfXSWORD) && flag2!=mfSTRIKE) | |
| 5046 | { | ||
| 5047 | ✗ | ignorescreen = true; | |
| 5048 | ✗ | } | |
| 5049 | |||
| 5050 | ✗ | if(!isCuttableType(type2) && | |
| 5051 | ✗ | (flag3<mfSWORD || flag3>mfXSWORD) && flag3!=mfSTRIKE) | |
| 5052 | { | ||
| 5053 | ✗ | ignoreffc = true; | |
| 5054 | ✗ | } | |
| 5055 | |||
| 5056 | ✗ | mapscr *s = tmpscr + ((currscr>=128) ? 1 : 0); | |
| 5057 | |||
| 5058 | ✗ | int32_t sworditem = (par_item >-1 ? itemsbuf[par_item].fam_type : current_item(itype_sword)); //Get the level of the item, else the highest sword level in inventory. | |
| 5059 | |||
| 5060 | ✗ | if(!ignorescreen) | |
| 5061 | { | ||
| 5062 | ✗ | if((flag >= 16)&&(flag <= 31)) | |
| 5063 | { | ||
| 5064 | ✗ | s->data[i] = s->secretcombo[(s->sflag[i])-16+4]; | |
| 5065 | ✗ | s->cset[i] = s->secretcset[(s->sflag[i])-16+4]; | |
| 5066 | ✗ | s->sflag[i] = s->secretflag[(s->sflag[i])-16+4]; | |
| 5067 | ✗ | } | |
| 5068 | ✗ | else if(flag == mfARMOS_SECRET) | |
| 5069 | { | ||
| 5070 | ✗ | s->data[i] = s->secretcombo[sSTAIRS]; | |
| 5071 | ✗ | s->cset[i] = s->secretcset[sSTAIRS]; | |
| 5072 | ✗ | s->sflag[i] = s->secretflag[sSTAIRS]; | |
| 5073 | ✗ | sfx(tmpscr->secretsfx); | |
| 5074 | ✗ | } | |
| 5075 | ✗ | else if(((flag>=mfSWORD&&flag<=mfXSWORD)||(flag==mfSTRIKE))) | |
| 5076 | { | ||
| 5077 | ✗ | for(int32_t i2=0; i2<=zc_min(sworditem-1,3); i2++) | |
| 5078 | { | ||
| 5079 | ✗ | findentrance(bx,by,mfSWORD+i2,true); | |
| 5080 | ✗ | } | |
| 5081 | |||
| 5082 | ✗ | findentrance(bx,by,mfSTRIKE,true); | |
| 5083 | ✗ | } | |
| 5084 | ✗ | else if(((flag2 >= 16)&&(flag2 <= 31))) | |
| 5085 | { | ||
| 5086 | ✗ | s->data[i] = s->secretcombo[(s->sflag[i])-16+4]; | |
| 5087 | ✗ | s->cset[i] = s->secretcset[(s->sflag[i])-16+4]; | |
| 5088 | ✗ | s->sflag[i] = s->secretflag[(s->sflag[i])-16+4]; | |
| 5089 | ✗ | } | |
| 5090 | ✗ | else if(flag2 == mfARMOS_SECRET) | |
| 5091 | { | ||
| 5092 | ✗ | s->data[i] = s->secretcombo[sSTAIRS]; | |
| 5093 | ✗ | s->cset[i] = s->secretcset[sSTAIRS]; | |
| 5094 | ✗ | s->sflag[i] = s->secretflag[sSTAIRS]; | |
| 5095 | ✗ | sfx(tmpscr->secretsfx); | |
| 5096 | ✗ | } | |
| 5097 | ✗ | else if(((flag2>=mfSWORD&&flag2<=mfXSWORD)||(flag2==mfSTRIKE))) | |
| 5098 | { | ||
| 5099 | ✗ | for(int32_t i2=0; i2<=zc_min(sworditem-1,3); i2++) | |
| 5100 | { | ||
| 5101 | ✗ | findentrance(bx,by,mfSWORD+i2,true); | |
| 5102 | ✗ | } | |
| 5103 | |||
| 5104 | ✗ | findentrance(bx,by,mfSTRIKE,true); | |
| 5105 | ✗ | } | |
| 5106 | else | ||
| 5107 | { | ||
| 5108 | ✗ | if(isCuttableNextType(type)) | |
| 5109 | { | ||
| 5110 | ✗ | s->data[i]++; | |
| 5111 | ✗ | } | |
| 5112 | else | ||
| 5113 | { | ||
| 5114 | ✗ | s->data[i] = s->undercombo; | |
| 5115 | ✗ | s->cset[i] = s->undercset; | |
| 5116 | ✗ | s->sflag[i] = 0; | |
| 5117 | } | ||
| 5118 | |||
| 5119 | //pausenow=true; | ||
| 5120 | } | ||
| 5121 | ✗ | } | |
| 5122 | |||
| 5123 | ✗ | if(((flag3>=mfSWORD&&flag3<=mfXSWORD)||(flag3==mfSTRIKE)) && !ignoreffc) | |
| 5124 | { | ||
| 5125 | ✗ | for(int32_t i2=0; i2<=zc_min(sworditem-1,3); i2++) | |
| 5126 | { | ||
| 5127 | ✗ | findentrance(bx,by,mfSWORD+i2,true); | |
| 5128 | ✗ | } | |
| 5129 | |||
| 5130 | ✗ | findentrance(fx,fy,mfSTRIKE,true); | |
| 5131 | ✗ | } | |
| 5132 | ✗ | else if(!ignoreffc) | |
| 5133 | { | ||
| 5134 | ✗ | ffcdata& ffc = s->getFFC(current_ffcombo); | |
| 5135 | ✗ | if(isCuttableNextType(type2)) | |
| 5136 | { | ||
| 5137 | ✗ | zc_ffc_modify(ffc, 1); | |
| 5138 | ✗ | } | |
| 5139 | else | ||
| 5140 | { | ||
| 5141 | ✗ | zc_ffc_set(ffc, s->undercombo); | |
| 5142 | ✗ | ffc.cset = s->undercset; | |
| 5143 | } | ||
| 5144 | ✗ | } | |
| 5145 | |||
| 5146 | ✗ | if(!ignorescreen) | |
| 5147 | { | ||
| 5148 | ✗ | if(!isTouchyType(type) && !get_qr(qr_CONT_SWORD_TRIGGERS)) set_bit(screengrid,i,1); | |
| 5149 | |||
| 5150 | ✗ | if((flag==mfARMOS_ITEM||flag2==mfARMOS_ITEM) && (!getmapflag((currscr < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM) || (tmpscr->flags9&fBELOWRETURN))) | |
| 5151 | { | ||
| 5152 | ✗ | items.add(new item((zfix)bx, (zfix)by,(zfix)0, tmpscr->catchall, ipONETIME2 + ipBIGRANGE + ipHOLDUP | ((tmpscr->flags8&fITEMSECRET) ? ipSECRETS : 0), 0)); | |
| 5153 | ✗ | sfx(tmpscr->secretsfx); | |
| 5154 | ✗ | } | |
| 5155 | ✗ | else if(isCuttableItemType(type)) | |
| 5156 | { | ||
| 5157 | ✗ | int32_t it = -1; | |
| 5158 | ✗ | int32_t thedropset = -1; | |
| 5159 | ✗ | if ( (combobuf[cid].usrflags&cflag2) ) //specific dropset or item | |
| 5160 | { | ||
| 5161 | ✗ | if ( combobuf[cid].usrflags&cflag11 ) | |
| 5162 | { | ||
| 5163 | ✗ | it = combobuf[cid].attribytes[1]; | |
| 5164 | ✗ | } | |
| 5165 | else | ||
| 5166 | { | ||
| 5167 | ✗ | it = select_dropitem(combobuf[cid].attribytes[1]); | |
| 5168 | ✗ | thedropset = combobuf[cid].attribytes[1]; | |
| 5169 | } | ||
| 5170 | ✗ | } | |
| 5171 | else | ||
| 5172 | { | ||
| 5173 | ✗ | it = select_dropitem(12); | |
| 5174 | ✗ | thedropset = 12; | |
| 5175 | } | ||
| 5176 | |||
| 5177 | ✗ | if(it!=-1) | |
| 5178 | { | ||
| 5179 | ✗ | item* itm = (new item((zfix)bx, (zfix)by,(zfix)0, it, ipBIGRANGE + ipTIMER, 0)); | |
| 5180 | ✗ | itm->from_dropset = thedropset; | |
| 5181 | ✗ | items.add(itm); | |
| 5182 | ✗ | } | |
| 5183 | ✗ | } | |
| 5184 | |||
| 5185 | ✗ | putcombo(scrollbuf,(i&15)<<4,i&0xF0,s->data[i],s->cset[i]); | |
| 5186 | |||
| 5187 | ✗ | if(get_qr(qr_MORESOUNDS)) | |
| 5188 | { | ||
| 5189 | ✗ | if (!isBushType(type) && !isFlowersType(type) && !isGrassType(type)) | |
| 5190 | { | ||
| 5191 | ✗ | if (combobuf[cid].usrflags&cflag3) | |
| 5192 | { | ||
| 5193 | ✗ | sfx(combobuf[cid].attribytes[2],int32_t(bx)); | |
| 5194 | ✗ | } | |
| 5195 | ✗ | } | |
| 5196 | else | ||
| 5197 | { | ||
| 5198 | ✗ | if (combobuf[cid].usrflags&cflag3) | |
| 5199 | { | ||
| 5200 | ✗ | sfx(combobuf[cid].attribytes[2],int32_t(bx)); | |
| 5201 | ✗ | } | |
| 5202 | ✗ | else sfx(QMisc.miscsfx[sfxBUSHGRASS],int32_t(bx)); | |
| 5203 | } | ||
| 5204 | ✗ | } | |
| 5205 | |||
| 5206 | ✗ | int16_t decotype = (combobuf[cid].usrflags & cflag1) ? ((combobuf[cid].usrflags & cflag10) ? (combobuf[cid].attribytes[0]) : (-1)) : (0); | |
| 5207 | ✗ | if(decotype > 3) decotype = 0; | |
| 5208 | ✗ | if(!decotype) decotype = (isBushType(type) ? 1 : (isFlowersType(type) ? 2 : (isGrassType(type) ? 3 : ((combobuf[cid].usrflags & cflag1) ? -1 : -2)))); | |
| 5209 | ✗ | switch(decotype) | |
| 5210 | { | ||
| 5211 | ✗ | case -2: break; //nothing | |
| 5212 | case -1: | ||
| 5213 | ✗ | decorations.add(new comboSprite((zfix)fx, (zfix)fy, dCOMBOSPRITE, 0, combobuf[cid].attribytes[0])); | |
| 5214 | ✗ | break; | |
| 5215 | ✗ | case 1: decorations.add(new dBushLeaves((zfix)fx, (zfix)fy, dBUSHLEAVES, 0, 0)); break; | |
| 5216 | ✗ | case 2: decorations.add(new dFlowerClippings((zfix)fx, (zfix)fy, dFLOWERCLIPPINGS, 0, 0)); break; | |
| 5217 | ✗ | case 3: decorations.add(new dGrassClippings((zfix)fx, (zfix)fy, dGRASSCLIPPINGS, 0, 0)); break; | |
| 5218 | } | ||
| 5219 | ✗ | } | |
| 5220 | |||
| 5221 | ✗ | if(!ignoreffc) | |
| 5222 | { | ||
| 5223 | ✗ | if(!isTouchyType(type2) && !get_qr(qr_CONT_SWORD_TRIGGERS)) set_bit(ffcgrid, current_ffcombo, 1); | |
| 5224 | |||
| 5225 | ✗ | if(isCuttableItemType(type2)) | |
| 5226 | { | ||
| 5227 | ✗ | int32_t it=-1; | |
| 5228 | ✗ | int32_t thedropset = -1; | |
| 5229 | ✗ | if ( (combobuf[MAPCOMBO(bx,by)-1].usrflags&cflag2) ) | |
| 5230 | { | ||
| 5231 | ✗ | if(combobuf[MAPCOMBO(bx,by)-1].usrflags&cflag11) | |
| 5232 | ✗ | it = combobuf[MAPCOMBO(bx,by)-1].attribytes[1]; | |
| 5233 | else | ||
| 5234 | { | ||
| 5235 | ✗ | thedropset = combobuf[MAPCOMBO(bx,by)-1].attribytes[1]; | |
| 5236 | ✗ | it = select_dropitem(thedropset); | |
| 5237 | } | ||
| 5238 | ✗ | } | |
| 5239 | else | ||
| 5240 | { | ||
| 5241 | ✗ | it = select_dropitem(12); | |
| 5242 | ✗ | thedropset = 12; | |
| 5243 | } | ||
| 5244 | |||
| 5245 | ✗ | if(it!=-1 && itemsbuf[it].family != itype_misc) // Don't drop non-gameplay items | |
| 5246 | { | ||
| 5247 | ✗ | item* itm = (new item((zfix)fx, (zfix)fy,(zfix)0, it, ipBIGRANGE + ipTIMER, 0)); | |
| 5248 | ✗ | itm->from_dropset = thedropset; | |
| 5249 | ✗ | items.add(itm); | |
| 5250 | ✗ | } | |
| 5251 | ✗ | } | |
| 5252 | |||
| 5253 | ✗ | if(get_qr(qr_MORESOUNDS)) | |
| 5254 | { | ||
| 5255 | ✗ | if (!isBushType(type2) && !isFlowersType(type2) && !isGrassType(type2)) | |
| 5256 | { | ||
| 5257 | ✗ | if (combobuf[cid].usrflags&cflag3) | |
| 5258 | { | ||
| 5259 | ✗ | sfx(combobuf[cid].attribytes[2],int32_t(bx)); | |
| 5260 | ✗ | } | |
| 5261 | ✗ | } | |
| 5262 | else | ||
| 5263 | { | ||
| 5264 | ✗ | if (combobuf[cid].usrflags&cflag3) | |
| 5265 | { | ||
| 5266 | ✗ | sfx(combobuf[cid].attribytes[2],int32_t(bx)); | |
| 5267 | ✗ | } | |
| 5268 | ✗ | else sfx(QMisc.miscsfx[sfxBUSHGRASS],int32_t(bx)); | |
| 5269 | } | ||
| 5270 | ✗ | } | |
| 5271 | |||
| 5272 | ✗ | int16_t decotype = (combobuf[cid].usrflags & cflag1) ? ((combobuf[cid].usrflags & cflag10) ? (combobuf[cid].attribytes[0]) : (-1)) : (0); | |
| 5273 | ✗ | if(decotype > 3) decotype = 0; | |
| 5274 | ✗ | if(!decotype) decotype = (isBushType(type2) ? 1 : (isFlowersType(type2) ? 2 : (isGrassType(type2) ? 3 : ((combobuf[cid].usrflags & cflag1) ? -1 : -2)))); | |
| 5275 | ✗ | switch(decotype) | |
| 5276 | { | ||
| 5277 | ✗ | case -2: break; //nothing | |
| 5278 | case -1: | ||
| 5279 | ✗ | decorations.add(new comboSprite((zfix)fx, (zfix)fy, dCOMBOSPRITE, 0, combobuf[cid].attribytes[0])); | |
| 5280 | ✗ | break; | |
| 5281 | ✗ | case 1: decorations.add(new dBushLeaves((zfix)fx, (zfix)fy, dBUSHLEAVES, 0, 0)); break; | |
| 5282 | ✗ | case 2: decorations.add(new dFlowerClippings((zfix)fx, (zfix)fy, dFLOWERCLIPPINGS, 0, 0)); break; | |
| 5283 | ✗ | case 3: decorations.add(new dGrassClippings((zfix)fx, (zfix)fy, dGRASSCLIPPINGS, 0, 0)); break; | |
| 5284 | } | ||
| 5285 | ✗ | } | |
| 5286 | ✗ | } | |
| 5287 | |||
| 5288 | //TODO: Boomerang that cuts bushes. -L | ||
| 5289 | /*void HeroClass::slash_bush() | ||
| 5290 | { | ||
| 5291 | |||
| 5292 | }*/ | ||
| 5293 | |||
| 5294 | 38240 | void HeroClass::check_wand_block(int32_t bx, int32_t by) | |
| 5295 | { | ||
| 5296 | //keep things inside the screen boundaries | ||
| 5297 | 38240 | bx=vbound(bx, 0, 255); | |
| 5298 | 38240 | by=vbound(by, 0, 176); | |
| 5299 | 38240 | int32_t fx=vbound(bx, 0, 255); | |
| 5300 | 38240 | int32_t fy=vbound(by, 0, 176); | |
| 5301 | 38240 | int32_t cid = MAPCOMBO(bx,by); | |
| 5302 | |||
| 5303 | //first things first | ||
| 5304 |
2/4✓ Branch 0 taken 38240 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 38240 times.
|
38240 | if(z>8||fakez>8) return; |
| 5305 | |||
| 5306 | //find out which combo row/column the coordinates are in | ||
| 5307 | 38240 | bx &= 0xF0; | |
| 5308 | 38240 | by &= 0xF0; | |
| 5309 | |||
| 5310 | 38240 | int32_t flag = MAPFLAG(bx,by); | |
| 5311 | 38240 | int32_t flag2 = MAPCOMBOFLAG(bx,by); | |
| 5312 | 38240 | int32_t flag3=0; | |
| 5313 | 38240 | int32_t flag31 = MAPFFCOMBOFLAG(fx,fy); | |
| 5314 | 38240 | int32_t flag32 = MAPFFCOMBOFLAG(fx,fy); | |
| 5315 | 38240 | int32_t flag33 = MAPFFCOMBOFLAG(fx,fy); | |
| 5316 | 38240 | int32_t flag34 = MAPFFCOMBOFLAG(fx,fy); | |
| 5317 | |||
| 5318 |
4/8✓ Branch 0 taken 38240 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 38240 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 38240 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 38240 times.
|
38240 | if(flag31==mfWAND||flag32==mfWAND||flag33==mfWAND||flag34==mfWAND) |
| 5319 | ✗ | flag3=mfWAND; | |
| 5320 | |||
| 5321 |
4/8✓ Branch 0 taken 38240 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 38240 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 38240 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 38240 times.
|
38240 | if(flag31==mfSTRIKE||flag32==mfSTRIKE||flag33==mfSTRIKE||flag34==mfSTRIKE) |
| 5322 | ✗ | flag3=mfSTRIKE; | |
| 5323 | |||
| 5324 | 38240 | int32_t i = (bx>>4) + by; | |
| 5325 | |||
| 5326 |
7/12✓ Branch 0 taken 38240 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 38240 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 38240 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 38239 times.
✓ Branch 7 taken 1 times.
✓ Branch 8 taken 38239 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 38239 times.
✗ Branch 11 not taken.
|
38240 | if(flag!=mfWAND&&flag2!=mfWAND&&flag3!=mfWAND&&flag!=mfSTRIKE&&flag2!=mfSTRIKE&&flag3!=mfSTRIKE) |
| 5327 | 38239 | return; | |
| 5328 | |||
| 5329 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if(i > 175) |
| 5330 | ✗ | return; | |
| 5331 | |||
| 5332 | //mapscr *s = tmpscr + ((currscr>=128) ? 1 : 0); | ||
| 5333 | |||
| 5334 | //findentrance(bx,by,mfWAND,true); | ||
| 5335 | //findentrance(bx,by,mfSTRIKE,true); | ||
| 5336 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | if((findentrance(bx,by,mfWAND,true)==false)&&(findentrance(bx,by,mfSTRIKE,true)==false)) |
| 5337 | { | ||
| 5338 | ✗ | if(flag3==mfWAND||flag3==mfSTRIKE) | |
| 5339 | { | ||
| 5340 | ✗ | findentrance(fx,fy,mfWAND,true); | |
| 5341 | ✗ | findentrance(fx,fy,mfSTRIKE,true); | |
| 5342 | ✗ | } | |
| 5343 | ✗ | } | |
| 5344 | |||
| 5345 | //putcombo(scrollbuf,(i&15)<<4,i&0xF0,s->data[i],s->cset[i]); | ||
| 5346 | 38240 | } | |
| 5347 | |||
| 5348 | 5120 | void HeroClass::check_pound_block(int bx, int by, weapon* w) | |
| 5349 | { | ||
| 5350 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 5120 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
5120 | if(w && w->no_triggers()) return; |
| 5351 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 5120 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
5120 | if(w && w->id == wHammer && getHammerState() < 3) |
| 5352 | ✗ | return; | |
| 5353 |
1/2✓ Branch 0 taken 5120 times.
✗ Branch 1 not taken.
|
5120 | if(get_qr(qr_POUNDLAYERS1AND2)) |
| 5354 | { | ||
| 5355 | ✗ | check_pound_block_layer(bx,by,1,w); | |
| 5356 | ✗ | check_pound_block_layer(bx,by,2,w); | |
| 5357 | ✗ | } | |
| 5358 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5120 times.
|
5120 | auto* grid = w ? w->wscreengrid : screengrid; |
| 5359 | //keep things inside the screen boundaries | ||
| 5360 | 5120 | bx=vbound(bx, 0, 255); | |
| 5361 | 5120 | by=vbound(by, 0, 176); | |
| 5362 | 5120 | int32_t fx=vbound(bx, 0, 255); | |
| 5363 | 5120 | int32_t fy=vbound(by, 0, 176); | |
| 5364 | 5120 | int32_t cid = MAPCOMBO(bx,by); | |
| 5365 | |||
| 5366 | //first things first | ||
| 5367 |
2/4✓ Branch 0 taken 5120 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5120 times.
|
5120 | if(z>8||fakez>8) return; |
| 5368 | |||
| 5369 | //find out which combo row/column the coordinates are in | ||
| 5370 | 5120 | bx &= 0xF0; | |
| 5371 | 5120 | by &= 0xF0; | |
| 5372 | |||
| 5373 | 5120 | int32_t type = COMBOTYPE(bx,by); | |
| 5374 | 5120 | int32_t type2 = FFCOMBOTYPE(fx,fy); | |
| 5375 | 5120 | int32_t flag = MAPFLAG(bx,by); | |
| 5376 | 5120 | int32_t flag2 = MAPCOMBOFLAG(bx,by); | |
| 5377 | 5120 | int32_t flag3 = MAPFFCOMBOFLAG(fx,fy); | |
| 5378 | 5120 | int32_t i = (bx>>4) + by; | |
| 5379 | |||
| 5380 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5120 times.
|
5120 | if(i > 175) |
| 5381 | ✗ | return; | |
| 5382 | |||
| 5383 | 5120 | bool ignorescreen=false; | |
| 5384 | 5120 | bool ignoreffc=false; | |
| 5385 | 5120 | bool pound=false; | |
| 5386 | |||
| 5387 |
9/10✓ Branch 0 taken 4436 times.
✓ Branch 1 taken 684 times.
✓ Branch 2 taken 4426 times.
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 4426 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 4424 times.
✓ Branch 7 taken 2 times.
✓ Branch 8 taken 2 times.
✓ Branch 9 taken 4422 times.
|
5120 | if(type!=cPOUND && flag!=mfHAMMER && flag!=mfSTRIKE && flag2!=mfHAMMER && flag2!=mfSTRIKE) |
| 5388 | 4422 | ignorescreen = true; // Affect only FFCs | |
| 5389 | |||
| 5390 |
2/2✓ Branch 0 taken 4664 times.
✓ Branch 1 taken 456 times.
|
5120 | if(get_bit(grid, i) != 0) |
| 5391 | 456 | ignorescreen = true; | |
| 5392 | |||
| 5393 | 5120 | int32_t current_ffcombo = getFFCAt(fx,fy); | |
| 5394 | |||
| 5395 |
3/4✓ Branch 0 taken 39 times.
✓ Branch 1 taken 5081 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 39 times.
|
5120 | if(current_ffcombo == -1 || get_bit(ffcgrid, current_ffcombo) != 0) |
| 5396 | 5081 | ignoreffc = true; | |
| 5397 | |||
| 5398 |
3/6✓ Branch 0 taken 5120 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5120 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 5120 times.
|
5120 | if(type2!=cPOUND && flag3!=mfSTRIKE && flag3!=mfHAMMER) |
| 5399 | 5120 | ignoreffc = true; | |
| 5400 | |||
| 5401 |
3/4✓ Branch 0 taken 4593 times.
✓ Branch 1 taken 527 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4593 times.
|
5120 | if(ignorescreen && ignoreffc) // Nothing to do. |
| 5402 | 4593 | return; | |
| 5403 | |||
| 5404 | 527 | mapscr *s = tmpscr + ((currscr>=128) ? 1 : 0); | |
| 5405 | |||
| 5406 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 527 times.
|
527 | if(!ignorescreen) |
| 5407 | { | ||
| 5408 |
3/4✓ Branch 0 taken 499 times.
✓ Branch 1 taken 28 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 499 times.
|
527 | if(flag==mfHAMMER||flag==mfSTRIKE) // Takes precedence over Secret Tile and Armos->Secret |
| 5409 | { | ||
| 5410 | 28 | findentrance(bx,by,mfHAMMER,true); | |
| 5411 | 28 | findentrance(bx,by,mfSTRIKE,true); | |
| 5412 | 28 | } | |
| 5413 |
3/4✓ Branch 0 taken 497 times.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 497 times.
|
499 | else if(flag2==mfHAMMER||flag2==mfSTRIKE) |
| 5414 | { | ||
| 5415 | 2 | findentrance(bx,by,mfHAMMER,true); | |
| 5416 | 2 | findentrance(bx,by,mfSTRIKE,true); | |
| 5417 | 2 | } | |
| 5418 |
3/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 492 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
|
497 | else if((flag >= 16)&&(flag <= 31)) |
| 5419 | { | ||
| 5420 | 5 | s->data[i] = s->secretcombo[(s->sflag[i])-16+4]; | |
| 5421 | 5 | s->cset[i] = s->secretcset[(s->sflag[i])-16+4]; | |
| 5422 | 5 | s->sflag[i] = s->secretflag[(s->sflag[i])-16+4]; | |
| 5423 | 5 | } | |
| 5424 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 492 times.
|
492 | else if(flag == mfARMOS_SECRET) |
| 5425 | { | ||
| 5426 | ✗ | s->data[i] = s->secretcombo[sSTAIRS]; | |
| 5427 | ✗ | s->cset[i] = s->secretcset[sSTAIRS]; | |
| 5428 | ✗ | s->sflag[i] = s->secretflag[sSTAIRS]; | |
| 5429 | ✗ | sfx(tmpscr->secretsfx); | |
| 5430 | ✗ | } | |
| 5431 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 486 times.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
492 | else if((flag2 >= 16)&&(flag2 <= 31)) |
| 5432 | { | ||
| 5433 | ✗ | s->data[i] = s->secretcombo[(s->sflag[i])-16+4]; | |
| 5434 | ✗ | s->cset[i] = s->secretcset[(s->sflag[i])-16+4]; | |
| 5435 | ✗ | s->sflag[i] = s->secretflag[(s->sflag[i])-16+4]; | |
| 5436 | ✗ | } | |
| 5437 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 492 times.
|
492 | else if(flag2 == mfARMOS_SECRET) |
| 5438 | { | ||
| 5439 | ✗ | s->data[i] = s->secretcombo[sSTAIRS]; | |
| 5440 | ✗ | s->cset[i] = s->secretcset[sSTAIRS]; | |
| 5441 | ✗ | s->sflag[i] = s->secretflag[sSTAIRS]; | |
| 5442 | ✗ | sfx(tmpscr->secretsfx); | |
| 5443 | ✗ | } | |
| 5444 | 492 | else pound = true; | |
| 5445 | 527 | } | |
| 5446 | |||
| 5447 |
1/2✓ Branch 0 taken 527 times.
✗ Branch 1 not taken.
|
527 | if(!ignoreffc) |
| 5448 | { | ||
| 5449 | ✗ | if(flag3==mfHAMMER||flag3==mfSTRIKE) | |
| 5450 | { | ||
| 5451 | ✗ | findentrance(fx,fy,mfHAMMER,true); | |
| 5452 | ✗ | findentrance(fx,fy,mfSTRIKE,true); | |
| 5453 | ✗ | } | |
| 5454 | else | ||
| 5455 | { | ||
| 5456 | ✗ | zc_ffc_modify(s->ffcs[current_ffcombo], 1); | |
| 5457 | } | ||
| 5458 | ✗ | } | |
| 5459 | |||
| 5460 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 527 times.
|
527 | if(!ignorescreen) |
| 5461 | { | ||
| 5462 |
2/2✓ Branch 0 taken 35 times.
✓ Branch 1 taken 492 times.
|
527 | if(pound) |
| 5463 | 492 | s->data[i]+=1; | |
| 5464 | |||
| 5465 | 527 | set_bit(grid,i,1); | |
| 5466 | |||
| 5467 |
5/8✓ Branch 0 taken 523 times.
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 523 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 4 times.
|
527 | if((flag==mfARMOS_ITEM||flag2==mfARMOS_ITEM) && (!getmapflag((currscr < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM) || (tmpscr->flags9&fBELOWRETURN))) |
| 5468 | { | ||
| 5469 |
4/8✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
|
4 | items.add(new item((zfix)bx, (zfix)by, (zfix)0, tmpscr->catchall, ipONETIME2 + ipBIGRANGE + ipHOLDUP | ((tmpscr->flags8&fITEMSECRET) ? ipSECRETS : 0), 0)); |
| 5470 | 4 | sfx(tmpscr->secretsfx); | |
| 5471 | 4 | } | |
| 5472 | |||
| 5473 |
4/4✓ Branch 0 taken 515 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 204 times.
✓ Branch 3 taken 311 times.
|
527 | if(type==cPOUND && get_qr(qr_MORESOUNDS)) |
| 5474 | 311 | sfx(QMisc.miscsfx[sfxHAMMERPOUND],int32_t(bx)); | |
| 5475 | |||
| 5476 | 527 | putcombo(scrollbuf,(i&15)<<4,i&0xF0,s->data[i],s->cset[i]); | |
| 5477 | 527 | } | |
| 5478 | |||
| 5479 |
1/2✓ Branch 0 taken 527 times.
✗ Branch 1 not taken.
|
527 | if(!ignoreffc) |
| 5480 | { | ||
| 5481 | ✗ | set_bit(ffcgrid,current_ffcombo,1); | |
| 5482 | |||
| 5483 | ✗ | if(type2==cPOUND && get_qr(qr_MORESOUNDS)) | |
| 5484 | ✗ | sfx(QMisc.miscsfx[sfxHAMMERPOUND],int32_t(bx)); | |
| 5485 | ✗ | } | |
| 5486 | |||
| 5487 | 527 | return; | |
| 5488 | 5120 | } | |
| 5489 | |||
| 5490 | ✗ | void HeroClass::check_pound_block_layer(int bx, int by, int lyr, weapon* w) | |
| 5491 | { | ||
| 5492 | ✗ | if(lyr < 1 || lyr > 2) return; //sanity | |
| 5493 | //keep things inside the screen boundaries | ||
| 5494 | ✗ | bx=vbound(bx, 0, 255); | |
| 5495 | ✗ | by=vbound(by, 0, 176); | |
| 5496 | ✗ | int32_t cid = MAPCOMBOL(lyr,bx,by); | |
| 5497 | ✗ | newcombo const& scr_cmb = combobuf[cid]; | |
| 5498 | ✗ | auto* grid = w ? w->wscreengrid_layer[lyr-1] : screengrid_layer[lyr-1]; | |
| 5499 | |||
| 5500 | //first things first | ||
| 5501 | ✗ | if(z>8||fakez>8) return; | |
| 5502 | |||
| 5503 | //find out which combo row/column the coordinates are in | ||
| 5504 | ✗ | bx &= 0xF0; | |
| 5505 | ✗ | by &= 0xF0; | |
| 5506 | |||
| 5507 | ✗ | int32_t type = scr_cmb.type; | |
| 5508 | ✗ | int32_t flag = MAPFLAGL(lyr,bx,by); | |
| 5509 | ✗ | int32_t flag2 = scr_cmb.flag; | |
| 5510 | ✗ | int32_t i = (bx>>4) + by; | |
| 5511 | |||
| 5512 | ✗ | if(i > 175) | |
| 5513 | ✗ | return; | |
| 5514 | |||
| 5515 | ✗ | bool pound=false; | |
| 5516 | |||
| 5517 | ✗ | if(type!=cPOUND && flag!=mfHAMMER && flag!=mfSTRIKE && flag2!=mfHAMMER && flag2!=mfSTRIKE) | |
| 5518 | ✗ | return; | |
| 5519 | |||
| 5520 | ✗ | if(get_bit(grid, i) != 0) | |
| 5521 | ✗ | return; | |
| 5522 | |||
| 5523 | ✗ | mapscr *s = FFCore.tempScreens[lyr]; | |
| 5524 | |||
| 5525 | ✗ | if(flag==mfHAMMER||flag==mfSTRIKE) // Takes precedence over Secret Tile and Armos->Secret | |
| 5526 | { | ||
| 5527 | ✗ | findentrance(bx,by,mfHAMMER,true); | |
| 5528 | ✗ | findentrance(bx,by,mfSTRIKE,true); | |
| 5529 | ✗ | } | |
| 5530 | ✗ | else if(flag2==mfHAMMER||flag2==mfSTRIKE) | |
| 5531 | { | ||
| 5532 | ✗ | findentrance(bx,by,mfHAMMER,true); | |
| 5533 | ✗ | findentrance(bx,by,mfSTRIKE,true); | |
| 5534 | ✗ | } | |
| 5535 | ✗ | else if((flag >= 16)&&(flag <= 31)) | |
| 5536 | { | ||
| 5537 | ✗ | s->data[i] = s->secretcombo[(s->sflag[i])-16+4]; | |
| 5538 | ✗ | s->cset[i] = s->secretcset[(s->sflag[i])-16+4]; | |
| 5539 | ✗ | s->sflag[i] = s->secretflag[(s->sflag[i])-16+4]; | |
| 5540 | ✗ | } | |
| 5541 | ✗ | else if(flag == mfARMOS_SECRET) | |
| 5542 | { | ||
| 5543 | ✗ | s->data[i] = s->secretcombo[sSTAIRS]; | |
| 5544 | ✗ | s->cset[i] = s->secretcset[sSTAIRS]; | |
| 5545 | ✗ | s->sflag[i] = s->secretflag[sSTAIRS]; | |
| 5546 | ✗ | sfx(tmpscr->secretsfx); | |
| 5547 | ✗ | } | |
| 5548 | ✗ | else if((flag2 >= 16)&&(flag2 <= 31)) | |
| 5549 | { | ||
| 5550 | ✗ | s->data[i] = s->secretcombo[(s->sflag[i])-16+4]; | |
| 5551 | ✗ | s->cset[i] = s->secretcset[(s->sflag[i])-16+4]; | |
| 5552 | ✗ | s->sflag[i] = s->secretflag[(s->sflag[i])-16+4]; | |
| 5553 | ✗ | } | |
| 5554 | ✗ | else if(flag2 == mfARMOS_SECRET) | |
| 5555 | { | ||
| 5556 | ✗ | s->data[i] = s->secretcombo[sSTAIRS]; | |
| 5557 | ✗ | s->cset[i] = s->secretcset[sSTAIRS]; | |
| 5558 | ✗ | s->sflag[i] = s->secretflag[sSTAIRS]; | |
| 5559 | ✗ | sfx(tmpscr->secretsfx); | |
| 5560 | ✗ | } | |
| 5561 | ✗ | else pound = true; | |
| 5562 | |||
| 5563 | ✗ | if(pound) | |
| 5564 | ✗ | s->data[i]+=1; | |
| 5565 | |||
| 5566 | ✗ | set_bit(grid,i,1); | |
| 5567 | |||
| 5568 | ✗ | if((flag==mfARMOS_ITEM||flag2==mfARMOS_ITEM) && (!getmapflag((currscr < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM) || (tmpscr->flags9&fBELOWRETURN))) | |
| 5569 | { | ||
| 5570 | ✗ | items.add(new item((zfix)bx, (zfix)by, (zfix)0, tmpscr->catchall, ipONETIME2 + ipBIGRANGE + ipHOLDUP | ((tmpscr->flags8&fITEMSECRET) ? ipSECRETS : 0), 0)); | |
| 5571 | ✗ | sfx(tmpscr->secretsfx); | |
| 5572 | ✗ | } | |
| 5573 | |||
| 5574 | ✗ | if(type==cPOUND && get_qr(qr_MORESOUNDS)) | |
| 5575 | ✗ | sfx(QMisc.miscsfx[sfxHAMMERPOUND],int32_t(bx)); | |
| 5576 | |||
| 5577 | ✗ | putcombo(scrollbuf,(i&15)<<4,i&0xF0,s->data[i],s->cset[i]); | |
| 5578 | ✗ | } | |
| 5579 | |||
| 5580 | ✗ | void HeroClass::check_wand_block(weapon *w) | |
| 5581 | { | ||
| 5582 | |||
| 5583 | ✗ | int32_t par_item = w->parentitem; | |
| 5584 | ✗ | al_trace("check_wand_block(weapon *w): par_item is: %d\n", par_item); | |
| 5585 | ✗ | int32_t usewpn = -1; | |
| 5586 | ✗ | if ( par_item > -1 ) | |
| 5587 | { | ||
| 5588 | ✗ | usewpn = itemsbuf[par_item].useweapon; | |
| 5589 | ✗ | } | |
| 5590 | ✗ | else if ( par_item == -1 && w->ScriptGenerated ) | |
| 5591 | { | ||
| 5592 | ✗ | usewpn = w->useweapon; | |
| 5593 | ✗ | } | |
| 5594 | ✗ | al_trace("check_wand_block(weapon *w): usewpn is: %d\n", usewpn); | |
| 5595 | ✗ | if(usewpn != wWand) return; | |
| 5596 | |||
| 5597 | |||
| 5598 | ✗ | int32_t bx = 0, by = 0; | |
| 5599 | ✗ | bx = ((int32_t)w->x) + (((int32_t)w->hit_width)/2); | |
| 5600 | ✗ | by = ((int32_t)w->y) + (((int32_t)w->hit_height)/2); | |
| 5601 | |||
| 5602 | //keep things inside the screen boundaries | ||
| 5603 | ✗ | bx=vbound(bx, 0, 255); | |
| 5604 | ✗ | by=vbound(by, 0, 176); | |
| 5605 | ✗ | int32_t fx=vbound(bx, 0, 255); | |
| 5606 | ✗ | int32_t fy=vbound(by, 0, 176); | |
| 5607 | ✗ | int32_t cid = MAPCOMBO(bx,by); | |
| 5608 | //first things first | ||
| 5609 | ✗ | if(z>8||fakez>8) return; | |
| 5610 | |||
| 5611 | //find out which combo row/column the coordinates are in | ||
| 5612 | ✗ | bx &= 0xF0; | |
| 5613 | ✗ | by &= 0xF0; | |
| 5614 | |||
| 5615 | ✗ | int32_t flag = MAPFLAG(bx,by); | |
| 5616 | ✗ | int32_t flag2 = MAPCOMBOFLAG(bx,by); | |
| 5617 | ✗ | int32_t flag3=0; | |
| 5618 | ✗ | int32_t flag31 = MAPFFCOMBOFLAG(fx,fy); | |
| 5619 | ✗ | int32_t flag32 = MAPFFCOMBOFLAG(fx,fy); | |
| 5620 | ✗ | int32_t flag33 = MAPFFCOMBOFLAG(fx,fy); | |
| 5621 | ✗ | int32_t flag34 = MAPFFCOMBOFLAG(fx,fy); | |
| 5622 | |||
| 5623 | ✗ | if(flag31==mfWAND||flag32==mfWAND||flag33==mfWAND||flag34==mfWAND) | |
| 5624 | ✗ | flag3=mfWAND; | |
| 5625 | |||
| 5626 | ✗ | if(flag31==mfSTRIKE||flag32==mfSTRIKE||flag33==mfSTRIKE||flag34==mfSTRIKE) | |
| 5627 | ✗ | flag3=mfSTRIKE; | |
| 5628 | |||
| 5629 | ✗ | int32_t i = (bx>>4) + by; | |
| 5630 | |||
| 5631 | ✗ | if(flag!=mfWAND&&flag2!=mfWAND&&flag3!=mfWAND&&flag!=mfSTRIKE&&flag2!=mfSTRIKE&&flag3!=mfSTRIKE) | |
| 5632 | ✗ | return; | |
| 5633 | |||
| 5634 | ✗ | if(i > 175) | |
| 5635 | ✗ | return; | |
| 5636 | |||
| 5637 | //mapscr *s = tmpscr + ((currscr>=128) ? 1 : 0); | ||
| 5638 | |||
| 5639 | //findentrance(bx,by,mfWAND,true); | ||
| 5640 | //findentrance(bx,by,mfSTRIKE,true); | ||
| 5641 | ✗ | if((findentrance(bx,by,mfWAND,true)==false)&&(findentrance(bx,by,mfSTRIKE,true)==false)) | |
| 5642 | { | ||
| 5643 | ✗ | if(flag3==mfWAND||flag3==mfSTRIKE) | |
| 5644 | { | ||
| 5645 | ✗ | findentrance(fx,fy,mfWAND,true); | |
| 5646 | ✗ | findentrance(fx,fy,mfSTRIKE,true); | |
| 5647 | ✗ | } | |
| 5648 | ✗ | } | |
| 5649 | |||
| 5650 | //putcombo(scrollbuf,(i&15)<<4,i&0xF0,s->data[i],s->cset[i]); | ||
| 5651 | ✗ | } | |
| 5652 | |||
| 5653 | //defend results should match defence types. | ||
| 5654 | //RETURN VALUES: | ||
| 5655 | // -1 iGNORE WEAPON | ||
| 5656 | // 0 No effects | ||
| 5657 | // 1 Effects, weapon is not ignored or removed | ||
| 5658 | 11536 | int32_t HeroClass::defend(weapon *w) | |
| 5659 | { | ||
| 5660 | 11536 | int32_t def = conv_edef_unblockable(defence[w->id], w->unblockable); | |
| 5661 |
2/25✓ Branch 0 taken 11527 times.
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
|
11536 | switch(def) |
| 5662 | { | ||
| 5663 | 11527 | case edNORMAL: return 1; | |
| 5664 | case edHALFDAMAGE: // : IMPLEMENTED : Take half damage | ||
| 5665 | { | ||
| 5666 | ✗ | w->power *= 0.5; | |
| 5667 | ✗ | return 1; | |
| 5668 | } | ||
| 5669 | case edQUARTDAMAGE: | ||
| 5670 | { | ||
| 5671 | ✗ | w->power *= 0.25; | |
| 5672 | ✗ | return 1; | |
| 5673 | } | ||
| 5674 | case edSTUNONLY: | ||
| 5675 | { | ||
| 5676 | ✗ | setStunClock(120); | |
| 5677 | ✗ | return 1; | |
| 5678 | } | ||
| 5679 | case edSTUNORCHINK: // : IMPLEMENTED : If damage > 0, stun instead. Else, bounce off. | ||
| 5680 | { | ||
| 5681 | ✗ | if (w->power > 0) | |
| 5682 | { | ||
| 5683 | ✗ | setStunClock(120); | |
| 5684 | ✗ | return 1; | |
| 5685 | } | ||
| 5686 | else | ||
| 5687 | { | ||
| 5688 | ✗ | sfx(WAV_CHINK,pan(int32_t(x))); | |
| 5689 | ✗ | w->dead = 0; | |
| 5690 | ✗ | return -1; | |
| 5691 | } | ||
| 5692 | } | ||
| 5693 | case edSTUNORIGNORE: // : IMPLEMENTED : If damage > 0, stun instead. Else, ignore. | ||
| 5694 | { | ||
| 5695 | ✗ | if (w->power > 0) | |
| 5696 | { | ||
| 5697 | ✗ | setStunClock(120); | |
| 5698 | ✗ | return 1; | |
| 5699 | } | ||
| 5700 | else | ||
| 5701 | { | ||
| 5702 | ✗ | return -1; | |
| 5703 | } | ||
| 5704 | } | ||
| 5705 | case edCHINKL1: // : IMPLEMENTED : Bounces off, plays SFX_CHINK | ||
| 5706 | { | ||
| 5707 | ✗ | if (w->power < 1) | |
| 5708 | { | ||
| 5709 | ✗ | sfx(WAV_CHINK,pan(int32_t(x))); | |
| 5710 | ✗ | w->dead = 0; | |
| 5711 | ✗ | return -1; | |
| 5712 | } | ||
| 5713 | else | ||
| 5714 | { | ||
| 5715 | ✗ | return 1; | |
| 5716 | } | ||
| 5717 | } | ||
| 5718 | case edCHINKL2: // : IMPLEMENTED : Bounce off unless damage >= 2 | ||
| 5719 | { | ||
| 5720 | ✗ | if (w->power < 2) | |
| 5721 | { | ||
| 5722 | ✗ | sfx(WAV_CHINK,pan(int32_t(x))); | |
| 5723 | ✗ | w->dead = 0; | |
| 5724 | ✗ | return -1; | |
| 5725 | } | ||
| 5726 | else | ||
| 5727 | { | ||
| 5728 | ✗ | return 1; | |
| 5729 | } | ||
| 5730 | } | ||
| 5731 | case edCHINKL4: //: IMPLEMENTED : Bounce off unless damage >= 4 | ||
| 5732 | { | ||
| 5733 | ✗ | if (w->power < 4) | |
| 5734 | { | ||
| 5735 | ✗ | sfx(WAV_CHINK,pan(int32_t(x))); | |
| 5736 | ✗ | w->dead = 0; | |
| 5737 | ✗ | return -1; | |
| 5738 | } | ||
| 5739 | else | ||
| 5740 | { | ||
| 5741 | ✗ | return 1; | |
| 5742 | } | ||
| 5743 | } | ||
| 5744 | case edCHINKL6: // : IMPLEMENTED : Bounce off unless damage >= 6 | ||
| 5745 | { | ||
| 5746 | ✗ | if (w->power < 6) | |
| 5747 | { | ||
| 5748 | ✗ | sfx(WAV_CHINK,pan(int32_t(x))); | |
| 5749 | ✗ | w->dead = 0; | |
| 5750 | ✗ | return -1; | |
| 5751 | } | ||
| 5752 | else | ||
| 5753 | { | ||
| 5754 | ✗ | return 1; | |
| 5755 | } | ||
| 5756 | } | ||
| 5757 | case edCHINKL8: // : IMPLEMENTED : Bounce off unless damage >= 8 | ||
| 5758 | { | ||
| 5759 | ✗ | if (w->power < 8) | |
| 5760 | { | ||
| 5761 | ✗ | sfx(WAV_CHINK,pan(int32_t(x))); | |
| 5762 | ✗ | w->dead = 0; | |
| 5763 | ✗ | return -1; | |
| 5764 | } | ||
| 5765 | else | ||
| 5766 | { | ||
| 5767 | ✗ | return 1; | |
| 5768 | } | ||
| 5769 | } | ||
| 5770 | case edCHINK: // : IMPLEMENTED : Bounces off, plays SFX_CHINK | ||
| 5771 | { | ||
| 5772 | ✗ | sfx(WAV_CHINK,pan(int32_t(x))); | |
| 5773 | ✗ | w->dead = 0; | |
| 5774 | ✗ | return -1; | |
| 5775 | } | ||
| 5776 | case edIGNOREL1: // : IMPLEMENTED : Ignore unless damage > 1. | ||
| 5777 | { | ||
| 5778 | ✗ | if (w->power < 1) | |
| 5779 | { | ||
| 5780 | ✗ | return -1; | |
| 5781 | } | ||
| 5782 | ✗ | else return 1; | |
| 5783 | } | ||
| 5784 | case edIGNORE: // : IMPLEMENTED : Do Nothing | ||
| 5785 | { | ||
| 5786 | ✗ | return -1; | |
| 5787 | } | ||
| 5788 | case ed1HKO: // : IMPLEMENTED : One-hit knock-out | ||
| 5789 | { | ||
| 5790 | ✗ | game->set_life(0); | |
| 5791 | ✗ | return 1; | |
| 5792 | } | ||
| 5793 | case edCHINKL10: //: IMPLEMENTED : If damage is less than 10 | ||
| 5794 | { | ||
| 5795 | ✗ | if (w->power < 10) | |
| 5796 | { | ||
| 5797 | ✗ | sfx(WAV_CHINK,pan(int32_t(x))); | |
| 5798 | ✗ | w->dead = 0; | |
| 5799 | ✗ | return -1; | |
| 5800 | } | ||
| 5801 | else | ||
| 5802 | { | ||
| 5803 | ✗ | return 1; | |
| 5804 | } | ||
| 5805 | } | ||
| 5806 | case ed2x: // : IMPLEMENTED : Double damage. | ||
| 5807 | { | ||
| 5808 | ✗ | w->power *= 2; | |
| 5809 | ✗ | return 1; | |
| 5810 | } | ||
| 5811 | case ed3x: // : IMPLEMENTED : Triple Damage. | ||
| 5812 | { | ||
| 5813 | ✗ | w->power *= 3; | |
| 5814 | ✗ | return 1; | |
| 5815 | } | ||
| 5816 | case ed4x: // : IMPLEMENTED : 4x damage. | ||
| 5817 | { | ||
| 5818 | ✗ | w->power *= 4; | |
| 5819 | ✗ | return 1; | |
| 5820 | } | ||
| 5821 | case edHEAL: // : IMPLEMENTED : Gain the weapon damage in HP. | ||
| 5822 | { | ||
| 5823 | //sfx(WAV_HEAL,pan(int32_t(x))); | ||
| 5824 | ✗ | game->set_life(zc_min(game->get_life()+w->power, game->get_maxlife())); | |
| 5825 | ✗ | w->dead = 0; | |
| 5826 | ✗ | return -1; | |
| 5827 | } | ||
| 5828 | |||
| 5829 | ✗ | case edFREEZE: return 1; //Not IMPLEMENTED | |
| 5830 | |||
| 5831 | case edLEVELDAMAGE: //Damage * item level | ||
| 5832 | { | ||
| 5833 | ✗ | w->power *= w->family_level; | |
| 5834 | ✗ | return 1; | |
| 5835 | } | ||
| 5836 | case edLEVELREDUCTION: //Damage / item level | ||
| 5837 | { | ||
| 5838 | ✗ | if ( w->family_level > 0 ) | |
| 5839 | { | ||
| 5840 | ✗ | w->power /= w->family_level; | |
| 5841 | ✗ | } | |
| 5842 | ✗ | else w->power = 0; | |
| 5843 | ✗ | return 1; | |
| 5844 | } | ||
| 5845 | |||
| 5846 | //edLEVELCHINK2, //If item level is < 2: This needs a weapon variable that is set by | ||
| 5847 | //edLEVELCHINK3, //If item level is < 3: the item that generates it (itemdata::level stored to | ||
| 5848 | //edLEVELCHINK4, //If item level is < 4: weapon::level, or something similar; then a check to | ||
| 5849 | //edLEVELCHINK5, //If item level is < 5: read weapon::level in hit detection. | ||
| 5850 | |||
| 5851 | //edSHOCK, //buzz blob | ||
| 5852 | |||
| 5853 | |||
| 5854 | case edBREAKSHIELD: //destroy the player's present shield | ||
| 5855 | { | ||
| 5856 | ✗ | w->power = 0; | |
| 5857 | ✗ | w->dead = 0; | |
| 5858 | ✗ | int32_t itemid = getCurrentShield(); | |
| 5859 | //sfx(WAV_BREAKSHIELD,pan(int32_t(x))); | ||
| 5860 | ✗ | if(itemsbuf[itemid].flags&item_edible) | |
| 5861 | ✗ | game->set_item(itemid, false); | |
| 5862 | //Remove Hero's shield | ||
| 5863 | ✗ | return -1; | |
| 5864 | } | ||
| 5865 | |||
| 5866 | |||
| 5867 | |||
| 5868 | 9 | default: return 0; | |
| 5869 | } | ||
| 5870 | 11536 | } | |
| 5871 | ✗ | ALLEGRO_COLOR HeroClass::hitboxColor(byte opacity) const | |
| 5872 | { | ||
| 5873 | ✗ | return al_map_rgba(0,0,255,opacity); | |
| 5874 | } | ||
| 5875 | 10936 | int32_t HeroClass::compareDir(int32_t other) | |
| 5876 | { | ||
| 5877 |
5/6✓ Branch 0 taken 10919 times.
✓ Branch 1 taken 17 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 10919 times.
✓ Branch 4 taken 105 times.
✓ Branch 5 taken 10831 times.
|
10936 | if(other != NORMAL_DIR(other)) |
| 5878 | 105 | return 0; //*sigh* scripts expect dirs >=8 to NOT hit shields... | |
| 5879 | 10831 | int32_t ret = 0; | |
| 5880 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10831 times.
|
10831 | auto d = (shield_forcedir < 0) ? dir : shield_forcedir; |
| 5881 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 2141 times.
✓ Branch 2 taken 1854 times.
✓ Branch 3 taken 3459 times.
✓ Branch 4 taken 3377 times.
|
10831 | switch(d) |
| 5882 | { | ||
| 5883 | case up: | ||
| 5884 | { | ||
| 5885 |
3/3✓ Branch 0 taken 509 times.
✓ Branch 1 taken 848 times.
✓ Branch 2 taken 784 times.
|
2141 | switch(X_DIR(other)) |
| 5886 | { | ||
| 5887 | case left: | ||
| 5888 | 848 | ret |= CMPDIR_RIGHT; | |
| 5889 | 848 | break; | |
| 5890 | case right: | ||
| 5891 | 784 | ret |= CMPDIR_LEFT; | |
| 5892 | 784 | break; | |
| 5893 | } | ||
| 5894 |
3/3✓ Branch 0 taken 255 times.
✓ Branch 1 taken 335 times.
✓ Branch 2 taken 1551 times.
|
2141 | switch(Y_DIR(other)) |
| 5895 | { | ||
| 5896 | case up: | ||
| 5897 | 335 | ret |= CMPDIR_BACK; | |
| 5898 | 335 | break; | |
| 5899 | case down: | ||
| 5900 | 1551 | ret |= CMPDIR_FRONT; | |
| 5901 | 1551 | break; | |
| 5902 | } | ||
| 5903 | 2141 | break; | |
| 5904 | } | ||
| 5905 | case down: | ||
| 5906 | { | ||
| 5907 |
3/3✓ Branch 0 taken 528 times.
✓ Branch 1 taken 617 times.
✓ Branch 2 taken 709 times.
|
1854 | switch(X_DIR(other)) |
| 5908 | { | ||
| 5909 | case left: | ||
| 5910 | 617 | ret |= CMPDIR_LEFT; | |
| 5911 | 617 | break; | |
| 5912 | case right: | ||
| 5913 | 709 | ret |= CMPDIR_RIGHT; | |
| 5914 | 709 | break; | |
| 5915 | } | ||
| 5916 |
3/3✓ Branch 0 taken 275 times.
✓ Branch 1 taken 1262 times.
✓ Branch 2 taken 317 times.
|
1854 | switch(Y_DIR(other)) |
| 5917 | { | ||
| 5918 | case up: | ||
| 5919 | 1262 | ret |= CMPDIR_FRONT; | |
| 5920 | 1262 | break; | |
| 5921 | case down: | ||
| 5922 | 317 | ret |= CMPDIR_BACK; | |
| 5923 | 317 | break; | |
| 5924 | } | ||
| 5925 | 1854 | break; | |
| 5926 | } | ||
| 5927 | case left: | ||
| 5928 | { | ||
| 5929 |
3/3✓ Branch 0 taken 197 times.
✓ Branch 1 taken 494 times.
✓ Branch 2 taken 2768 times.
|
3459 | switch(X_DIR(other)) |
| 5930 | { | ||
| 5931 | case left: | ||
| 5932 | 494 | ret |= CMPDIR_BACK; | |
| 5933 | 494 | break; | |
| 5934 | case right: | ||
| 5935 | 2768 | ret |= CMPDIR_FRONT; | |
| 5936 | 2768 | break; | |
| 5937 | } | ||
| 5938 |
3/3✓ Branch 0 taken 1383 times.
✓ Branch 1 taken 891 times.
✓ Branch 2 taken 1185 times.
|
3459 | switch(Y_DIR(other)) |
| 5939 | { | ||
| 5940 | case up: | ||
| 5941 | 891 | ret |= CMPDIR_LEFT; | |
| 5942 | 891 | break; | |
| 5943 | case down: | ||
| 5944 | 1185 | ret |= CMPDIR_RIGHT; | |
| 5945 | 1185 | break; | |
| 5946 | } | ||
| 5947 | 3459 | break; | |
| 5948 | } | ||
| 5949 | case right: | ||
| 5950 | { | ||
| 5951 |
3/3✓ Branch 0 taken 189 times.
✓ Branch 1 taken 2705 times.
✓ Branch 2 taken 483 times.
|
3377 | switch(X_DIR(other)) |
| 5952 | { | ||
| 5953 | case left: | ||
| 5954 | 2705 | ret |= CMPDIR_FRONT; | |
| 5955 | 2705 | break; | |
| 5956 | case right: | ||
| 5957 | 483 | ret |= CMPDIR_BACK; | |
| 5958 | 483 | break; | |
| 5959 | } | ||
| 5960 |
3/3✓ Branch 0 taken 1337 times.
✓ Branch 1 taken 832 times.
✓ Branch 2 taken 1208 times.
|
3377 | switch(Y_DIR(other)) |
| 5961 | { | ||
| 5962 | case up: | ||
| 5963 | 832 | ret |= CMPDIR_RIGHT; | |
| 5964 | 832 | break; | |
| 5965 | case down: | ||
| 5966 | 1208 | ret |= CMPDIR_LEFT; | |
| 5967 | 1208 | break; | |
| 5968 | } | ||
| 5969 | 3377 | break; | |
| 5970 | } | ||
| 5971 | } | ||
| 5972 | 10831 | return ret; | |
| 5973 | 10936 | } | |
| 5974 | |||
| 5975 | 10936 | bool compareShield(int32_t cmpdir, itemdata const& shield) | |
| 5976 | { | ||
| 5977 |
1/2✓ Branch 0 taken 10936 times.
✗ Branch 1 not taken.
|
10936 | bool standard = !(shield.flags&item_flag9) || usingActiveShield(); |
| 5978 |
1/2✓ Branch 0 taken 10936 times.
✗ Branch 1 not taken.
|
10936 | if(standard) //Use standard sides, either a passive shield, or a held active shield |
| 5979 | { | ||
| 5980 |
4/4✓ Branch 0 taken 8286 times.
✓ Branch 1 taken 2650 times.
✓ Branch 2 taken 9 times.
✓ Branch 3 taken 8277 times.
|
10936 | if((cmpdir&CMPDIR_FRONT) && (shield.flags&item_flag1)) |
| 5981 | 8277 | return true; | |
| 5982 |
3/4✓ Branch 0 taken 1629 times.
✓ Branch 1 taken 1030 times.
✓ Branch 2 taken 1629 times.
✗ Branch 3 not taken.
|
2659 | else if((cmpdir&CMPDIR_BACK) && (shield.flags&item_flag2)) |
| 5983 | ✗ | return true; | |
| 5984 |
3/4✓ Branch 0 taken 1029 times.
✓ Branch 1 taken 1630 times.
✓ Branch 2 taken 1029 times.
✗ Branch 3 not taken.
|
2659 | else if((cmpdir&CMPDIR_LEFT) && (shield.flags&item_flag3)) |
| 5985 | ✗ | return true; | |
| 5986 |
3/4✓ Branch 0 taken 1140 times.
✓ Branch 1 taken 1519 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1140 times.
|
2659 | else if((cmpdir&CMPDIR_RIGHT) && (shield.flags&item_flag4)) |
| 5987 | ✗ | return true; | |
| 5988 | 2659 | } | |
| 5989 | else //Active Shield that is NOT held down | ||
| 5990 | { | ||
| 5991 | ✗ | if((cmpdir&CMPDIR_FRONT) && (shield.flags&item_flag5)) | |
| 5992 | ✗ | return true; | |
| 5993 | ✗ | else if((cmpdir&CMPDIR_BACK) && (shield.flags&item_flag6)) | |
| 5994 | ✗ | return true; | |
| 5995 | ✗ | else if((cmpdir&CMPDIR_LEFT) && (shield.flags&item_flag7)) | |
| 5996 | ✗ | return true; | |
| 5997 | ✗ | else if((cmpdir&CMPDIR_RIGHT) && (shield.flags&item_flag8)) | |
| 5998 | ✗ | return true; | |
| 5999 | } | ||
| 6000 | 2659 | return false; | |
| 6001 | 10936 | } | |
| 6002 | |||
| 6003 | 7259 | static bool sh_check(uint fl_block, uint fl_ref, int wty, bool& reflect, bool boss, bool defret) | |
| 6004 | { | ||
| 6005 | 7259 | reflect = false; | |
| 6006 |
10/20✓ Branch 0 taken 3555 times.
✓ Branch 1 taken 329 times.
✓ Branch 2 taken 416 times.
✓ Branch 3 taken 988 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 510 times.
✓ Branch 6 taken 1039 times.
✓ Branch 7 taken 2 times.
✓ Branch 8 taken 20 times.
✓ Branch 9 taken 391 times.
✓ Branch 10 taken 9 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
|
7259 | switch(wty) |
| 6007 | { | ||
| 6008 | case ewBrang: | ||
| 6009 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | if(!(fl_block & sh_brang)) break; |
| 6010 | |||
| 6011 | 391 | reflect = ((fl_ref & sh_brang) != 0); | |
| 6012 | 391 | return true; | |
| 6013 | case ewArrow: | ||
| 6014 | case wRefArrow: | ||
| 6015 |
1/2✓ Branch 0 taken 329 times.
✗ Branch 1 not taken.
|
329 | if(!(fl_block & sh_arrow)) break; |
| 6016 | |||
| 6017 | 329 | reflect = ((fl_ref & sh_arrow) != 0); | |
| 6018 | 329 | return true; | |
| 6019 | |||
| 6020 | case ewRock: | ||
| 6021 | case wRefRock: | ||
| 6022 |
1/2✓ Branch 0 taken 416 times.
✗ Branch 1 not taken.
|
416 | if(!(fl_block & sh_rock)) break; |
| 6023 | |||
| 6024 | 416 | reflect = ((fl_ref & sh_rock) != 0); | |
| 6025 | 416 | return true; | |
| 6026 | case ewFlame: | ||
| 6027 | case wRefFire: | ||
| 6028 |
2/2✓ Branch 0 taken 639 times.
✓ Branch 1 taken 349 times.
|
988 | if(!(fl_block & sh_flame)) break; |
| 6029 | |||
| 6030 | 639 | reflect = ((fl_ref & sh_flame) != 0); | |
| 6031 | 639 | return true; | |
| 6032 | case ewFlame2: | ||
| 6033 | case wRefFire2: | ||
| 6034 | ✗ | if(get_qr(qr_BROKEN_FLAME_ARROW_REFLECTING)) | |
| 6035 | ✗ | return true; | |
| 6036 | ✗ | if(!(fl_block & sh_flame2)) break; | |
| 6037 | |||
| 6038 | ✗ | reflect = ((fl_ref & sh_flame2) != 0); | |
| 6039 | ✗ | return true; | |
| 6040 | |||
| 6041 | case ewFireball2: | ||
| 6042 | case ewFireball: | ||
| 6043 | case wRefFireball: | ||
| 6044 | { | ||
| 6045 | 3555 | int32_t mask = (boss ? sh_fireball2 : sh_fireball); | |
| 6046 | |||
| 6047 |
2/2✓ Branch 0 taken 3071 times.
✓ Branch 1 taken 484 times.
|
3555 | if(!(fl_block & mask)) break; |
| 6048 | |||
| 6049 | 3071 | reflect = ((fl_ref & mask) != 0); | |
| 6050 | 3071 | return true; | |
| 6051 | } | ||
| 6052 | |||
| 6053 | case ewSword: | ||
| 6054 | case wRefBeam: | ||
| 6055 |
2/2✓ Branch 0 taken 419 times.
✓ Branch 1 taken 91 times.
|
510 | if(!(fl_block & sh_sword)) break; |
| 6056 | |||
| 6057 | 419 | reflect = ((fl_ref & sh_sword) != 0); | |
| 6058 | 419 | return true; | |
| 6059 | |||
| 6060 | case wRefMagic: | ||
| 6061 | case ewMagic: | ||
| 6062 |
2/2✓ Branch 0 taken 969 times.
✓ Branch 1 taken 70 times.
|
1039 | if(!(fl_block & sh_magic)) break; |
| 6063 | |||
| 6064 | 969 | reflect = ((fl_ref & sh_magic) != 0); | |
| 6065 | 969 | return true; | |
| 6066 | |||
| 6067 | #define SCRIPT_SHBLOCK(scrfl) \ | ||
| 6068 | if(!(fl_block & (sh_script|scrfl))) break; \ | ||
| 6069 | reflect = ((fl_ref & (sh_script|scrfl)) != 0); \ | ||
| 6070 | return true | ||
| 6071 |
1/2✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
|
9 | case wScript1: SCRIPT_SHBLOCK(sh_script1); |
| 6072 | ✗ | case wScript2: SCRIPT_SHBLOCK(sh_script2); | |
| 6073 | ✗ | case wScript3: SCRIPT_SHBLOCK(sh_script3); | |
| 6074 | ✗ | case wScript4: SCRIPT_SHBLOCK(sh_script4); | |
| 6075 | ✗ | case wScript5: SCRIPT_SHBLOCK(sh_script5); | |
| 6076 | ✗ | case wScript6: SCRIPT_SHBLOCK(sh_script6); | |
| 6077 | ✗ | case wScript7: SCRIPT_SHBLOCK(sh_script7); | |
| 6078 | ✗ | case wScript8: SCRIPT_SHBLOCK(sh_script8); | |
| 6079 | ✗ | case wScript9: SCRIPT_SHBLOCK(sh_script9); | |
| 6080 | ✗ | case wScript10: SCRIPT_SHBLOCK(sh_script10); | |
| 6081 | #undef SCRIPT_SHBLOCK | ||
| 6082 | |||
| 6083 | case ewLitBomb: | ||
| 6084 | case ewLitSBomb: | ||
| 6085 | 2 | return true; | |
| 6086 | |||
| 6087 | default: | ||
| 6088 | 20 | return defret; | |
| 6089 | } | ||
| 6090 | 1003 | return false; | |
| 6091 | 7259 | } | |
| 6092 | |||
| 6093 | ✗ | bool HeroClass::check_ewpn_collide(weapon* w) | |
| 6094 | { | ||
| 6095 | ✗ | if(w->ignoreHero || w->fallclk|| w->drownclk) | |
| 6096 | ✗ | return false; | |
| 6097 | ✗ | if(!w->hit(x+7,y+7-fakez,z,2,2,1)) | |
| 6098 | ✗ | return false; | |
| 6099 | |||
| 6100 | ✗ | int32_t stompid = current_item_id(itype_stompboots); | |
| 6101 | |||
| 6102 | ✗ | if(current_item(itype_stompboots) && checkbunny(stompid) && checkmagiccost(stompid) && (stomping || | |
| 6103 | ✗ | ((z+fakez) > (w->z+(w->fakez))) || | |
| 6104 | ✗ | ((isSideViewHero() && (y+16)-(w->y)<=14) && falling_oldy<y))) | |
| 6105 | { | ||
| 6106 | ✗ | itemdata const& stomp = itemsbuf[stompid]; | |
| 6107 | ✗ | bool reflect = false; //unused, always false | |
| 6108 | ✗ | if(!sh_check(stomp.misc2, 0, w->id, reflect, w->type&1, true)) | |
| 6109 | { | ||
| 6110 | ✗ | w->onhit(false); | |
| 6111 | ✗ | sfx(WAV_CHINK,pan(x.getInt())); | |
| 6112 | ✗ | return false; | |
| 6113 | } | ||
| 6114 | ✗ | } | |
| 6115 | |||
| 6116 | ✗ | int32_t defresult = defend(w); | |
| 6117 | ✗ | if ( defresult == -1 ) return false; //The weapon did something special, but it is otherwise ignored, possibly killed by defend(). | |
| 6118 | |||
| 6119 | ✗ | if(w->id==ewWind) | |
| 6120 | { | ||
| 6121 | ✗ | xofs=1000; | |
| 6122 | ✗ | action=freeze; FFCore.setHeroAction(freeze); | |
| 6123 | ✗ | w->misc=999; // in enemy wind | |
| 6124 | ✗ | attackclk=0; | |
| 6125 | ✗ | return false; | |
| 6126 | } | ||
| 6127 | |||
| 6128 | ✗ | switch(w->id) | |
| 6129 | { | ||
| 6130 | case ewLitBomb: | ||
| 6131 | case ewBomb: | ||
| 6132 | case ewLitSBomb: | ||
| 6133 | case ewSBomb: | ||
| 6134 | ✗ | return true; | |
| 6135 | } | ||
| 6136 | |||
| 6137 | ✗ | int32_t itemid = getCurrentShield(false); | |
| 6138 | ✗ | if(itemid<0 || !(checkbunny(itemid) && checkmagiccost(itemid))) | |
| 6139 | ✗ | return true; | |
| 6140 | ✗ | itemdata const& shield = itemsbuf[itemid]; | |
| 6141 | ✗ | bool allow_inactive = (shield.flags & item_flag9); | |
| 6142 | ✗ | auto cmpdir = compareDir(w->dir); | |
| 6143 | ✗ | bool hitshield = compareShield(cmpdir, shield); | |
| 6144 | |||
| 6145 | ✗ | if(!allow_inactive && ((lift_wpn && (liftflags & LIFTFL_DIS_SHIELD)) || (action==attacking||action==sideswimattacking) || action==swimming || action == sideswimming || action == sideswimattacking || charging > 0 || spins > 0 || hopclk==0xFF)) | |
| 6146 | ✗ | return true; | |
| 6147 | |||
| 6148 | ✗ | if(!hitshield) | |
| 6149 | ✗ | return true; | |
| 6150 | |||
| 6151 | ✗ | paymagiccost(itemid); | |
| 6152 | |||
| 6153 | ✗ | bool reflect = false; | |
| 6154 | |||
| 6155 | ✗ | if(!sh_check(shield.misc1, shield.misc2, w->id, reflect, w->type&1, true)) | |
| 6156 | ✗ | return true; | |
| 6157 | |||
| 6158 | ✗ | if(reflect && (w->unblockable&WPNUNB_REFL)) | |
| 6159 | ✗ | reflect = false; | |
| 6160 | ✗ | if(!reflect && (w->unblockable&WPNUNB_SHLD)) | |
| 6161 | ✗ | return true; | |
| 6162 | |||
| 6163 | ✗ | int32_t oldid = w->id; | |
| 6164 | ✗ | w->onhit(false, reflect ? 2 : 1, dir); | |
| 6165 | |||
| 6166 | ✗ | sfx(shield.usesound,pan(x.getInt())); | |
| 6167 | ✗ | return true; | |
| 6168 | ✗ | } | |
| 6169 | |||
| 6170 | 12801647 | int32_t HeroClass::EwpnHit() | |
| 6171 | { | ||
| 6172 |
2/2✓ Branch 0 taken 12796222 times.
✓ Branch 1 taken 7494126 times.
|
20290348 | for(int32_t i=0; i<Ewpns.Count(); i++) |
| 6173 | { | ||
| 6174 |
2/2✓ Branch 0 taken 7482590 times.
✓ Branch 1 taken 11536 times.
|
7494126 | if(Ewpns.spr(i)->hit(x+7,y+7-fakez,z,2,2,1)) |
| 6175 | { | ||
| 6176 | 11536 | weapon *ew = (weapon*)(Ewpns.spr(i)); | |
| 6177 | |||
| 6178 |
3/6✓ Branch 0 taken 11536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11536 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 11536 times.
|
11536 | if((ew->ignoreHero)==true || ew->fallclk|| ew->drownclk) |
| 6179 | ✗ | break; | |
| 6180 | |||
| 6181 | 11536 | int32_t stompid = current_item_id(itype_stompboots); | |
| 6182 | |||
| 6183 |
5/10✓ Branch 0 taken 6 times.
✓ Branch 1 taken 11530 times.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 6 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
11536 | if(current_item(itype_stompboots) && checkbunny(stompid) && checkmagiccost(stompid) && (stomping || |
| 6184 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | ((z+fakez) > (ew->z+(ew->fakez))) || |
| 6185 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
6 | ((isSideViewHero() && (y+16)-(ew->y)<=14) && falling_oldy<y))) |
| 6186 | { | ||
| 6187 | ✗ | itemdata const& stomp = itemsbuf[stompid]; | |
| 6188 | ✗ | bool reflect = false; //unused, always false | |
| 6189 | ✗ | if(!sh_check(stomp.misc2, 0, ew->id, reflect, ew->type&1, true)) | |
| 6190 | { | ||
| 6191 | ✗ | ew->onhit(false); | |
| 6192 | ✗ | sfx(WAV_CHINK,pan(x.getInt())); | |
| 6193 | ✗ | continue; | |
| 6194 | } | ||
| 6195 | ✗ | } | |
| 6196 | |||
| 6197 | 11536 | int32_t defresult = defend(ew); | |
| 6198 |
1/2✓ Branch 0 taken 11536 times.
✗ Branch 1 not taken.
|
11536 | if ( defresult == -1 ) return -1; //The weapon did something special, but it is otherwise ignored, possibly killed by defend(). |
| 6199 | |||
| 6200 |
2/2✓ Branch 0 taken 11533 times.
✓ Branch 1 taken 3 times.
|
11536 | if(ew->id==ewWind) |
| 6201 | { | ||
| 6202 | 3 | xofs=1000; | |
| 6203 | 3 | action=freeze; FFCore.setHeroAction(freeze); | |
| 6204 | 3 | ew->misc=999; // in enemy wind | |
| 6205 | 3 | attackclk=0; | |
| 6206 | 3 | return -1; | |
| 6207 | } | ||
| 6208 | |||
| 6209 |
2/2✓ Branch 0 taken 91 times.
✓ Branch 1 taken 11442 times.
|
11533 | switch(ew->id) |
| 6210 | { | ||
| 6211 | case ewLitBomb: | ||
| 6212 | case ewBomb: | ||
| 6213 | case ewLitSBomb: | ||
| 6214 | case ewSBomb: | ||
| 6215 | 91 | return i; | |
| 6216 | } | ||
| 6217 | |||
| 6218 | 11442 | int32_t itemid = getCurrentShield(false); | |
| 6219 |
4/6✓ Branch 0 taken 10924 times.
✓ Branch 1 taken 518 times.
✓ Branch 2 taken 10924 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 10924 times.
|
11442 | if(itemid<0 || !(checkbunny(itemid) && checkmagiccost(itemid))) |
| 6220 | 518 | return i; | |
| 6221 | 10924 | itemdata const& shield = itemsbuf[itemid]; | |
| 6222 | 10924 | bool allow_inactive = (shield.flags & item_flag9); | |
| 6223 | 10924 | auto cmpdir = compareDir(ew->dir); | |
| 6224 | 10924 | bool hitshield = compareShield(cmpdir, shield); | |
| 6225 | |||
| 6226 |
12/20✓ Branch 0 taken 10924 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 10924 times.
✓ Branch 4 taken 8814 times.
✓ Branch 5 taken 2110 times.
✓ Branch 6 taken 8814 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 8752 times.
✓ Branch 9 taken 62 times.
✓ Branch 10 taken 8752 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 8752 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 8752 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 8752 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 8752 times.
✗ Branch 19 not taken.
|
10924 | if(!allow_inactive && ((lift_wpn && (liftflags & LIFTFL_DIS_SHIELD)) || (action==attacking||action==sideswimattacking) || action==swimming || action == sideswimming || action == sideswimattacking || charging > 0 || spins > 0 || hopclk==0xFF)) |
| 6227 | 2172 | return i; | |
| 6228 | |||
| 6229 |
2/2✓ Branch 0 taken 6765 times.
✓ Branch 1 taken 1987 times.
|
8752 | if(!hitshield) |
| 6230 | 1987 | return i; | |
| 6231 | |||
| 6232 | 6765 | paymagiccost(itemid); | |
| 6233 | |||
| 6234 | 6765 | bool reflect = false; | |
| 6235 | |||
| 6236 |
2/2✓ Branch 0 taken 6111 times.
✓ Branch 1 taken 654 times.
|
6765 | if(!sh_check(shield.misc1, shield.misc2, ew->id, reflect, ew->type&1, true)) |
| 6237 | 654 | return i; | |
| 6238 | |||
| 6239 |
3/4✓ Branch 0 taken 1609 times.
✓ Branch 1 taken 4502 times.
✓ Branch 2 taken 1609 times.
✗ Branch 3 not taken.
|
6111 | if(reflect && (ew->unblockable&WPNUNB_REFL)) |
| 6240 | ✗ | reflect = false; | |
| 6241 |
3/4✓ Branch 0 taken 4502 times.
✓ Branch 1 taken 1609 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4502 times.
|
6111 | if(!reflect && (ew->unblockable&WPNUNB_SHLD)) |
| 6242 | ✗ | return i; | |
| 6243 | |||
| 6244 | 6111 | int32_t oldid = ew->id; | |
| 6245 | 6111 | ew->onhit(false, reflect ? 2 : 1, dir); | |
| 6246 | |||
| 6247 | 6111 | sfx(shield.usesound,pan(x.getInt())); | |
| 6248 | 6111 | } | |
| 6249 | 7488701 | } | |
| 6250 | |||
| 6251 | 12796222 | return -1; | |
| 6252 | 12801647 | } | |
| 6253 | |||
| 6254 | 12801657 | int32_t HeroClass::LwpnHit() //only here to check magic hits | |
| 6255 | { | ||
| 6256 |
2/2✓ Branch 0 taken 12631547 times.
✓ Branch 1 taken 4274066 times.
|
16905613 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 6257 |
2/2✓ Branch 0 taken 4103950 times.
✓ Branch 1 taken 170116 times.
|
4274072 | if(Lwpns.spr(i)->hit(x+7,y+7-fakez,z,2,2,1)) |
| 6258 | { | ||
| 6259 | 170116 | weapon *lw = (weapon*)(Lwpns.spr(i)); | |
| 6260 | |||
| 6261 |
2/2✓ Branch 0 taken 165522 times.
✓ Branch 1 taken 4594 times.
|
170116 | if((lw->ignoreHero)==true) |
| 6262 | 4594 | break; | |
| 6263 | |||
| 6264 |
2/2✓ Branch 0 taken 165506 times.
✓ Branch 1 taken 16 times.
|
165522 | switch(lw->id) |
| 6265 | { | ||
| 6266 | case wRefFireball: | ||
| 6267 | case wRefMagic: | ||
| 6268 | case wRefBeam: | ||
| 6269 | case wRefRock: | ||
| 6270 | case wRefArrow: | ||
| 6271 | case wRefFire: | ||
| 6272 | case wRefFire2: | ||
| 6273 | 16 | break; | |
| 6274 | default: | ||
| 6275 | 165506 | return -1; | |
| 6276 | } | ||
| 6277 | 16 | int32_t itemid = getCurrentShield(false); | |
| 6278 |
4/6✓ Branch 0 taken 12 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 12 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 12 times.
|
16 | if(itemid<0 || !(checkbunny(itemid) && checkmagiccost(itemid))) |
| 6279 | 4 | return i; | |
| 6280 | 12 | itemdata const& shield = itemsbuf[itemid]; | |
| 6281 | 12 | auto cmpdir = compareDir(lw->dir); | |
| 6282 | 12 | bool hitshield = compareShield(cmpdir, shield); | |
| 6283 | 12 | bool reflect = false; | |
| 6284 | |||
| 6285 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 6 times.
|
12 | if(!hitshield) |
| 6286 | 6 | return i; | |
| 6287 | |||
| 6288 | 6 | bool allow_inactive = (shield.flags & item_flag9); | |
| 6289 |
10/20✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 6 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 6 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 6 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 6 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 6 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 6 times.
✗ Branch 19 not taken.
|
6 | if(!allow_inactive && ((lift_wpn && (liftflags & LIFTFL_DIS_SHIELD)) || (action==attacking||action==sideswimattacking) || action==swimming || action == sideswimming || action == sideswimattacking || charging > 0 || spins > 0 || hopclk==0xFF)) |
| 6290 | ✗ | return i; | |
| 6291 | |||
| 6292 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | if(!sh_check(shield.misc1, shield.misc2, lw->id, reflect, lw->type&1, true)) |
| 6293 | ✗ | return i; | |
| 6294 | |||
| 6295 | 6 | paymagiccost(itemid); | |
| 6296 | |||
| 6297 | 6 | lw->onhit(false, reflect ? 2 : 1, dir); | |
| 6298 | 6 | sfx(shield.usesound,pan(x.getInt())); | |
| 6299 | 6 | } | |
| 6300 | |||
| 6301 | 12636141 | return -1; | |
| 6302 | 12801657 | } | |
| 6303 | |||
| 6304 | 105 | bool HeroClass::try_lwpn_hit(weapon* w) | |
| 6305 | { | ||
| 6306 | 105 | int32_t itemid = w->parentitem; | |
| 6307 | 105 | int indx = Lwpns.find(w); | |
| 6308 | //if ( itemdbuf[parentitem].flags&item_flags3 ) //can damage Hero | ||
| 6309 | //if ( itemsbuf[parentitem].misc1 > 0 ) //damages Hero by this amount. | ||
| 6310 |
7/12✗ Branch 0 not taken.
✓ Branch 1 taken 105 times.
✓ Branch 2 taken 35 times.
✓ Branch 3 taken 70 times.
✓ Branch 4 taken 35 times.
✓ Branch 5 taken 35 times.
✓ Branch 6 taken 35 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 35 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
105 | if((!(itemid==-1&&get_qr(qr_FIREPROOFHERO)||((itemid>-1&&itemsbuf[itemid].family==itype_candle||itemsbuf[itemid].family==itype_book)&&(itemsbuf[itemid].flags & item_flag3)))) && scriptcoldet && !fallclk && (!superman || !get_qr(qr_FIREPROOFHERO2))) |
| 6311 | { | ||
| 6312 |
2/10✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 35 times.
|
35 | if(w->id==wFire && (superman ? (diagonalMovement?w->hit(x+4,y+4-fakez,z,7,7,1):w->hit(x+7,y+7-fakez,z,2,2,1)) : w->hit(this))&& |
| 6313 | ✗ | (itemid < 0 || itemsbuf[itemid].family!=itype_divinefire)) | |
| 6314 | { | ||
| 6315 | ✗ | std::vector<int32_t> &ev = FFCore.eventData; | |
| 6316 | ✗ | ev.clear(); | |
| 6317 | ✗ | ev.push_back(lwpn_dp(indx)*10000); | |
| 6318 | ✗ | ev.push_back(w->hitdir(x,y,16,16,dir)*10000); | |
| 6319 | ✗ | ev.push_back(0); | |
| 6320 | ✗ | ev.push_back(DivineProtectionShieldClk>0?10000:0); | |
| 6321 | ✗ | ev.push_back(48*10000); | |
| 6322 | ✗ | ev.push_back(ZSD_LWPN*10000); | |
| 6323 | ✗ | ev.push_back(w->getUID()); | |
| 6324 | ✗ | ev.push_back(ZSD_NONE*10000); | |
| 6325 | ✗ | ev.push_back(0); | |
| 6326 | |||
| 6327 | ✗ | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_1); | |
| 6328 | ✗ | int32_t dmg = ev[0]/10000; | |
| 6329 | ✗ | bool nullhit = ev[2] != 0; | |
| 6330 | |||
| 6331 | ✗ | if(nullhit) {ev.clear(); return true;} | |
| 6332 | |||
| 6333 | //Args: 'damage (post-ring)','hitdir','nullifyhit','type:npc','npc uid' | ||
| 6334 | ✗ | ev[0] = ringpower(dmg)*10000; | |
| 6335 | |||
| 6336 | ✗ | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_2); | |
| 6337 | ✗ | dmg = ev[0]/10000; | |
| 6338 | ✗ | int32_t hdir = ev[1]/10000; | |
| 6339 | ✗ | nullhit = ev[2] != 0; | |
| 6340 | ✗ | bool divineprot = ev[3] != 0; | |
| 6341 | ✗ | int32_t iframes = ev[4] / 10000; | |
| 6342 | ✗ | ev.clear(); | |
| 6343 | ✗ | if(nullhit) return true; | |
| 6344 | ✗ | if (Lwpns.spr(indx) != w) | |
| 6345 | { | ||
| 6346 | ✗ | auto hit = Lwpns.find(w); | |
| 6347 | ✗ | if (hit < 0) | |
| 6348 | ✗ | w = nullptr; | |
| 6349 | else | ||
| 6350 | { | ||
| 6351 | ✗ | w = (weapon*)Lwpns.spr(hit); | |
| 6352 | ✗ | indx = hit; | |
| 6353 | } | ||
| 6354 | ✗ | } | |
| 6355 | ✗ | if(!divineprot) | |
| 6356 | { | ||
| 6357 | ✗ | game->set_life(zc_max(game->get_life()-dmg,0)); | |
| 6358 | ✗ | if (!get_qr(qr_BROKENHITBY) && w) | |
| 6359 | { | ||
| 6360 | ✗ | sethitHeroUID(HIT_BY_LWEAPON,(indx+1)); | |
| 6361 | ✗ | if (get_qr(qr_BROKENHITBY)) | |
| 6362 | { | ||
| 6363 | ✗ | sethitHeroUID(HIT_BY_LWEAPON_UID,w->getUID()); | |
| 6364 | ✗ | } | |
| 6365 | else | ||
| 6366 | { | ||
| 6367 | |||
| 6368 | ✗ | sethitHeroUID(HIT_BY_LWEAPON_UID,w->getScriptUID()); | |
| 6369 | } | ||
| 6370 | ✗ | sethitHeroUID(HIT_BY_LWEAPON_ENGINE_UID,w->getUID()); | |
| 6371 | ✗ | sethitHeroUID(HIT_BY_LWEAPON_TYPE, w->id); | |
| 6372 | ✗ | if (w->parentitem > -1) sethitHeroUID(HIT_BY_LWEAPON_PARENT_ID, w->parentitem); | |
| 6373 | ✗ | else sethitHeroUID(HIT_BY_LWEAPON_PARENT_ID, -1); | |
| 6374 | ✗ | sethitHeroUID(HIT_BY_LWEAPON_PARENT_FAMILY, itemsbuf[w->parentitem].family); | |
| 6375 | ✗ | } | |
| 6376 | ✗ | } | |
| 6377 | |||
| 6378 | ✗ | hitdir = hdir; | |
| 6379 | |||
| 6380 | ✗ | if (action != rafting && action != freeze && action != sideswimfreeze) | |
| 6381 | { | ||
| 6382 | ✗ | if (IsSideSwim()) | |
| 6383 | { | ||
| 6384 | ✗ | action=sideswimhit; FFCore.setHeroAction(sideswimhit); | |
| 6385 | ✗ | } | |
| 6386 | ✗ | else if (action == swimming || hopclk == 0xFF) | |
| 6387 | { | ||
| 6388 | ✗ | action=swimhit; FFCore.setHeroAction(swimhit); | |
| 6389 | ✗ | } | |
| 6390 | else | ||
| 6391 | { | ||
| 6392 | ✗ | action=gothit; FFCore.setHeroAction(gothit); | |
| 6393 | } | ||
| 6394 | ✗ | } | |
| 6395 | |||
| 6396 | ✗ | if(charging > 0 || spins > 0 || attack == wSword || attack == wHammer) | |
| 6397 | { | ||
| 6398 | ✗ | spins = charging = attackclk = 0; | |
| 6399 | ✗ | attack=none; | |
| 6400 | ✗ | tapping = false; | |
| 6401 | ✗ | } | |
| 6402 | |||
| 6403 | ✗ | hclk=iframes; | |
| 6404 | ✗ | sfx(getHurtSFX(),pan(x.getInt())); | |
| 6405 | ✗ | return true; | |
| 6406 | } | ||
| 6407 | 35 | } | |
| 6408 | |||
| 6409 | // check enemy weapons true, 1, -1 | ||
| 6410 | // | ||
| 6411 |
1/2✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
|
35 | if((itemsbuf[itemid].flags & item_flag6)) |
| 6412 | { | ||
| 6413 | ✗ | if(w->id==wBrang || (w->id==wHookshot&&!pull_hero)) | |
| 6414 | { | ||
| 6415 | ✗ | int32_t itemid = w->parentitem>-1 ? w->parentitem : | |
| 6416 | ✗ | directWpn>-1 ? directWpn : current_item_id(w->id==wHookshot ? (w->family_class == itype_switchhook ? itype_switchhook : itype_hookshot) : itype_brang); | |
| 6417 | ✗ | itemid = vbound(itemid, 0, MAXITEMS-1); | |
| 6418 | |||
| 6419 | ✗ | for(int32_t j=0; j<Ewpns.Count(); j++) | |
| 6420 | { | ||
| 6421 | ✗ | sprite *t = Ewpns.spr(j); | |
| 6422 | |||
| 6423 | ✗ | if(w->hit(t->x+7,t->y+7-t->fakez,t->z,2,2,1)) | |
| 6424 | { | ||
| 6425 | ✗ | bool reflect = false; | |
| 6426 | // sethitHeroUID(HIT_BY_EWEAPON,j); //set that Hero was hit by a specific eweapon index. | ||
| 6427 | ✗ | if(sh_check(itemsbuf[itemid].misc3, itemsbuf[itemid].misc4, t->id, reflect, ((weapon*)t)->type&1, false)) | |
| 6428 | { | ||
| 6429 | ✗ | w->dead=1; | |
| 6430 | ✗ | weapon *ew = ((weapon*)t); | |
| 6431 | ✗ | int32_t oldid = ew->id; | |
| 6432 | ✗ | ew->onhit(true, reflect ? 2 : 1, w->dir); | |
| 6433 | ✗ | } | |
| 6434 | |||
| 6435 | ✗ | break; | |
| 6436 | } | ||
| 6437 | ✗ | } | |
| 6438 | ✗ | } | |
| 6439 | ✗ | } | |
| 6440 | |||
| 6441 |
2/6✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 35 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
35 | if((itemsbuf[itemid].flags & item_flag2)||(itemid==-1&&get_qr(qr_OUCHBOMBS))) |
| 6442 | { | ||
| 6443 | ✗ | if(((w->id==wBomb)||(w->id==wSBomb)) && !superman && scriptcoldet && !fallclk) | |
| 6444 | { | ||
| 6445 | ✗ | bool didhit = w->hit(this); | |
| 6446 | ✗ | if(didhit) | |
| 6447 | { | ||
| 6448 | ✗ | std::vector<int32_t> &ev = FFCore.eventData; | |
| 6449 | ✗ | ev.clear(); | |
| 6450 | ✗ | ev.push_back(((w->parentitem>-1 ? itemsbuf[w->parentitem].misc3 : w->power) *game->get_hp_per_heart())*10000); | |
| 6451 | ✗ | ev.push_back(w->hitdir(x,y,16,16,dir)*10000); | |
| 6452 | ✗ | ev.push_back(0); | |
| 6453 | ✗ | ev.push_back(DivineProtectionShieldClk>0?10000:0); | |
| 6454 | ✗ | ev.push_back(48*10000); | |
| 6455 | ✗ | ev.push_back(ZSD_LWPN*10000); | |
| 6456 | ✗ | ev.push_back(w->getUID()); | |
| 6457 | ✗ | ev.push_back(ZSD_NONE*10000); | |
| 6458 | ✗ | ev.push_back(0); | |
| 6459 | |||
| 6460 | ✗ | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_1); | |
| 6461 | ✗ | int32_t dmg = ev[0]/10000; | |
| 6462 | ✗ | bool nullhit = ev[2] != 0; | |
| 6463 | |||
| 6464 | ✗ | if(nullhit) {ev.clear(); return true;} | |
| 6465 | |||
| 6466 | //Args: 'damage (post-ring)','hitdir','nullifyhit','type:npc','npc uid' | ||
| 6467 | ✗ | ev[0] = ringpower(dmg)*10000; | |
| 6468 | |||
| 6469 | ✗ | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_2); | |
| 6470 | ✗ | dmg = ev[0]/10000; | |
| 6471 | ✗ | int32_t hdir = ev[1]/10000; | |
| 6472 | ✗ | nullhit = ev[2] != 0; | |
| 6473 | ✗ | bool divineprot = ev[3] != 0; | |
| 6474 | ✗ | int32_t iframes = ev[4] / 10000; | |
| 6475 | ✗ | ev.clear(); | |
| 6476 | ✗ | if(nullhit) return true; | |
| 6477 | ✗ | if (Lwpns.spr(indx) != w) | |
| 6478 | { | ||
| 6479 | ✗ | auto hit = Lwpns.find(w); | |
| 6480 | ✗ | if (hit < 0) | |
| 6481 | ✗ | w = nullptr; | |
| 6482 | else | ||
| 6483 | { | ||
| 6484 | ✗ | w = (weapon*)Lwpns.spr(hit); | |
| 6485 | ✗ | indx = hit; | |
| 6486 | } | ||
| 6487 | ✗ | } | |
| 6488 | ✗ | if(!divineprot) | |
| 6489 | { | ||
| 6490 | ✗ | game->set_life(zc_min(game->get_maxlife(), zc_max(game->get_life()-dmg,0))); | |
| 6491 | ✗ | if (!get_qr(qr_BROKENHITBY) && w) | |
| 6492 | { | ||
| 6493 | ✗ | sethitHeroUID(HIT_BY_LWEAPON,(indx+1)); | |
| 6494 | ✗ | if (get_qr(qr_BROKENHITBY)) | |
| 6495 | { | ||
| 6496 | ✗ | sethitHeroUID(HIT_BY_LWEAPON_UID,w->getUID()); | |
| 6497 | ✗ | } | |
| 6498 | else | ||
| 6499 | { | ||
| 6500 | |||
| 6501 | ✗ | sethitHeroUID(HIT_BY_LWEAPON_UID,w->getScriptUID()); | |
| 6502 | } | ||
| 6503 | ✗ | sethitHeroUID(HIT_BY_LWEAPON_ENGINE_UID,w->getUID()); | |
| 6504 | ✗ | sethitHeroUID(HIT_BY_LWEAPON_TYPE, w->id); | |
| 6505 | ✗ | if (w->parentitem > -1) sethitHeroUID(HIT_BY_LWEAPON_PARENT_ID, w->parentitem); | |
| 6506 | ✗ | else sethitHeroUID(HIT_BY_LWEAPON_PARENT_ID, -1); | |
| 6507 | ✗ | sethitHeroUID(HIT_BY_LWEAPON_PARENT_FAMILY, itemsbuf[w->parentitem].family); | |
| 6508 | ✗ | } | |
| 6509 | ✗ | } | |
| 6510 | |||
| 6511 | ✗ | hitdir = hdir; | |
| 6512 | |||
| 6513 | ✗ | if (action != rafting && action != freeze && action != sideswimfreeze) | |
| 6514 | { | ||
| 6515 | ✗ | if (IsSideSwim()) | |
| 6516 | { | ||
| 6517 | ✗ | action=sideswimhit; FFCore.setHeroAction(sideswimhit); | |
| 6518 | ✗ | } | |
| 6519 | ✗ | else if (action == swimming || hopclk == 0xFF) | |
| 6520 | { | ||
| 6521 | ✗ | action=swimhit; FFCore.setHeroAction(swimhit); | |
| 6522 | ✗ | } | |
| 6523 | else | ||
| 6524 | { | ||
| 6525 | ✗ | action=gothit; FFCore.setHeroAction(gothit); | |
| 6526 | } | ||
| 6527 | ✗ | } | |
| 6528 | |||
| 6529 | ✗ | if(charging > 0 || spins > 0 || attack == wSword || attack == wHammer) | |
| 6530 | { | ||
| 6531 | ✗ | spins = charging = attackclk = 0; | |
| 6532 | ✗ | attack=none; | |
| 6533 | ✗ | tapping = false; | |
| 6534 | ✗ | } | |
| 6535 | |||
| 6536 | ✗ | hclk=iframes; | |
| 6537 | ✗ | sfx(getHurtSFX(),pan(x.getInt())); | |
| 6538 | ✗ | return true; | |
| 6539 | } | ||
| 6540 | ✗ | } | |
| 6541 | ✗ | } | |
| 6542 | |||
| 6543 |
4/8✓ Branch 0 taken 34 times.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 34 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 35 times.
|
35 | if(hclk==0 && w->id==wWind && w->hit(x+7,y+7-fakez,z,2,2,1) && !fairyclk) |
| 6544 | { | ||
| 6545 | ✗ | std::vector<int32_t> &ev = FFCore.eventData; | |
| 6546 | ✗ | ev.clear(); | |
| 6547 | ✗ | ev.push_back(0); | |
| 6548 | ✗ | ev.push_back(w->dir*10000); | |
| 6549 | ✗ | ev.push_back(0); | |
| 6550 | ✗ | ev.push_back(0); | |
| 6551 | ✗ | ev.push_back(ZSD_LWPN*10000); | |
| 6552 | ✗ | ev.push_back(w->getUID()); | |
| 6553 | ✗ | ev.push_back(ZSD_NONE*10000); | |
| 6554 | ✗ | ev.push_back(0); | |
| 6555 | |||
| 6556 | ✗ | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_1); | |
| 6557 | ✗ | bool nullhit = ev[2] != 0; | |
| 6558 | ✗ | if(nullhit) {ev.clear(); return true;} | |
| 6559 | |||
| 6560 | ✗ | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_2); | |
| 6561 | ✗ | int32_t hdir = ev[1]/10000; | |
| 6562 | ✗ | nullhit = ev[2] != 0; | |
| 6563 | ✗ | ev.clear(); | |
| 6564 | ✗ | if(nullhit) return true; | |
| 6565 | ✗ | if (Lwpns.spr(indx) != w) | |
| 6566 | { | ||
| 6567 | ✗ | auto hit = Lwpns.find(w); | |
| 6568 | ✗ | if (hit < 0) | |
| 6569 | ✗ | w = nullptr; | |
| 6570 | else | ||
| 6571 | { | ||
| 6572 | ✗ | w = (weapon*)Lwpns.spr(hit); | |
| 6573 | ✗ | indx = hit; | |
| 6574 | } | ||
| 6575 | ✗ | } | |
| 6576 | |||
| 6577 | ✗ | reset_hookshot(); | |
| 6578 | ✗ | xofs=1000; | |
| 6579 | ✗ | action=inwind; FFCore.setHeroAction(inwind); | |
| 6580 | ✗ | dir = hdir; | |
| 6581 | ✗ | if(w) w->dir = hdir; | |
| 6582 | ✗ | spins = charging = attackclk = 0; | |
| 6583 | |||
| 6584 | // In case Hero used two whistles in a row, summoning two whirlwinds, | ||
| 6585 | // check which whistle's whirlwind picked him up so the correct | ||
| 6586 | // warp ring will be used | ||
| 6587 | ✗ | int32_t whistle = w ? w->parentitem : -1; | |
| 6588 | |||
| 6589 | ✗ | if(whistle>-1 && itemsbuf[whistle].family==itype_whistle) | |
| 6590 | ✗ | whistleitem=whistle; | |
| 6591 | |||
| 6592 | ✗ | return true; | |
| 6593 | } | ||
| 6594 | 35 | return false; | |
| 6595 | 35 | } | |
| 6596 | |||
| 6597 | ✗ | bool HeroClass::try_ewpn_hit(weapon* w, bool force) | |
| 6598 | { | ||
| 6599 | ✗ | if(!force) | |
| 6600 | { | ||
| 6601 | ✗ | if(!check_ewpn_collide(w)) | |
| 6602 | ✗ | return false; | |
| 6603 | ✗ | if(w->ignoreHero || w->fallclk|| w->drownclk) | |
| 6604 | ✗ | return false; | |
| 6605 | ✗ | } | |
| 6606 | ✗ | auto indx = Ewpns.find(w); | |
| 6607 | ✗ | std::vector<int32_t> &ev = FFCore.eventData; | |
| 6608 | ✗ | ev.clear(); | |
| 6609 | ✗ | ev.push_back((ewpn_dp(indx)*10000)); | |
| 6610 | ✗ | ev.push_back(w->hitdir(x,y,16,16,dir)*10000); | |
| 6611 | ✗ | ev.push_back(0); | |
| 6612 | ✗ | ev.push_back(DivineProtectionShieldClk>0?10000:0); | |
| 6613 | ✗ | ev.push_back(48*10000); | |
| 6614 | ✗ | ev.push_back(ZSD_EWPN*10000); | |
| 6615 | ✗ | ev.push_back(w->getUID()); | |
| 6616 | ✗ | ev.push_back(ZSD_NONE*10000); | |
| 6617 | ✗ | ev.push_back(0); | |
| 6618 | |||
| 6619 | ✗ | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_1); | |
| 6620 | ✗ | int32_t dmg = ev[0]/10000; | |
| 6621 | ✗ | bool nullhit = ev[2] != 0; | |
| 6622 | |||
| 6623 | ✗ | if(nullhit) {ev.clear(); return false;} | |
| 6624 | |||
| 6625 | //Args: 'damage (post-ring)','hitdir','nullifyhit','type:npc','npc uid' | ||
| 6626 | ✗ | ev[0] = ringpower(dmg)*10000; | |
| 6627 | |||
| 6628 | ✗ | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_2); | |
| 6629 | ✗ | dmg = ev[0]/10000; | |
| 6630 | ✗ | int32_t hdir = ev[1]/10000; | |
| 6631 | ✗ | nullhit = ev[2] != 0; | |
| 6632 | ✗ | bool divineprot = ev[3] != 0; | |
| 6633 | ✗ | int32_t iframes = ev[4] / 10000; | |
| 6634 | ✗ | ev.clear(); | |
| 6635 | ✗ | if (nullhit) return false; | |
| 6636 | ✗ | if (Ewpns.spr(indx) != w) | |
| 6637 | { | ||
| 6638 | ✗ | indx = Ewpns.find(w); | |
| 6639 | ✗ | if (indx < 0) | |
| 6640 | ✗ | w = nullptr; | |
| 6641 | ✗ | else w = (weapon*)Ewpns.spr(indx); | |
| 6642 | ✗ | } | |
| 6643 | ✗ | if (!divineprot) | |
| 6644 | { | ||
| 6645 | ✗ | game->set_life(zc_max(game->get_life() - dmg, 0)); | |
| 6646 | ✗ | if (w) | |
| 6647 | { | ||
| 6648 | ✗ | sethitHeroUID(HIT_BY_EWEAPON, (indx + 1)); | |
| 6649 | ✗ | if (get_qr(qr_BROKENHITBY)) | |
| 6650 | { | ||
| 6651 | ✗ | sethitHeroUID(HIT_BY_EWEAPON_UID, w->getUID()); | |
| 6652 | ✗ | } | |
| 6653 | else | ||
| 6654 | { | ||
| 6655 | |||
| 6656 | ✗ | sethitHeroUID(HIT_BY_EWEAPON_UID, w->getScriptUID()); | |
| 6657 | } | ||
| 6658 | ✗ | sethitHeroUID(HIT_BY_EWEAPON_ENGINE_UID, w->getUID()); | |
| 6659 | ✗ | sethitHeroUID(HIT_BY_EWEAPON_TYPE, w->id); | |
| 6660 | ✗ | } | |
| 6661 | ✗ | } | |
| 6662 | |||
| 6663 | ✗ | hitdir = hdir; | |
| 6664 | ✗ | if(w) | |
| 6665 | ✗ | w->onhit(false); | |
| 6666 | |||
| 6667 | ✗ | if (IsSideSwim()) | |
| 6668 | { | ||
| 6669 | ✗ | action=sideswimhit; FFCore.setHeroAction(sideswimhit); | |
| 6670 | ✗ | } | |
| 6671 | ✗ | else if(action==swimming || hopclk==0xFF) | |
| 6672 | { | ||
| 6673 | ✗ | action=swimhit; FFCore.setHeroAction(swimhit); | |
| 6674 | ✗ | } | |
| 6675 | else | ||
| 6676 | { | ||
| 6677 | ✗ | action=gothit; FFCore.setHeroAction(gothit); | |
| 6678 | } | ||
| 6679 | |||
| 6680 | ✗ | hclk=iframes; | |
| 6681 | |||
| 6682 | ✗ | if(charging > 0 || spins > 0 || attack == wSword || attack == wHammer) | |
| 6683 | { | ||
| 6684 | ✗ | spins = charging = attackclk = 0; | |
| 6685 | ✗ | attack=none; | |
| 6686 | ✗ | tapping = false; | |
| 6687 | ✗ | } | |
| 6688 | |||
| 6689 | ✗ | sfx(getHurtSFX(),pan(x.getInt())); | |
| 6690 | ✗ | return true; | |
| 6691 | ✗ | } | |
| 6692 | |||
| 6693 | 20513699 | void HeroClass::checkhit() | |
| 6694 | { | ||
| 6695 |
2/2✓ Branch 0 taken 6360270 times.
✓ Branch 1 taken 14153429 times.
|
20513699 | if(checkhero==true) |
| 6696 | { | ||
| 6697 |
2/2✓ Branch 0 taken 13446782 times.
✓ Branch 1 taken 706647 times.
|
14153429 | if(hclk>0) |
| 6698 | { | ||
| 6699 | 706647 | --hclk; | |
| 6700 | 706647 | } | |
| 6701 | |||
| 6702 |
1/2✓ Branch 0 taken 14153429 times.
✗ Branch 1 not taken.
|
14153429 | if(DivineProtectionShieldClk>0) |
| 6703 | { | ||
| 6704 | ✗ | --DivineProtectionShieldClk; | |
| 6705 | |||
| 6706 | ✗ | if(DivineProtectionShieldClk == 0 && div_prot_item != -1) | |
| 6707 | { | ||
| 6708 | ✗ | stop_sfx(itemsbuf[div_prot_item].usesound); | |
| 6709 | ✗ | stop_sfx(itemsbuf[div_prot_item].usesound+1); | |
| 6710 | ✗ | div_prot_item = -1; | |
| 6711 | ✗ | } | |
| 6712 | ✗ | else if(get_qr(qr_MORESOUNDS) && !(DivineProtectionShieldClk&0xF00) && div_prot_item != -1) | |
| 6713 | { | ||
| 6714 | ✗ | stop_sfx(itemsbuf[div_prot_item].usesound); | |
| 6715 | ✗ | cont_sfx(itemsbuf[div_prot_item].usesound+1); | |
| 6716 | ✗ | } | |
| 6717 | ✗ | } | |
| 6718 | 14153429 | } | |
| 6719 | |||
| 6720 |
4/4✓ Branch 0 taken 14018317 times.
✓ Branch 1 taken 6495382 times.
✓ Branch 2 taken 14010519 times.
✓ Branch 3 taken 7798 times.
|
20513699 | if(hclk<39 && action==gothit) |
| 6721 | { | ||
| 6722 | 7798 | action=none; FFCore.setHeroAction(none); | |
| 6723 | 7798 | } | |
| 6724 | |||
| 6725 |
5/6✓ Branch 0 taken 14018317 times.
✓ Branch 1 taken 6495382 times.
✓ Branch 2 taken 14018192 times.
✓ Branch 3 taken 125 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 14018192 times.
|
20513699 | if(hclk<39 && (action==swimhit || action == sideswimhit)) |
| 6726 | { | ||
| 6727 | 125 | SetSwim(); | |
| 6728 | 125 | } | |
| 6729 | |||
| 6730 |
4/4✓ Branch 0 taken 120187 times.
✓ Branch 1 taken 20393512 times.
✓ Branch 2 taken 34122 times.
✓ Branch 3 taken 86065 times.
|
20513699 | if(hclk>=40 && action==gothit) |
| 6731 | { | ||
| 6732 | 86065 | int val = check_pitslide(); | |
| 6733 |
4/4✓ Branch 0 taken 428 times.
✓ Branch 1 taken 85637 times.
✓ Branch 2 taken 86241 times.
✓ Branch 3 taken 85813 times.
|
86065 | if(((ladderx+laddery) && ((hitdir&2)==ladderdir))||(!(ladderx+laddery))) |
| 6734 | { | ||
| 6735 |
2/2✓ Branch 0 taken 344964 times.
✓ Branch 1 taken 86241 times.
|
431205 | for(int32_t i=0; i<4; i++) |
| 6736 | { | ||
| 6737 |
5/5✓ Branch 0 taken 4416 times.
✓ Branch 1 taken 73392 times.
✓ Branch 2 taken 83040 times.
✓ Branch 3 taken 90220 times.
✓ Branch 4 taken 93896 times.
|
344964 | switch(hitdir) |
| 6738 | { | ||
| 6739 | case up: | ||
| 6740 |
6/6✓ Branch 0 taken 5359 times.
✓ Branch 1 taken 68033 times.
✓ Branch 2 taken 11472 times.
✓ Branch 3 taken 56561 times.
✓ Branch 4 taken 5501 times.
✓ Branch 5 taken 67891 times.
|
73392 | if(hit_walkflag(x,y+(bigHitbox?-1:7),2)||(x.getInt()&7?hit_walkflag(x+16,y+(bigHitbox?-1:7),1):0)) |
| 6741 | { | ||
| 6742 | 5501 | action=none; FFCore.setHeroAction(none); | |
| 6743 | 5501 | } | |
| 6744 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 67867 times.
|
67891 | else if (val == -1) --y; |
| 6745 | |||
| 6746 | 73392 | break; | |
| 6747 | |||
| 6748 | case down: | ||
| 6749 |
6/6✓ Branch 0 taken 6883 times.
✓ Branch 1 taken 76157 times.
✓ Branch 2 taken 12972 times.
✓ Branch 3 taken 63185 times.
✓ Branch 4 taken 7041 times.
✓ Branch 5 taken 75999 times.
|
83040 | if(hit_walkflag(x,y+16,2)||(x.getInt()&7?hit_walkflag(x+16,y+16,1):0)) |
| 6750 | { | ||
| 6751 | 7041 | action=none; FFCore.setHeroAction(none); | |
| 6752 | 7041 | } | |
| 6753 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 75999 times.
|
75999 | else if (val == -1) ++y; |
| 6754 | |||
| 6755 | 83040 | break; | |
| 6756 | |||
| 6757 | case left: | ||
| 6758 |
7/8✓ Branch 0 taken 86860 times.
✓ Branch 1 taken 3360 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 86860 times.
✓ Branch 4 taken 76128 times.
✓ Branch 5 taken 10732 times.
✓ Branch 6 taken 3527 times.
✓ Branch 7 taken 86693 times.
|
90220 | if(hit_walkflag(x-1,y+(bigHitbox?0:8),1)||hit_walkflag(x-1,y+8,1)||(y.getInt()&7?hit_walkflag(x-1,y+16,1):0)) |
| 6759 | { | ||
| 6760 | 3527 | action=none; FFCore.setHeroAction(none); | |
| 6761 | 3527 | } | |
| 6762 |
2/2✓ Branch 0 taken 86657 times.
✓ Branch 1 taken 36 times.
|
86693 | else if (val == -1) --x; |
| 6763 | |||
| 6764 | 90220 | break; | |
| 6765 | |||
| 6766 | case right: | ||
| 6767 |
8/8✓ Branch 0 taken 89850 times.
✓ Branch 1 taken 4046 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 89846 times.
✓ Branch 4 taken 9754 times.
✓ Branch 5 taken 80092 times.
✓ Branch 6 taken 4155 times.
✓ Branch 7 taken 89741 times.
|
93896 | if(hit_walkflag(x+16,y+(bigHitbox?0:8),1)||hit_walkflag(x+16,y+8,1)||(y.getInt()&7?hit_walkflag(x+16,y+16,1):0)) |
| 6768 | { | ||
| 6769 | 4155 | action=none; FFCore.setHeroAction(none); | |
| 6770 | 4155 | } | |
| 6771 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 89741 times.
|
89741 | else if (val == -1) ++x; |
| 6772 | |||
| 6773 | 93896 | break; | |
| 6774 | } | ||
| 6775 | 344964 | } | |
| 6776 | 86241 | } | |
| 6777 | 86417 | } | |
| 6778 | |||
| 6779 |
19/20✓ Branch 0 taken 13461127 times.
✓ Branch 1 taken 7052924 times.
✓ Branch 2 taken 13460178 times.
✓ Branch 3 taken 949 times.
✓ Branch 4 taken 13443696 times.
✓ Branch 5 taken 16482 times.
✓ Branch 6 taken 13439176 times.
✓ Branch 7 taken 4520 times.
✓ Branch 8 taken 13438977 times.
✓ Branch 9 taken 199 times.
✓ Branch 10 taken 13438977 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 13438071 times.
✓ Branch 13 taken 906 times.
✓ Branch 14 taken 13427940 times.
✓ Branch 15 taken 10131 times.
✓ Branch 16 taken 11373 times.
✓ Branch 17 taken 13416567 times.
✓ Branch 18 taken 7756443 times.
✓ Branch 19 taken 7767816 times.
|
20514051 | if(hclk>0 || inlikelike == 1 || action==inwind || action==drowning || action==lavadrowning || action==sidedrowning || inwallm || isDiving() || (action==hopping && hopclk<255)) |
| 6780 | { | ||
| 6781 | 14842554 | return; | |
| 6782 | } | ||
| 6783 | |||
| 6784 |
2/2✓ Branch 0 taken 12445771 times.
✓ Branch 1 taken 13416543 times.
|
25862314 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 6785 | { | ||
| 6786 | 12445771 | sprite *s = Lwpns.spr(i); | |
| 6787 | 12445771 | int32_t itemid = ((weapon*)(Lwpns.spr(i)))->parentitem; | |
| 6788 | //if ( itemdbuf[parentitem].flags&item_flags3 ) //can damage Hero | ||
| 6789 | //if ( itemsbuf[parentitem].misc1 > 0 ) //damages Hero by this amount. | ||
| 6790 |
12/12✓ Branch 0 taken 746736 times.
✓ Branch 1 taken 11699035 times.
✓ Branch 2 taken 3931375 times.
✓ Branch 3 taken 7767660 times.
✓ Branch 4 taken 3883401 times.
✓ Branch 5 taken 3884259 times.
✓ Branch 6 taken 3884155 times.
✓ Branch 7 taken 104 times.
✓ Branch 8 taken 91196 times.
✓ Branch 9 taken 3792959 times.
✓ Branch 10 taken 38783 times.
✓ Branch 11 taken 52413 times.
|
12445771 | if((!(itemid==-1&&get_qr(qr_FIREPROOFHERO)||((itemid>-1&&itemsbuf[itemid].family==itype_candle||itemsbuf[itemid].family==itype_book)&&(itemsbuf[itemid].flags & item_flag3)))) && scriptcoldet && !fallclk && (!superman || !get_qr(qr_FIREPROOFHERO2))) |
| 6791 | { | ||
| 6792 |
9/10✓ Branch 0 taken 3722274 times.
✓ Branch 1 taken 123098 times.
✓ Branch 2 taken 122655 times.
✓ Branch 3 taken 443 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 443 times.
✓ Branch 6 taken 3711 times.
✓ Branch 7 taken 118944 times.
✓ Branch 8 taken 3844481 times.
✓ Branch 9 taken 33 times.
|
3848668 | if(s->id==wFire && (superman ? (diagonalMovement?s->hit(x+4,y+4-fakez,z,7,7,1):s->hit(x+7,y+7-fakez,z,2,2,1)) : s->hit(this))&& |
| 6793 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3296 times.
|
4154 | (itemid < 0 || itemsbuf[itemid].family!=itype_divinefire)) |
| 6794 | { | ||
| 6795 | 33 | std::vector<int32_t> &ev = FFCore.eventData; | |
| 6796 | 33 | ev.clear(); | |
| 6797 | 33 | ev.push_back(lwpn_dp(i)*10000); | |
| 6798 | 33 | ev.push_back(s->hitdir(x,y,16,16,dir)*10000); | |
| 6799 | 33 | ev.push_back(0); | |
| 6800 | 33 | ev.push_back(DivineProtectionShieldClk>0?10000:0); | |
| 6801 | 33 | ev.push_back(48*10000); | |
| 6802 | 33 | ev.push_back(ZSD_LWPN*10000); | |
| 6803 | 33 | ev.push_back(s->getUID()); | |
| 6804 | 33 | ev.push_back(ZSD_NONE*10000); | |
| 6805 | 33 | ev.push_back(0); | |
| 6806 | |||
| 6807 | 33 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_1); | |
| 6808 | 33 | int32_t dmg = ev[0]/10000; | |
| 6809 | 33 | bool nullhit = ev[2] != 0; | |
| 6810 | |||
| 6811 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 33 times.
|
33 | if(nullhit) {ev.clear(); return;} |
| 6812 | |||
| 6813 | //Args: 'damage (post-ring)','hitdir','nullifyhit','type:npc','npc uid' | ||
| 6814 | 33 | ev[0] = ringpower(dmg)*10000; | |
| 6815 | |||
| 6816 | 33 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_2); | |
| 6817 | 33 | dmg = ev[0]/10000; | |
| 6818 | 33 | int32_t hdir = ev[1]/10000; | |
| 6819 | 33 | nullhit = ev[2] != 0; | |
| 6820 | 33 | bool divineprot = ev[3] != 0; | |
| 6821 | 33 | int32_t iframes = ev[4] / 10000; | |
| 6822 | 33 | ev.clear(); | |
| 6823 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 33 times.
|
33 | if(nullhit) return; |
| 6824 |
1/2✓ Branch 0 taken 33 times.
✗ Branch 1 not taken.
|
33 | if (Lwpns.spr(i) != s) |
| 6825 | { | ||
| 6826 | ✗ | auto hit = Lwpns.find(s); | |
| 6827 | ✗ | if (hit < 0) | |
| 6828 | ✗ | s = nullptr; | |
| 6829 | else | ||
| 6830 | { | ||
| 6831 | ✗ | s = Lwpns.spr(hit); | |
| 6832 | ✗ | i = hit; | |
| 6833 | } | ||
| 6834 | ✗ | } | |
| 6835 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 33 times.
|
33 | if(!divineprot) |
| 6836 | { | ||
| 6837 |
1/2✓ Branch 0 taken 33 times.
✗ Branch 1 not taken.
|
33 | game->set_life(zc_max(game->get_life()-dmg,0)); |
| 6838 | 33 | weapon* w = (weapon*)s; | |
| 6839 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 33 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
33 | if (!get_qr(qr_BROKENHITBY) && w) |
| 6840 | { | ||
| 6841 | ✗ | sethitHeroUID(HIT_BY_LWEAPON,(i+1)); | |
| 6842 | ✗ | if (get_qr(qr_BROKENHITBY)) | |
| 6843 | { | ||
| 6844 | ✗ | sethitHeroUID(HIT_BY_LWEAPON_UID,w->getUID()); | |
| 6845 | ✗ | } | |
| 6846 | else | ||
| 6847 | { | ||
| 6848 | |||
| 6849 | ✗ | sethitHeroUID(HIT_BY_LWEAPON_UID,w->getScriptUID()); | |
| 6850 | } | ||
| 6851 | ✗ | sethitHeroUID(HIT_BY_LWEAPON_ENGINE_UID,w->getUID()); | |
| 6852 | ✗ | sethitHeroUID(HIT_BY_LWEAPON_TYPE, w->id); | |
| 6853 | ✗ | if (w->parentitem > -1) sethitHeroUID(HIT_BY_LWEAPON_PARENT_ID, w->parentitem); | |
| 6854 | ✗ | else sethitHeroUID(HIT_BY_LWEAPON_PARENT_ID, -1); | |
| 6855 | ✗ | sethitHeroUID(HIT_BY_LWEAPON_PARENT_FAMILY, itemsbuf[w->parentitem].family); | |
| 6856 | ✗ | } | |
| 6857 | 33 | } | |
| 6858 | |||
| 6859 | 33 | hitdir = hdir; | |
| 6860 | |||
| 6861 |
3/6✓ Branch 0 taken 33 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 33 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 33 times.
|
33 | if (action != rafting && action != freeze && action != sideswimfreeze) |
| 6862 | { | ||
| 6863 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 33 times.
|
33 | if (IsSideSwim()) |
| 6864 | { | ||
| 6865 | ✗ | action=sideswimhit; FFCore.setHeroAction(sideswimhit); | |
| 6866 | ✗ | } | |
| 6867 |
2/4✓ Branch 0 taken 33 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 33 times.
|
33 | else if (action == swimming || hopclk == 0xFF) |
| 6868 | { | ||
| 6869 | ✗ | action=swimhit; FFCore.setHeroAction(swimhit); | |
| 6870 | ✗ | } | |
| 6871 | else | ||
| 6872 | { | ||
| 6873 | 33 | action=gothit; FFCore.setHeroAction(gothit); | |
| 6874 | } | ||
| 6875 | 33 | } | |
| 6876 | |||
| 6877 |
5/8✓ Branch 0 taken 33 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 33 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 28 times.
✓ Branch 5 taken 5 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 28 times.
|
33 | if(charging > 0 || spins > 0 || attack == wSword || attack == wHammer) |
| 6878 | { | ||
| 6879 | 5 | spins = charging = attackclk = 0; | |
| 6880 | 5 | attack=none; | |
| 6881 | 5 | tapping = false; | |
| 6882 | 5 | } | |
| 6883 | |||
| 6884 | 33 | hclk=iframes; | |
| 6885 | 33 | sfx(getHurtSFX(),pan(x.getInt())); | |
| 6886 | 33 | return; | |
| 6887 | } | ||
| 6888 | 3844481 | } | |
| 6889 | |||
| 6890 | // check enemy weapons true, 1, -1 | ||
| 6891 | // | ||
| 6892 |
2/2✓ Branch 0 taken 493970 times.
✓ Branch 1 taken 4184108 times.
|
4678078 | if((itemsbuf[itemid].flags & item_flag6)) |
| 6893 | { | ||
| 6894 |
6/6✓ Branch 0 taken 380644 times.
✓ Branch 1 taken 113326 times.
✓ Branch 2 taken 34343 times.
✓ Branch 3 taken 346301 times.
✓ Branch 4 taken 7231 times.
✓ Branch 5 taken 27112 times.
|
493970 | if(s->id==wBrang || (s->id==wHookshot&&!pull_hero)) |
| 6895 | { | ||
| 6896 |
1/2✓ Branch 0 taken 140438 times.
✗ Branch 1 not taken.
|
140438 | int32_t itemid = ((weapon*)s)->parentitem>-1 ? ((weapon*)s)->parentitem : |
| 6897 | ✗ | directWpn>-1 ? directWpn : current_item_id(s->id==wHookshot ? (((weapon*)s)->family_class == itype_switchhook ? itype_switchhook : itype_hookshot) : itype_brang); | |
| 6898 | 140438 | itemid = vbound(itemid, 0, MAXITEMS-1); | |
| 6899 | |||
| 6900 |
2/2✓ Branch 0 taken 139950 times.
✓ Branch 1 taken 66159 times.
|
206109 | for(int32_t j=0; j<Ewpns.Count(); j++) |
| 6901 | { | ||
| 6902 | 66159 | sprite *t = Ewpns.spr(j); | |
| 6903 | |||
| 6904 |
2/2✓ Branch 0 taken 65671 times.
✓ Branch 1 taken 488 times.
|
66159 | if(s->hit(t->x+7,t->y+7-t->fakez,t->z,2,2,1)) |
| 6905 | { | ||
| 6906 | 488 | bool reflect = false; | |
| 6907 | // sethitHeroUID(HIT_BY_EWEAPON,j); //set that Hero was hit by a specific eweapon index. | ||
| 6908 | |||
| 6909 |
2/2✓ Branch 0 taken 369 times.
✓ Branch 1 taken 119 times.
|
488 | if(sh_check(itemsbuf[itemid].misc3, itemsbuf[itemid].misc4, t->id, reflect, ((weapon*)t)->type&1, false)) |
| 6910 | { | ||
| 6911 | 119 | ((weapon*)s)->dead=1; | |
| 6912 | 119 | weapon *ew = ((weapon*)t); | |
| 6913 | 119 | int32_t oldid = ew->id; | |
| 6914 | 119 | ew->onhit(true, reflect ? 2 : 1, s->dir); | |
| 6915 | 119 | } | |
| 6916 | 488 | break; | |
| 6917 | } | ||
| 6918 | 65671 | } | |
| 6919 | 140438 | } | |
| 6920 | 493970 | } | |
| 6921 | |||
| 6922 |
6/6✓ Branch 0 taken 3045481 times.
✓ Branch 1 taken 1632597 times.
✓ Branch 2 taken 746736 times.
✓ Branch 3 taken 2298745 times.
✓ Branch 4 taken 106519 times.
✓ Branch 5 taken 640217 times.
|
4678078 | if((itemsbuf[itemid].flags & item_flag2)||(itemid==-1&&get_qr(qr_OUCHBOMBS))) |
| 6923 | { | ||
| 6924 |
7/8✓ Branch 0 taken 1693749 times.
✓ Branch 1 taken 45367 times.
✓ Branch 2 taken 45915 times.
✓ Branch 3 taken 1693201 times.
✓ Branch 4 taken 45915 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 29 times.
✓ Branch 7 taken 45886 times.
|
1739116 | if(((s->id==wBomb)||(s->id==wSBomb)) && !superman && scriptcoldet && !fallclk) |
| 6925 | { | ||
| 6926 | 45886 | weapon* w = (weapon*)s; | |
| 6927 | 45886 | bool didhit = s->hit(this); | |
| 6928 |
2/2✓ Branch 0 taken 45851 times.
✓ Branch 1 taken 35 times.
|
45886 | if(didhit) |
| 6929 | { | ||
| 6930 | 35 | std::vector<int32_t> &ev = FFCore.eventData; | |
| 6931 | 35 | ev.clear(); | |
| 6932 |
2/2✓ Branch 0 taken 33 times.
✓ Branch 1 taken 2 times.
|
35 | ev.push_back(((w->parentitem>-1 ? itemsbuf[w->parentitem].misc3 : w->power) *game->get_hp_per_heart())*10000); |
| 6933 | 35 | ev.push_back(w->hitdir(x,y,16,16,dir)*10000); | |
| 6934 | 35 | ev.push_back(0); | |
| 6935 | 35 | ev.push_back(DivineProtectionShieldClk>0?10000:0); | |
| 6936 | 35 | ev.push_back(48*10000); | |
| 6937 | 35 | ev.push_back(ZSD_LWPN*10000); | |
| 6938 | 35 | ev.push_back(w->getUID()); | |
| 6939 | 35 | ev.push_back(ZSD_NONE*10000); | |
| 6940 | 35 | ev.push_back(0); | |
| 6941 | |||
| 6942 | 35 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_1); | |
| 6943 | 35 | int32_t dmg = ev[0]/10000; | |
| 6944 | 35 | bool nullhit = ev[2] != 0; | |
| 6945 | |||
| 6946 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 35 times.
|
35 | if(nullhit) {ev.clear(); return;} |
| 6947 | |||
| 6948 | //Args: 'damage (post-ring)','hitdir','nullifyhit','type:npc','npc uid' | ||
| 6949 | 35 | ev[0] = ringpower(dmg)*10000; | |
| 6950 | |||
| 6951 | 35 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_2); | |
| 6952 | 35 | dmg = ev[0]/10000; | |
| 6953 | 35 | int32_t hdir = ev[1]/10000; | |
| 6954 | 35 | nullhit = ev[2] != 0; | |
| 6955 | 35 | bool divineprot = ev[3] != 0; | |
| 6956 | 35 | int32_t iframes = ev[4] / 10000; | |
| 6957 | 35 | ev.clear(); | |
| 6958 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 35 times.
|
35 | if(nullhit) return; |
| 6959 |
1/2✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
|
35 | if (Lwpns.spr(i) != w) |
| 6960 | { | ||
| 6961 | ✗ | auto hit = Lwpns.find(w); | |
| 6962 | ✗ | if (hit < 0) | |
| 6963 | ✗ | s = nullptr; | |
| 6964 | else | ||
| 6965 | { | ||
| 6966 | ✗ | s = Lwpns.spr(hit); | |
| 6967 | ✗ | i = hit; | |
| 6968 | } | ||
| 6969 | ✗ | w = (weapon*)s; | |
| 6970 | ✗ | } | |
| 6971 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 35 times.
|
35 | if(!divineprot) |
| 6972 | { | ||
| 6973 |
5/6✓ Branch 0 taken 1 times.
✓ Branch 1 taken 34 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 35 times.
✓ Branch 4 taken 34 times.
✓ Branch 5 taken 1 times.
|
35 | game->set_life(zc_min(game->get_maxlife(), zc_max(game->get_life()-dmg,0))); |
| 6974 |
3/4✓ Branch 0 taken 1 times.
✓ Branch 1 taken 34 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
|
35 | if (!get_qr(qr_BROKENHITBY) && w) |
| 6975 | { | ||
| 6976 | 1 | sethitHeroUID(HIT_BY_LWEAPON,(i+1)); | |
| 6977 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if (get_qr(qr_BROKENHITBY)) |
| 6978 | { | ||
| 6979 | ✗ | sethitHeroUID(HIT_BY_LWEAPON_UID,w->getUID()); | |
| 6980 | ✗ | } | |
| 6981 | else | ||
| 6982 | { | ||
| 6983 | |||
| 6984 | 1 | sethitHeroUID(HIT_BY_LWEAPON_UID,w->getScriptUID()); | |
| 6985 | } | ||
| 6986 | 1 | sethitHeroUID(HIT_BY_LWEAPON_ENGINE_UID,w->getUID()); | |
| 6987 | 1 | sethitHeroUID(HIT_BY_LWEAPON_TYPE, w->id); | |
| 6988 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if (w->parentitem > -1) sethitHeroUID(HIT_BY_LWEAPON_PARENT_ID, w->parentitem); |
| 6989 | ✗ | else sethitHeroUID(HIT_BY_LWEAPON_PARENT_ID, -1); | |
| 6990 | 1 | sethitHeroUID(HIT_BY_LWEAPON_PARENT_FAMILY, itemsbuf[w->parentitem].family); | |
| 6991 | 1 | } | |
| 6992 | 35 | } | |
| 6993 | |||
| 6994 | 35 | hitdir = hdir; | |
| 6995 | |||
| 6996 |
3/6✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 35 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 35 times.
|
35 | if (action != rafting && action != freeze && action != sideswimfreeze) |
| 6997 | { | ||
| 6998 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 35 times.
|
35 | if (IsSideSwim()) |
| 6999 | { | ||
| 7000 | ✗ | action=sideswimhit; FFCore.setHeroAction(sideswimhit); | |
| 7001 | ✗ | } | |
| 7002 |
2/4✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 35 times.
|
35 | else if (action == swimming || hopclk == 0xFF) |
| 7003 | { | ||
| 7004 | ✗ | action=swimhit; FFCore.setHeroAction(swimhit); | |
| 7005 | ✗ | } | |
| 7006 | else | ||
| 7007 | { | ||
| 7008 | 35 | action=gothit; FFCore.setHeroAction(gothit); | |
| 7009 | } | ||
| 7010 | 35 | } | |
| 7011 | |||
| 7012 |
5/8✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 35 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 34 times.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 34 times.
|
35 | if(charging > 0 || spins > 0 || attack == wSword || attack == wHammer) |
| 7013 | { | ||
| 7014 | 1 | spins = charging = attackclk = 0; | |
| 7015 | 1 | attack=none; | |
| 7016 | 1 | tapping = false; | |
| 7017 | 1 | } | |
| 7018 | |||
| 7019 | 35 | hclk=iframes; | |
| 7020 | 35 | sfx(getHurtSFX(),pan(x.getInt())); | |
| 7021 | 35 | return; | |
| 7022 | } | ||
| 7023 | 45851 | } | |
| 7024 | 1739081 | } | |
| 7025 | |||
| 7026 |
7/8✓ Branch 0 taken 4678043 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9368 times.
✓ Branch 3 taken 4668675 times.
✓ Branch 4 taken 9256 times.
✓ Branch 5 taken 112 times.
✓ Branch 6 taken 4677931 times.
✓ Branch 7 taken 112 times.
|
4678043 | if(hclk==0 && s->id==wWind && s->hit(x+7,y+7-fakez,z,2,2,1) && !fairyclk) |
| 7027 | { | ||
| 7028 | 112 | std::vector<int32_t> &ev = FFCore.eventData; | |
| 7029 | 112 | ev.clear(); | |
| 7030 | 112 | ev.push_back(0); | |
| 7031 | 112 | ev.push_back(s->dir*10000); | |
| 7032 | 112 | ev.push_back(0); | |
| 7033 | 112 | ev.push_back(0); | |
| 7034 | 112 | ev.push_back(ZSD_LWPN*10000); | |
| 7035 | 112 | ev.push_back(s->getUID()); | |
| 7036 | 112 | ev.push_back(ZSD_NONE*10000); | |
| 7037 | 112 | ev.push_back(0); | |
| 7038 | |||
| 7039 | 112 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_1); | |
| 7040 | 112 | bool nullhit = ev[2] != 0; | |
| 7041 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 112 times.
|
112 | if(nullhit) {ev.clear(); return;} |
| 7042 | |||
| 7043 | 112 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_2); | |
| 7044 | 112 | int32_t hdir = ev[1]/10000; | |
| 7045 | 112 | nullhit = ev[2] != 0; | |
| 7046 | 112 | ev.clear(); | |
| 7047 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 112 times.
|
112 | if(nullhit) return; |
| 7048 |
1/2✓ Branch 0 taken 112 times.
✗ Branch 1 not taken.
|
112 | if (Lwpns.spr(i) != s) |
| 7049 | { | ||
| 7050 | ✗ | auto hit = Lwpns.find(s); | |
| 7051 | ✗ | if (hit < 0) | |
| 7052 | ✗ | s = nullptr; | |
| 7053 | else | ||
| 7054 | { | ||
| 7055 | ✗ | s = Lwpns.spr(hit); | |
| 7056 | ✗ | i = hit; | |
| 7057 | } | ||
| 7058 | ✗ | } | |
| 7059 | |||
| 7060 | 112 | reset_hookshot(); | |
| 7061 | 112 | xofs=1000; | |
| 7062 | 112 | action=inwind; FFCore.setHeroAction(inwind); | |
| 7063 | 112 | dir = hdir; | |
| 7064 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 112 times.
|
112 | if(s) s->dir = hdir; |
| 7065 | 112 | spins = charging = attackclk = 0; | |
| 7066 | |||
| 7067 | // In case Hero used two whistles in a row, summoning two whirlwinds, | ||
| 7068 | // check which whistle's whirlwind picked him up so the correct | ||
| 7069 | // warp ring will be used | ||
| 7070 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 112 times.
|
112 | int32_t whistle=s ? ((weapon*)s)->parentitem : -1; |
| 7071 | |||
| 7072 |
2/4✓ Branch 0 taken 112 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 112 times.
|
112 | if(whistle>-1 && itemsbuf[whistle].family==itype_whistle) |
| 7073 | 112 | whistleitem=whistle; | |
| 7074 | |||
| 7075 | 112 | return; | |
| 7076 | } | ||
| 7077 | 4677931 | } | |
| 7078 | |||
| 7079 |
6/8✓ Branch 0 taken 13303681 times.
✓ Branch 1 taken 112862 times.
✓ Branch 2 taken 12995998 times.
✓ Branch 3 taken 307683 times.
✓ Branch 4 taken 12995998 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 12992131 times.
|
26408674 | if(action==rafting || action==freeze || action==sideswimfreeze || |
| 7080 |
5/8✓ Branch 0 taken 12992131 times.
✓ Branch 1 taken 3867 times.
✓ Branch 2 taken 12992131 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 12992131 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 12992131 times.
✗ Branch 7 not taken.
|
12995998 | action==casting || action==sideswimcasting || action==drowning || action==lavadrowning || action==sidedrowning) |
| 7081 | 424412 | return; | |
| 7082 | |||
| 7083 | 12992131 | int32_t hit2 = -1; | |
| 7084 | 12992131 | do | |
| 7085 | { | ||
| 7086 |
2/2✓ Branch 0 taken 4159820 times.
✓ Branch 1 taken 8848813 times.
|
13008633 | hit2 = diagonalMovement ? GuyHitFrom(hit2+1,x+4,y+4-fakez,z,8,8,hzsz) |
| 7087 | 8848813 | : GuyHitFrom(hit2+1,x+7,y+7-fakez,z,2,2,hzsz); | |
| 7088 | |||
| 7089 |
2/2✓ Branch 0 taken 12977956 times.
✓ Branch 1 taken 30677 times.
|
13008633 | if(hit2!=-1) |
| 7090 | { | ||
| 7091 |
2/2✓ Branch 0 taken 16502 times.
✓ Branch 1 taken 14175 times.
|
30677 | if (hithero(hit2) == 0) return; |
| 7092 | 16502 | } | |
| 7093 |
2/2✓ Branch 0 taken 16502 times.
✓ Branch 1 taken 12977956 times.
|
12994458 | } while (hit2 != -1); |
| 7094 |
6/6✓ Branch 0 taken 12814903 times.
✓ Branch 1 taken 163053 times.
✓ Branch 2 taken 12804580 times.
✓ Branch 3 taken 10323 times.
✓ Branch 4 taken 2923 times.
✓ Branch 5 taken 12801657 times.
|
12977956 | if (superman || !scriptcoldet || fallclk) return; |
| 7095 | 12801657 | hit2 = LwpnHit(); | |
| 7096 | |||
| 7097 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 12801647 times.
|
12801657 | if(hit2!=-1) |
| 7098 | { | ||
| 7099 | 10 | weapon* lwpnspr = (weapon*)Lwpns.spr(hit2); | |
| 7100 | 10 | std::vector<int32_t> &ev = FFCore.eventData; | |
| 7101 | 10 | ev.clear(); | |
| 7102 | 10 | ev.push_back((lwpn_dp(hit2)*10000)); | |
| 7103 | 10 | ev.push_back(lwpnspr->hitdir(x,y,16,16,dir)*10000); | |
| 7104 | 10 | ev.push_back(0); | |
| 7105 | 10 | ev.push_back(DivineProtectionShieldClk>0?10000:0); | |
| 7106 | 10 | ev.push_back(48*10000); | |
| 7107 | 10 | ev.push_back(ZSD_LWPN*10000); | |
| 7108 | 10 | ev.push_back(lwpnspr->getUID()); | |
| 7109 | 10 | ev.push_back(ZSD_NONE*10000); | |
| 7110 | 10 | ev.push_back(0); | |
| 7111 | |||
| 7112 | 10 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_1); | |
| 7113 | 10 | int32_t dmg = ev[0]/10000; | |
| 7114 | 10 | bool nullhit = ev[2] != 0; | |
| 7115 | |||
| 7116 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
10 | if(nullhit) {ev.clear(); return;} |
| 7117 | |||
| 7118 | //Args: 'damage (post-ring)','hitdir','nullifyhit','type:npc','npc uid' | ||
| 7119 | 10 | ev[0] = ringpower(dmg)*10000; | |
| 7120 | |||
| 7121 | 10 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_2); | |
| 7122 | 10 | dmg = ev[0]/10000; | |
| 7123 | 10 | int32_t hdir = ev[1]/10000; | |
| 7124 | 10 | nullhit = ev[2] != 0; | |
| 7125 | 10 | bool divineprot = ev[3] != 0; | |
| 7126 | 10 | int32_t iframes = ev[4] / 10000; | |
| 7127 | 10 | ev.clear(); | |
| 7128 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
10 | if(nullhit) return; |
| 7129 |
1/2✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
|
10 | if (Lwpns.spr(hit2) != lwpnspr) |
| 7130 | { | ||
| 7131 | ✗ | hit2 = Lwpns.find(lwpnspr); | |
| 7132 | ✗ | if (hit2 < 0) | |
| 7133 | ✗ | lwpnspr = nullptr; | |
| 7134 | ✗ | else lwpnspr = (weapon*)Lwpns.spr(hit2); | |
| 7135 | ✗ | } | |
| 7136 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
10 | if (!divineprot) |
| 7137 | { | ||
| 7138 |
1/2✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
|
10 | game->set_life(zc_max(game->get_life() - dmg, 0)); |
| 7139 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
10 | if (lwpnspr) |
| 7140 | { | ||
| 7141 | 10 | sethitHeroUID(HIT_BY_LWEAPON, (hit2 + 1)); | |
| 7142 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 4 times.
|
10 | if (get_qr(qr_BROKENHITBY)) |
| 7143 | { | ||
| 7144 | 6 | sethitHeroUID(HIT_BY_LWEAPON_UID, lwpnspr->getUID()); | |
| 7145 | 6 | } | |
| 7146 | else | ||
| 7147 | { | ||
| 7148 | |||
| 7149 | 4 | sethitHeroUID(HIT_BY_LWEAPON_UID, lwpnspr->getScriptUID()); | |
| 7150 | } | ||
| 7151 | 10 | sethitHeroUID(HIT_BY_LWEAPON_ENGINE_UID, lwpnspr->getUID()); | |
| 7152 | 10 | sethitHeroUID(HIT_BY_LWEAPON_TYPE, lwpnspr->id); | |
| 7153 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 8 times.
|
10 | if (lwpnspr->parentitem > -1) sethitHeroUID(HIT_BY_LWEAPON_PARENT_ID, lwpnspr->parentitem); |
| 7154 | 8 | else sethitHeroUID(HIT_BY_LWEAPON_PARENT_ID, -1); | |
| 7155 | 10 | sethitHeroUID(HIT_BY_LWEAPON_PARENT_FAMILY, itemsbuf[lwpnspr->parentitem].family); | |
| 7156 | 10 | } | |
| 7157 | 10 | } | |
| 7158 | |||
| 7159 | 10 | hitdir = hdir; | |
| 7160 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
10 | if(lwpnspr) |
| 7161 | 10 | lwpnspr->onhit(false); | |
| 7162 | |||
| 7163 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
10 | if (IsSideSwim()) |
| 7164 | { | ||
| 7165 | ✗ | action=sideswimhit; FFCore.setHeroAction(sideswimhit); | |
| 7166 | ✗ | } | |
| 7167 |
2/4✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 10 times.
|
10 | else if(action==swimming || hopclk==0xFF) |
| 7168 | { | ||
| 7169 | ✗ | action=swimhit; FFCore.setHeroAction(swimhit); | |
| 7170 | ✗ | } | |
| 7171 | else | ||
| 7172 | { | ||
| 7173 | 10 | action=gothit; FFCore.setHeroAction(gothit); | |
| 7174 | } | ||
| 7175 | |||
| 7176 | 10 | hclk=iframes; | |
| 7177 | |||
| 7178 |
5/8✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
✓ Branch 5 taken 7 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 3 times.
|
10 | if(charging > 0 || spins > 0 || attack == wSword || attack == wHammer) |
| 7179 | { | ||
| 7180 | 7 | spins = charging = attackclk = 0; | |
| 7181 | 7 | attack=none; | |
| 7182 | 7 | tapping = false; | |
| 7183 | 7 | } | |
| 7184 | |||
| 7185 | 10 | sfx(getHurtSFX(),pan(x.getInt())); | |
| 7186 | 10 | return; | |
| 7187 | } | ||
| 7188 | |||
| 7189 | //else { sethitHeroUID(HIT_BY_LWEAPON,(0)); //fails to clear | ||
| 7190 | |||
| 7191 | 12801647 | hit2 = EwpnHit(); | |
| 7192 | |||
| 7193 |
2/2✓ Branch 0 taken 5422 times.
✓ Branch 1 taken 12796225 times.
|
12801647 | if(hit2!=-1) |
| 7194 | { | ||
| 7195 | 5422 | weapon* ewpnspr = (weapon*)Ewpns.spr(hit2); | |
| 7196 | 5422 | std::vector<int32_t> &ev = FFCore.eventData; | |
| 7197 | 5422 | ev.clear(); | |
| 7198 | 5422 | ev.push_back((ewpn_dp(hit2)*10000)); | |
| 7199 | 5422 | ev.push_back(ewpnspr->hitdir(x,y,16,16,dir)*10000); | |
| 7200 | 5422 | ev.push_back(0); | |
| 7201 | 5422 | ev.push_back(DivineProtectionShieldClk>0?10000:0); | |
| 7202 | 5422 | ev.push_back(48*10000); | |
| 7203 | 5422 | ev.push_back(ZSD_EWPN*10000); | |
| 7204 | 5422 | ev.push_back(ewpnspr->getUID()); | |
| 7205 | 5422 | ev.push_back(ZSD_NONE*10000); | |
| 7206 | 5422 | ev.push_back(0); | |
| 7207 | |||
| 7208 | 5422 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_1); | |
| 7209 | 5422 | int32_t dmg = ev[0]/10000; | |
| 7210 | 5422 | bool nullhit = ev[2] != 0; | |
| 7211 | |||
| 7212 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5422 times.
|
5422 | if(nullhit) {ev.clear(); return;} |
| 7213 | |||
| 7214 | //Args: 'damage (post-ring)','hitdir','nullifyhit','type:npc','npc uid' | ||
| 7215 | 5422 | ev[0] = ringpower(dmg)*10000; | |
| 7216 | |||
| 7217 | 5422 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_2); | |
| 7218 | 5422 | dmg = ev[0]/10000; | |
| 7219 | 5422 | int32_t hdir = ev[1]/10000; | |
| 7220 | 5422 | nullhit = ev[2] != 0; | |
| 7221 | 5422 | bool divineprot = ev[3] != 0; | |
| 7222 | 5422 | int32_t iframes = ev[4] / 10000; | |
| 7223 | 5422 | ev.clear(); | |
| 7224 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5422 times.
|
5422 | if (nullhit) return; |
| 7225 |
1/2✓ Branch 0 taken 5422 times.
✗ Branch 1 not taken.
|
5422 | if (Ewpns.spr(hit2) != ewpnspr) |
| 7226 | { | ||
| 7227 | ✗ | hit2 = Ewpns.find(ewpnspr); | |
| 7228 | ✗ | if (hit2 < 0) | |
| 7229 | ✗ | ewpnspr = nullptr; | |
| 7230 | ✗ | else ewpnspr = (weapon*)Ewpns.spr(hit2); | |
| 7231 | ✗ | } | |
| 7232 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5422 times.
|
5422 | if (!divineprot) |
| 7233 | { | ||
| 7234 |
2/2✓ Branch 0 taken 5377 times.
✓ Branch 1 taken 45 times.
|
5422 | game->set_life(zc_max(game->get_life() - dmg, 0)); |
| 7235 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5422 times.
|
5422 | if (ewpnspr) |
| 7236 | { | ||
| 7237 | 5422 | sethitHeroUID(HIT_BY_EWEAPON, (hit2 + 1)); | |
| 7238 |
2/2✓ Branch 0 taken 5168 times.
✓ Branch 1 taken 254 times.
|
5422 | if (get_qr(qr_BROKENHITBY)) |
| 7239 | { | ||
| 7240 | 5168 | sethitHeroUID(HIT_BY_EWEAPON_UID, ewpnspr->getUID()); | |
| 7241 | 5168 | } | |
| 7242 | else | ||
| 7243 | { | ||
| 7244 | |||
| 7245 | 254 | sethitHeroUID(HIT_BY_EWEAPON_UID, ewpnspr->getScriptUID()); | |
| 7246 | } | ||
| 7247 | 5422 | sethitHeroUID(HIT_BY_EWEAPON_ENGINE_UID, ewpnspr->getUID()); | |
| 7248 | 5422 | sethitHeroUID(HIT_BY_EWEAPON_TYPE, ewpnspr->id); | |
| 7249 | 5422 | } | |
| 7250 | 5422 | } | |
| 7251 | |||
| 7252 | 5422 | hitdir = hdir; | |
| 7253 |
1/2✓ Branch 0 taken 5422 times.
✗ Branch 1 not taken.
|
5422 | if(ewpnspr) |
| 7254 | 5422 | ewpnspr->onhit(false); | |
| 7255 | |||
| 7256 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5422 times.
|
5422 | if (IsSideSwim()) |
| 7257 | { | ||
| 7258 | ✗ | action=sideswimhit; FFCore.setHeroAction(sideswimhit); | |
| 7259 | ✗ | } | |
| 7260 |
3/4✓ Branch 0 taken 5354 times.
✓ Branch 1 taken 68 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5354 times.
|
5422 | else if(action==swimming || hopclk==0xFF) |
| 7261 | { | ||
| 7262 | 68 | action=swimhit; FFCore.setHeroAction(swimhit); | |
| 7263 | 68 | } | |
| 7264 | else | ||
| 7265 | { | ||
| 7266 | 5354 | action=gothit; FFCore.setHeroAction(gothit); | |
| 7267 | } | ||
| 7268 | |||
| 7269 | 5422 | hclk=iframes; | |
| 7270 | |||
| 7271 |
8/8✓ Branch 0 taken 5391 times.
✓ Branch 1 taken 31 times.
✓ Branch 2 taken 5390 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 1933 times.
✓ Branch 5 taken 3457 times.
✓ Branch 6 taken 140 times.
✓ Branch 7 taken 1793 times.
|
5422 | if(charging > 0 || spins > 0 || attack == wSword || attack == wHammer) |
| 7272 | { | ||
| 7273 | 3629 | spins = charging = attackclk = 0; | |
| 7274 | 3629 | attack=none; | |
| 7275 | 3629 | tapping = false; | |
| 7276 | 3629 | } | |
| 7277 | |||
| 7278 | 5422 | sfx(getHurtSFX(),pan(x.getInt())); | |
| 7279 | 5422 | return; | |
| 7280 | } | ||
| 7281 | |||
| 7282 | // The rest of this method deals with damage combos, which can be jumped over. | ||
| 7283 |
4/4✓ Branch 0 taken 12779274 times.
✓ Branch 1 taken 16951 times.
✓ Branch 2 taken 12779527 times.
✓ Branch 3 taken 16698 times.
|
12796225 | if((z>0 || fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) return; |
| 7284 | |||
| 7285 | 12779527 | int32_t dx1 = (int32_t)x+8-(tmpscr->csensitive); | |
| 7286 | 12779527 | int32_t dx2 = (int32_t)x+8+(tmpscr->csensitive-1); | |
| 7287 |
2/2✓ Branch 0 taken 235293 times.
✓ Branch 1 taken 12544234 times.
|
12779527 | int32_t dy1 = (int32_t)y+(bigHitbox?8:12)-(bigHitbox?tmpscr->csensitive:(tmpscr->csensitive+1)/2); |
| 7288 |
2/2✓ Branch 0 taken 235293 times.
✓ Branch 1 taken 12544234 times.
|
12779527 | int32_t dy2 = (int32_t)y+(bigHitbox?8:12)+(bigHitbox?tmpscr->csensitive-1:((tmpscr->csensitive+1)/2)-1); |
| 7289 | |||
| 7290 |
2/2✓ Branch 0 taken 12779527 times.
✓ Branch 1 taken 23601933 times.
|
36381460 | for(int32_t i=get_qr(qr_DMGCOMBOLAYERFIX) ? 1 : -1; i>=-1; i--) // Layers 0, 1 and 2!! |
| 7291 | 23601933 | checkdamagecombos(dx1,dx2,dy1,dy2,i); | |
| 7292 | 14153429 | } | |
| 7293 | |||
| 7294 | 16931 | bool HeroClass::checkdamagecombos(int32_t dx, int32_t dy) | |
| 7295 | { | ||
| 7296 | 16931 | return checkdamagecombos(dx,dx,dy,dy); | |
| 7297 | } | ||
| 7298 | |||
| 7299 | 529 | void HeroClass::doHit(int32_t hdir) | |
| 7300 | { | ||
| 7301 | 529 | hitdir = hdir; | |
| 7302 | |||
| 7303 |
3/6✓ Branch 0 taken 529 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 529 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 529 times.
|
529 | if (action != rafting && action != freeze && action != sideswimfreeze) |
| 7304 | { | ||
| 7305 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 529 times.
|
529 | if (IsSideSwim()) |
| 7306 | { | ||
| 7307 | ✗ | action=sideswimhit; FFCore.setHeroAction(sideswimhit); | |
| 7308 | ✗ | } | |
| 7309 |
2/4✓ Branch 0 taken 529 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 529 times.
|
529 | else if (action == swimming || hopclk == 0xFF) |
| 7310 | { | ||
| 7311 | ✗ | action=swimhit; FFCore.setHeroAction(swimhit); | |
| 7312 | ✗ | } | |
| 7313 | else | ||
| 7314 | { | ||
| 7315 | 529 | action=gothit; FFCore.setHeroAction(gothit); | |
| 7316 | } | ||
| 7317 | 529 | } | |
| 7318 | |||
| 7319 | 529 | hclk=48; | |
| 7320 | |||
| 7321 |
7/8✓ Branch 0 taken 527 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 527 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 357 times.
✓ Branch 5 taken 170 times.
✓ Branch 6 taken 16 times.
✓ Branch 7 taken 341 times.
|
529 | if(charging > 0 || spins > 0 || attack == wSword || attack == wHammer) |
| 7322 | { | ||
| 7323 | 188 | spins = charging = attackclk = 0; | |
| 7324 | 188 | attack=none; | |
| 7325 | 188 | tapping = false; | |
| 7326 | 188 | } | |
| 7327 | |||
| 7328 | 529 | sfx(getHurtSFX(),pan(x.getInt())); | |
| 7329 | 529 | } | |
| 7330 | |||
| 7331 | 24008119 | bool HeroClass::checkdamagecombos(int32_t dx1, int32_t dx2, int32_t dy1, int32_t dy2, int32_t layer, bool solid, bool do_health_check) //layer = -1, solid = false, do_health_check = true | |
| 7332 | { | ||
| 7333 |
5/6✓ Branch 0 taken 24007859 times.
✓ Branch 1 taken 260 times.
✓ Branch 2 taken 24005668 times.
✓ Branch 3 taken 2191 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 24005668 times.
|
24008119 | if(hclk || superman || fallclk) |
| 7334 | 2451 | return false; | |
| 7335 | |||
| 7336 | 24005668 | int32_t hp_mod[4] = {0}; | |
| 7337 | int32_t cid[8]; | ||
| 7338 | 24005668 | byte hasKB = 0; | |
| 7339 | |||
| 7340 | { | ||
| 7341 |
2/2✓ Branch 0 taken 11080280 times.
✓ Branch 1 taken 12925388 times.
|
24005668 | cid[0] = layer>-1?MAPCOMBO2(layer,dx1,dy1):MAPCOMBO(dx1,dy1); |
| 7342 | 24005668 | newcombo& cmb = combobuf[cid[0]]; | |
| 7343 |
4/4✓ Branch 0 taken 24005665 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 24003846 times.
✓ Branch 3 taken 1819 times.
|
24005668 | if ( !(cmb.triggerflags[0] & combotriggerONLYGENTRIG) && combo_class_buf[cmb.type].modify_hp_amount) |
| 7344 | { | ||
| 7345 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1819 times.
|
1819 | if(cmb.usrflags&cflag1) |
| 7346 | ✗ | hp_mod[0] = cmb.attributes[0] / -10000L; | |
| 7347 | else | ||
| 7348 | 1819 | hp_mod[0]=combo_class_buf[cmb.type].modify_hp_amount; | |
| 7349 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1819 times.
|
1819 | if(!(cmb.usrflags&cflag2)) |
| 7350 | 1819 | hasKB |= 1<<0; | |
| 7351 | 1819 | } | |
| 7352 | } | ||
| 7353 | { | ||
| 7354 |
2/2✓ Branch 0 taken 11080280 times.
✓ Branch 1 taken 12925388 times.
|
24005668 | cid[1] = layer>-1?MAPCOMBO2(layer,dx1,dy2):MAPCOMBO(dx1,dy2); |
| 7355 | 24005668 | newcombo& cmb = combobuf[cid[1]]; | |
| 7356 |
4/4✓ Branch 0 taken 24005665 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 24003800 times.
✓ Branch 3 taken 1865 times.
|
24005668 | if ( !(cmb.triggerflags[0] & combotriggerONLYGENTRIG) && combo_class_buf[cmb.type].modify_hp_amount) |
| 7357 | { | ||
| 7358 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1865 times.
|
1865 | if(cmb.usrflags&cflag1) |
| 7359 | ✗ | hp_mod[1] = cmb.attributes[0] / -10000L; | |
| 7360 | else | ||
| 7361 | 1865 | hp_mod[1]=combo_class_buf[cmb.type].modify_hp_amount; | |
| 7362 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1865 times.
|
1865 | if(!(cmb.usrflags&cflag2)) |
| 7363 | 1865 | hasKB |= 1<<1; | |
| 7364 | 1865 | } | |
| 7365 | } | ||
| 7366 | { | ||
| 7367 |
2/2✓ Branch 0 taken 11080280 times.
✓ Branch 1 taken 12925388 times.
|
24005668 | cid[2] = layer>-1?MAPCOMBO2(layer,dx2,dy1):MAPCOMBO(dx2,dy1); |
| 7368 | 24005668 | newcombo& cmb = combobuf[cid[2]]; | |
| 7369 |
4/4✓ Branch 0 taken 24005665 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 24003839 times.
✓ Branch 3 taken 1826 times.
|
24005668 | if ( !(cmb.triggerflags[0] & combotriggerONLYGENTRIG) && combo_class_buf[cmb.type].modify_hp_amount) |
| 7370 | { | ||
| 7371 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1826 times.
|
1826 | if(cmb.usrflags&cflag1) |
| 7372 | ✗ | hp_mod[2] = cmb.attributes[0] / -10000L; | |
| 7373 | else | ||
| 7374 | 1826 | hp_mod[2]=combo_class_buf[cmb.type].modify_hp_amount; | |
| 7375 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1826 times.
|
1826 | if(!(cmb.usrflags&cflag2)) |
| 7376 | 1826 | hasKB |= 1<<2; | |
| 7377 | 1826 | } | |
| 7378 | } | ||
| 7379 | { | ||
| 7380 |
2/2✓ Branch 0 taken 11080280 times.
✓ Branch 1 taken 12925388 times.
|
24005668 | cid[3] = layer>-1?MAPCOMBO2(layer,dx2,dy2):MAPCOMBO(dx2,dy2); |
| 7381 | 24005668 | newcombo& cmb = combobuf[cid[3]]; | |
| 7382 |
4/4✓ Branch 0 taken 24005665 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 24003782 times.
✓ Branch 3 taken 1883 times.
|
24005668 | if ( !(cmb.triggerflags[0] & combotriggerONLYGENTRIG) && combo_class_buf[cmb.type].modify_hp_amount) |
| 7383 | { | ||
| 7384 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1883 times.
|
1883 | if(cmb.usrflags&cflag1) |
| 7385 | ✗ | hp_mod[3] = cmb.attributes[0] / -10000L; | |
| 7386 | else | ||
| 7387 | 1883 | hp_mod[3]=combo_class_buf[cmb.type].modify_hp_amount; | |
| 7388 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1883 times.
|
1883 | if(!(cmb.usrflags&cflag2)) |
| 7389 | 1883 | hasKB |= 1<<3; | |
| 7390 | 1883 | } | |
| 7391 | } | ||
| 7392 | |||
| 7393 | 24005668 | int32_t bestcid=0; | |
| 7394 | 24005668 | int best_cpos = -1; | |
| 7395 | 24005668 | int32_t hp_modtotal=0; | |
| 7396 | 24005668 | int poses[8] = {COMBOPOS(dx1,dy1),COMBOPOS(dx1,dy2),COMBOPOS(dx2,dy1),COMBOPOS(dx2,dy2)}; | |
| 7397 |
2/2✓ Branch 0 taken 17448414 times.
✓ Branch 1 taken 6557254 times.
|
24005668 | if (!_effectflag(dx1,dy1,1, layer)) {hp_mod[0] = 0; hasKB &= ~(1<<0);} |
| 7398 |
2/2✓ Branch 0 taken 17439964 times.
✓ Branch 1 taken 6565704 times.
|
24005668 | if (!_effectflag(dx1,dy2,1, layer)) {hp_mod[1] = 0; hasKB &= ~(1<<1);} |
| 7399 |
2/2✓ Branch 0 taken 17448440 times.
✓ Branch 1 taken 6557228 times.
|
24005668 | if (!_effectflag(dx2,dy1,1, layer)) {hp_mod[2] = 0; hasKB &= ~(1<<2);} |
| 7400 |
2/2✓ Branch 0 taken 17439990 times.
✓ Branch 1 taken 6565678 times.
|
24005668 | if (!_effectflag(dx2,dy2,1, layer)) {hp_mod[3] = 0; hasKB &= ~(1<<3);} |
| 7401 | |||
| 7402 |
2/2✓ Branch 0 taken 48011336 times.
✓ Branch 1 taken 24005668 times.
|
72017004 | for (int32_t i = 0; i <= 1; ++i) |
| 7403 | { | ||
| 7404 |
2/2✓ Branch 0 taken 31352993 times.
✓ Branch 1 taken 16658343 times.
|
48011336 | if(tmpscr2[i].valid!=0) |
| 7405 | { | ||
| 7406 |
2/2✓ Branch 0 taken 13156917 times.
✓ Branch 1 taken 3501426 times.
|
16658343 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 7407 | { | ||
| 7408 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 13156917 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
13156917 | if (combobuf[MAPCOMBO2(i,dx1,dy1)].type == cBRIDGE && !_walkflag_layer(dx1,dy1,1, &(tmpscr2[i]))) {hp_mod[0] = 0; hasKB &= ~(1<<0);} |
| 7409 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 13156917 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
13156917 | if (combobuf[MAPCOMBO2(i,dx1,dy2)].type == cBRIDGE && !_walkflag_layer(dx1,dy2,1, &(tmpscr2[i]))) {hp_mod[1] = 0; hasKB &= ~(1<<1);} |
| 7410 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 13156917 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
13156917 | if (combobuf[MAPCOMBO2(i,dx2,dy1)].type == cBRIDGE && !_walkflag_layer(dx2,dy1,1, &(tmpscr2[i]))) {hp_mod[2] = 0; hasKB &= ~(1<<2);} |
| 7411 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 13156917 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
13156917 | if (combobuf[MAPCOMBO2(i,dx2,dy2)].type == cBRIDGE && !_walkflag_layer(dx2,dy2,1, &(tmpscr2[i]))) {hp_mod[3] = 0; hasKB &= ~(1<<3);} |
| 7412 | 13156917 | } | |
| 7413 | else | ||
| 7414 | { | ||
| 7415 |
4/4✓ Branch 0 taken 10124 times.
✓ Branch 1 taken 3491302 times.
✓ Branch 2 taken 2538 times.
✓ Branch 3 taken 7586 times.
|
3501426 | if (combobuf[MAPCOMBO2(i,dx1,dy1)].type == cBRIDGE && _effectflag_layer(dx1,dy1,1, &(tmpscr2[i]))) {hp_mod[0] = 0; hasKB &= ~(1<<0);} |
| 7416 |
4/4✓ Branch 0 taken 10154 times.
✓ Branch 1 taken 3491272 times.
✓ Branch 2 taken 2598 times.
✓ Branch 3 taken 7556 times.
|
3501426 | if (combobuf[MAPCOMBO2(i,dx1,dy2)].type == cBRIDGE && _effectflag_layer(dx1,dy2,1, &(tmpscr2[i]))) {hp_mod[1] = 0; hasKB &= ~(1<<1);} |
| 7417 |
4/4✓ Branch 0 taken 10148 times.
✓ Branch 1 taken 3491278 times.
✓ Branch 2 taken 2622 times.
✓ Branch 3 taken 7526 times.
|
3501426 | if (combobuf[MAPCOMBO2(i,dx2,dy1)].type == cBRIDGE && _effectflag_layer(dx2,dy1,1, &(tmpscr2[i]))) {hp_mod[2] = 0; hasKB &= ~(1<<2);} |
| 7418 |
4/4✓ Branch 0 taken 10181 times.
✓ Branch 1 taken 3491245 times.
✓ Branch 2 taken 2685 times.
✓ Branch 3 taken 7496 times.
|
3501426 | if (combobuf[MAPCOMBO2(i,dx2,dy2)].type == cBRIDGE && _effectflag_layer(dx2,dy2,1, &(tmpscr2[i]))) {hp_mod[3] = 0; hasKB &= ~(1<<3);} |
| 7419 | } | ||
| 7420 | 16658343 | } | |
| 7421 | 48011336 | } | |
| 7422 | |||
| 7423 |
2/2✓ Branch 0 taken 96022672 times.
✓ Branch 1 taken 24005668 times.
|
120028340 | for(int32_t i=0; i<4; i++) |
| 7424 | { | ||
| 7425 |
2/2✓ Branch 0 taken 37140136 times.
✓ Branch 1 taken 58882536 times.
|
96022672 | if(get_qr(qr_DMGCOMBOPRI)) |
| 7426 | { | ||
| 7427 |
2/2✓ Branch 0 taken 37139750 times.
✓ Branch 1 taken 386 times.
|
37140136 | if(hp_modtotal >= 0) //Okay, if it's over 0, it's healing Hero. |
| 7428 | { | ||
| 7429 |
2/2✓ Branch 0 taken 37139592 times.
✓ Branch 1 taken 158 times.
|
37139750 | if(hp_mod[i] < hp_modtotal) |
| 7430 | { | ||
| 7431 | 158 | hp_modtotal = hp_mod[i]; | |
| 7432 | 158 | bestcid = cid[i]; | |
| 7433 | 158 | best_cpos = poses[i]; | |
| 7434 | 158 | } | |
| 7435 | 37139750 | } | |
| 7436 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 88 times.
|
386 | else if(hp_mod[i] < 0) //If it's under 0, it's hurting Hero. |
| 7437 | { | ||
| 7438 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | if(hp_mod[i] > hp_modtotal) |
| 7439 | { | ||
| 7440 | ✗ | hp_modtotal = hp_mod[i]; | |
| 7441 | ✗ | bestcid = cid[i]; | |
| 7442 | ✗ | best_cpos = poses[i]; | |
| 7443 | ✗ | } | |
| 7444 | 298 | } | |
| 7445 | 37140136 | } | |
| 7446 |
2/2✓ Branch 0 taken 58880612 times.
✓ Branch 1 taken 1924 times.
|
58882536 | else if(hp_mod[i] < hp_modtotal) |
| 7447 | { | ||
| 7448 | 1924 | hp_modtotal = hp_mod[i]; | |
| 7449 | 1924 | bestcid = cid[i]; | |
| 7450 | 1924 | best_cpos = poses[i]; | |
| 7451 | 1924 | } | |
| 7452 | 96022672 | } | |
| 7453 | |||
| 7454 | { | ||
| 7455 | 24005668 | poses[4] = getFFCAt(dx1,dy1); | |
| 7456 |
2/2✓ Branch 0 taken 384433 times.
✓ Branch 1 taken 23621235 times.
|
24005668 | cid[4] = poses[4] > -1 ? tmpscr->ffcs[poses[4]].data : 0; |
| 7457 | 24005668 | newcombo& cmb = combobuf[cid[4]]; | |
| 7458 |
4/4✓ Branch 0 taken 24005473 times.
✓ Branch 1 taken 195 times.
✓ Branch 2 taken 24005425 times.
✓ Branch 3 taken 48 times.
|
24005668 | if ( !(cmb.triggerflags[0] & combotriggerONLYGENTRIG) && combo_class_buf[cmb.type].modify_hp_amount) |
| 7459 | { | ||
| 7460 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
|
48 | if(cmb.usrflags&cflag1 ) |
| 7461 | ✗ | hp_mod[0] = cmb.attributes[0]/-10000L; | |
| 7462 | else | ||
| 7463 | 48 | hp_mod[0]=combo_class_buf[cmb.type].modify_hp_amount; | |
| 7464 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
|
48 | if(!(cmb.usrflags&cflag2)) |
| 7465 | 48 | hasKB |= 1<<4; | |
| 7466 | 48 | } | |
| 7467 | } | ||
| 7468 | { | ||
| 7469 | 24005668 | poses[5] = getFFCAt(dx1,dy2); | |
| 7470 |
2/2✓ Branch 0 taken 381440 times.
✓ Branch 1 taken 23624228 times.
|
24005668 | cid[5] = poses[5] > -1 ? tmpscr->ffcs[poses[5]].data : 0; |
| 7471 | 24005668 | newcombo& cmb = combobuf[cid[5]]; | |
| 7472 |
4/4✓ Branch 0 taken 24005464 times.
✓ Branch 1 taken 204 times.
✓ Branch 2 taken 24005420 times.
✓ Branch 3 taken 44 times.
|
24005668 | if ( !(cmb.triggerflags[0] & combotriggerONLYGENTRIG) && combo_class_buf[cmb.type].modify_hp_amount) |
| 7473 | { | ||
| 7474 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44 times.
|
44 | if(cmb.usrflags&cflag1 ) |
| 7475 | ✗ | hp_mod[1] = cmb.attributes[0]/-10000L; | |
| 7476 | else | ||
| 7477 | 44 | hp_mod[1]=combo_class_buf[cmb.type].modify_hp_amount; | |
| 7478 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44 times.
|
44 | if(!(cmb.usrflags&cflag2)) |
| 7479 | 44 | hasKB |= 1<<5; | |
| 7480 | 44 | } | |
| 7481 | } | ||
| 7482 | { | ||
| 7483 | 24005668 | poses[6] = getFFCAt(dx2,dy1); | |
| 7484 |
2/2✓ Branch 0 taken 388526 times.
✓ Branch 1 taken 23617142 times.
|
24005668 | cid[6] = poses[6] > -1 ? tmpscr->ffcs[poses[6]].data : 0; |
| 7485 | 24005668 | newcombo& cmb = combobuf[cid[6]]; | |
| 7486 |
4/4✓ Branch 0 taken 24005476 times.
✓ Branch 1 taken 192 times.
✓ Branch 2 taken 24005429 times.
✓ Branch 3 taken 47 times.
|
24005668 | if ( !(cmb.triggerflags[0] & combotriggerONLYGENTRIG) && combo_class_buf[cmb.type].modify_hp_amount) |
| 7487 | { | ||
| 7488 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 47 times.
|
47 | if(cmb.usrflags&cflag1 ) |
| 7489 | ✗ | hp_mod[2] = cmb.attributes[0]/-10000L; | |
| 7490 | else | ||
| 7491 | 47 | hp_mod[2]=combo_class_buf[cmb.type].modify_hp_amount; | |
| 7492 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 47 times.
|
47 | if(!(cmb.usrflags&cflag2)) |
| 7493 | 47 | hasKB |= 1<<6; | |
| 7494 | 47 | } | |
| 7495 | } | ||
| 7496 | { | ||
| 7497 | 24005668 | poses[7] = getFFCAt(dx2,dy2); | |
| 7498 |
2/2✓ Branch 0 taken 385491 times.
✓ Branch 1 taken 23620177 times.
|
24005668 | cid[7] = poses[7] > -1 ? tmpscr->ffcs[poses[7]].data : 0; |
| 7499 | 24005668 | newcombo& cmb = combobuf[cid[7]]; | |
| 7500 |
4/4✓ Branch 0 taken 24005467 times.
✓ Branch 1 taken 201 times.
✓ Branch 2 taken 24005422 times.
✓ Branch 3 taken 45 times.
|
24005668 | if ( !(cmb.triggerflags[0] & combotriggerONLYGENTRIG) && combo_class_buf[cmb.type].modify_hp_amount) |
| 7501 | { | ||
| 7502 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 45 times.
|
45 | if(cmb.usrflags&cflag1 ) |
| 7503 | ✗ | hp_mod[3] = cmb.attributes[0]/-10000L; | |
| 7504 | else | ||
| 7505 | 45 | hp_mod[3]=combo_class_buf[cmb.type].modify_hp_amount; | |
| 7506 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 45 times.
|
45 | if(!(cmb.usrflags&cflag2)) |
| 7507 | 45 | hasKB |= 1<<7; | |
| 7508 | 45 | } | |
| 7509 | } | ||
| 7510 | |||
| 7511 | 24005668 | int32_t bestffccid = 0; | |
| 7512 | 24005668 | int best_ffcpos = -1; | |
| 7513 | 24005668 | int32_t hp_modtotalffc = 0; | |
| 7514 | |||
| 7515 |
2/2✓ Branch 0 taken 48011336 times.
✓ Branch 1 taken 24005668 times.
|
72017004 | for (int32_t i = 0; i <= 1; ++i) |
| 7516 | { | ||
| 7517 |
2/2✓ Branch 0 taken 31352993 times.
✓ Branch 1 taken 16658343 times.
|
48011336 | if(tmpscr2[i].valid!=0) |
| 7518 | { | ||
| 7519 |
2/2✓ Branch 0 taken 13156917 times.
✓ Branch 1 taken 3501426 times.
|
16658343 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 7520 | { | ||
| 7521 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 13156917 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
13156917 | if (combobuf[MAPCOMBO2(i,dx1,dy1)].type == cBRIDGE && !_walkflag_layer(dx1,dy1,1, &(tmpscr2[i]))) {hp_mod[0] = 0; hasKB &= ~(1<<4);} |
| 7522 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 13156917 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
13156917 | if (combobuf[MAPCOMBO2(i,dx1,dy2)].type == cBRIDGE && !_walkflag_layer(dx1,dy2,1, &(tmpscr2[i]))) {hp_mod[1] = 0; hasKB &= ~(1<<5);} |
| 7523 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 13156917 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
13156917 | if (combobuf[MAPCOMBO2(i,dx2,dy1)].type == cBRIDGE && !_walkflag_layer(dx2,dy1,1, &(tmpscr2[i]))) {hp_mod[2] = 0; hasKB &= ~(1<<6);} |
| 7524 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 13156917 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
13156917 | if (combobuf[MAPCOMBO2(i,dx2,dy2)].type == cBRIDGE && !_walkflag_layer(dx2,dy2,1, &(tmpscr2[i]))) {hp_mod[3] = 0; hasKB &= ~(1<<7);} |
| 7525 | 13156917 | } | |
| 7526 | else | ||
| 7527 | { | ||
| 7528 |
4/4✓ Branch 0 taken 10124 times.
✓ Branch 1 taken 3491302 times.
✓ Branch 2 taken 2538 times.
✓ Branch 3 taken 7586 times.
|
3501426 | if (combobuf[MAPCOMBO2(i,dx1,dy1)].type == cBRIDGE && _effectflag_layer(dx1,dy1,1, &(tmpscr2[i]))) {hp_mod[0] = 0; hasKB &= ~(1<<4);} |
| 7529 |
4/4✓ Branch 0 taken 10154 times.
✓ Branch 1 taken 3491272 times.
✓ Branch 2 taken 2598 times.
✓ Branch 3 taken 7556 times.
|
3501426 | if (combobuf[MAPCOMBO2(i,dx1,dy2)].type == cBRIDGE && _effectflag_layer(dx1,dy2,1, &(tmpscr2[i]))) {hp_mod[1] = 0; hasKB &= ~(1<<5);} |
| 7530 |
4/4✓ Branch 0 taken 10148 times.
✓ Branch 1 taken 3491278 times.
✓ Branch 2 taken 2622 times.
✓ Branch 3 taken 7526 times.
|
3501426 | if (combobuf[MAPCOMBO2(i,dx2,dy1)].type == cBRIDGE && _effectflag_layer(dx2,dy1,1, &(tmpscr2[i]))) {hp_mod[2] = 0; hasKB &= ~(1<<6);} |
| 7531 |
4/4✓ Branch 0 taken 10181 times.
✓ Branch 1 taken 3491245 times.
✓ Branch 2 taken 2685 times.
✓ Branch 3 taken 7496 times.
|
3501426 | if (combobuf[MAPCOMBO2(i,dx2,dy2)].type == cBRIDGE && _effectflag_layer(dx2,dy2,1, &(tmpscr2[i]))) {hp_mod[3] = 0; hasKB &= ~(1<<7);} |
| 7532 | } | ||
| 7533 | 16658343 | } | |
| 7534 | 48011336 | } | |
| 7535 | |||
| 7536 |
2/2✓ Branch 0 taken 96022672 times.
✓ Branch 1 taken 24005668 times.
|
120028340 | for(int32_t i=0; i<4; i++) |
| 7537 | { | ||
| 7538 |
2/2✓ Branch 0 taken 1539890 times.
✓ Branch 1 taken 94482782 times.
|
96022672 | if(poses[i+4] < 0) continue; |
| 7539 |
2/2✓ Branch 0 taken 224021 times.
✓ Branch 1 taken 1315869 times.
|
1539890 | if(get_qr(qr_DMGCOMBOPRI)) |
| 7540 | { | ||
| 7541 |
2/2✓ Branch 0 taken 223905 times.
✓ Branch 1 taken 116 times.
|
224021 | if(hp_modtotalffc >= 0) |
| 7542 | { | ||
| 7543 |
2/2✓ Branch 0 taken 223840 times.
✓ Branch 1 taken 65 times.
|
223905 | if(hp_mod[i] < hp_modtotalffc) |
| 7544 | { | ||
| 7545 | 65 | hp_modtotalffc = hp_mod[i]; | |
| 7546 | 65 | bestffccid = cid[4+i]; | |
| 7547 | 65 | best_ffcpos = poses[4+i]; | |
| 7548 | 65 | } | |
| 7549 | 223905 | } | |
| 7550 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 112 times.
|
116 | else if(hp_mod[i] < 0) |
| 7551 | { | ||
| 7552 |
1/2✓ Branch 0 taken 112 times.
✗ Branch 1 not taken.
|
112 | if(hp_mod[i] > hp_modtotalffc) |
| 7553 | { | ||
| 7554 | ✗ | hp_modtotalffc = hp_mod[i]; | |
| 7555 | ✗ | bestffccid = cid[4+i]; | |
| 7556 | ✗ | best_ffcpos = poses[4+i]; | |
| 7557 | ✗ | } | |
| 7558 | 112 | } | |
| 7559 | 224021 | } | |
| 7560 |
2/2✓ Branch 0 taken 1315843 times.
✓ Branch 1 taken 26 times.
|
1315869 | else if(hp_mod[i] < hp_modtotalffc) |
| 7561 | { | ||
| 7562 | 26 | hp_modtotalffc = hp_mod[i]; | |
| 7563 | 26 | bestffccid = cid[4+i]; | |
| 7564 | 26 | best_ffcpos = poses[4+i]; | |
| 7565 | 26 | } | |
| 7566 | 1539890 | } | |
| 7567 | |||
| 7568 |
2/2✓ Branch 0 taken 2058 times.
✓ Branch 1 taken 24003610 times.
|
24005668 | int32_t hp_modmin = zc_min(hp_modtotal, hp_modtotalffc); |
| 7569 | 24005668 | int best_type = 0; | |
| 7570 |
2/2✓ Branch 0 taken 24005601 times.
✓ Branch 1 taken 67 times.
|
24005668 | if(hp_modtotalffc < hp_modtotal) |
| 7571 | { | ||
| 7572 | 67 | bestcid = bestffccid; | |
| 7573 | 67 | best_type = 1; | |
| 7574 | 67 | } | |
| 7575 | |||
| 7576 | 24005668 | bool global_defring = ((itemsbuf[current_item_id(itype_ring)].flags & item_flag1)); | |
| 7577 | 24005668 | bool global_perilring = ((itemsbuf[current_item_id(itype_perilring)].flags & item_flag1)); | |
| 7578 | 24005668 | bool current_ring = ((tmpscr->flags6&fTOGGLERINGDAMAGE) != 0); | |
| 7579 |
1/2✓ Branch 0 taken 24005668 times.
✗ Branch 1 not taken.
|
24005668 | if(current_ring) |
| 7580 | { | ||
| 7581 | ✗ | global_defring = !global_defring; | |
| 7582 | ✗ | global_perilring = !global_perilring; | |
| 7583 | ✗ | } | |
| 7584 | 24005668 | int32_t itemid = current_item_id(itype_boots); | |
| 7585 | |||
| 7586 |
2/2✓ Branch 0 taken 23169820 times.
✓ Branch 1 taken 835848 times.
|
24005668 | bool bootsnosolid = itemid >= 0 && 0 != (itemsbuf[itemid].flags & item_flag1); |
| 7587 |
2/2✓ Branch 0 taken 23169820 times.
✓ Branch 1 taken 835848 times.
|
24005668 | bool ignoreBoots = itemid >= 0 && (itemsbuf[itemid].flags & item_flag3); |
| 7588 | |||
| 7589 |
2/2✓ Branch 0 taken 24003529 times.
✓ Branch 1 taken 2139 times.
|
24005668 | if(hp_modmin<0) |
| 7590 | { | ||
| 7591 |
10/14✓ Branch 0 taken 1614 times.
✓ Branch 1 taken 525 times.
✓ Branch 2 taken 1614 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1614 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1614 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 5 times.
✓ Branch 9 taken 1609 times.
✓ Branch 10 taken 1614 times.
✓ Branch 11 taken 5 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 1614 times.
|
2139 | if((itemid<0) || ignoreBoots || (tmpscr->flags5&fDAMAGEWITHBOOTS) || (4<<current_item_power(itype_boots)<(abs(hp_modmin))) || (solid && bootsnosolid) || !(checkbunny(itemid) && checkmagiccost(itemid))) |
| 7592 | { | ||
| 7593 |
2/2✓ Branch 0 taken 529 times.
✓ Branch 1 taken 6 times.
|
535 | if (!do_health_check) return true; |
| 7594 | 529 | std::vector<int32_t> &ev = FFCore.eventData; | |
| 7595 | 529 | ev.clear(); | |
| 7596 | 529 | ev.push_back(-hp_modmin*10000); | |
| 7597 |
1/2✓ Branch 0 taken 529 times.
✗ Branch 1 not taken.
|
529 | ev.push_back((hasKB ? dir^1 : -1)*10000); |
| 7598 | 529 | ev.push_back(0); | |
| 7599 | 529 | ev.push_back(DivineProtectionShieldClk>0?10000:0); | |
| 7600 | 529 | ev.push_back(48*10000); | |
| 7601 | 529 | ev.push_back(ZSD_COMBODATA*10000); | |
| 7602 | 529 | ev.push_back(bestcid); | |
| 7603 | 529 | ev.push_back((best_type ? ZSD_FFC : ZSD_COMBOPOS)*10000); | |
| 7604 |
2/2✓ Branch 0 taken 67 times.
✓ Branch 1 taken 462 times.
|
529 | ev.push_back(best_type ? best_ffcpos : best_cpos*10000); |
| 7605 | |||
| 7606 | 529 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_1); | |
| 7607 | 529 | int32_t dmg = ev[0]/10000; | |
| 7608 | 529 | bool nullhit = ev[2] != 0; | |
| 7609 | |||
| 7610 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 529 times.
|
529 | if(nullhit) {ev.clear(); return false;} |
| 7611 | |||
| 7612 | //Args: 'damage (post-ring)','hitdir','nullifyhit','type:npc','npc uid' | ||
| 7613 | 529 | ev[0] = ringpower(dmg, !global_perilring, !global_defring)*10000; | |
| 7614 | |||
| 7615 | 529 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_2); | |
| 7616 | 529 | dmg = ev[0]/10000; | |
| 7617 | 529 | int32_t hdir = ev[1]/10000; | |
| 7618 | 529 | nullhit = ev[2] != 0; | |
| 7619 | 529 | bool divineprot = ev[3] != 0; | |
| 7620 | 529 | int32_t iframes = ev[4] / 10000; | |
| 7621 | 529 | ev.clear(); | |
| 7622 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 529 times.
|
529 | if(nullhit) return false; |
| 7623 | |||
| 7624 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 529 times.
|
529 | if(!divineprot) |
| 7625 | { | ||
| 7626 |
2/2✓ Branch 0 taken 510 times.
✓ Branch 1 taken 19 times.
|
529 | game->set_life(zc_max(game->get_life()-dmg,0)); |
| 7627 | 529 | } | |
| 7628 | |||
| 7629 | 529 | hitdir = hdir; | |
| 7630 | 529 | doHit(hitdir); | |
| 7631 | 529 | hclk = iframes; | |
| 7632 | 529 | return true; | |
| 7633 | } | ||
| 7634 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1614 times.
|
1614 | else if (do_health_check) paymagiccost(itemid); // Boots are successful |
| 7635 | 1614 | } | |
| 7636 | |||
| 7637 | 24005143 | return false; | |
| 7638 | 24008129 | } | |
| 7639 | |||
| 7640 | 30834 | int32_t HeroClass::hithero(int32_t hit2, int32_t force_hdir) | |
| 7641 | { | ||
| 7642 |
1/2✓ Branch 0 taken 30834 times.
✗ Branch 1 not taken.
|
30834 | if(force_hdir > 3) force_hdir = -1; |
| 7643 | 30834 | enemy* enemyptr = (enemy*)guys.spr(hit2); | |
| 7644 |
1/2✓ Branch 0 taken 30834 times.
✗ Branch 1 not taken.
|
30834 | if(!enemyptr) return 0; |
| 7645 | //printf("Stomp check: %d <= 12, %d < %d\n", int32_t((y+16)-(((enemy*)guys.spr(hit2))->y)), (int32_t)falling_oldy, (int32_t)y); | ||
| 7646 | 30834 | int32_t stompid = current_item_id(itype_stompboots); | |
| 7647 |
5/10✓ Branch 0 taken 15 times.
✓ Branch 1 taken 30819 times.
✓ Branch 2 taken 15 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 15 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 15 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
30834 | if(current_item(itype_stompboots) && checkbunny(stompid) && checkmagiccost(stompid) && (stomping || |
| 7648 |
1/2✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
|
15 | ((z+fakez) > (enemyptr->z+(enemyptr->fakez))) || |
| 7649 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
15 | ((isSideViewHero() && (y+16)-(enemyptr->y)<=14) && falling_oldy<y))) |
| 7650 | { | ||
| 7651 | ✗ | paymagiccost(stompid); | |
| 7652 | ✗ | hit_enemy(hit2,wStomp,itemsbuf[stompid].power*game->get_hero_dmgmult(),x,y,0,stompid); | |
| 7653 | |||
| 7654 | ✗ | if(itemsbuf[stompid].flags & item_flag1) | |
| 7655 | { | ||
| 7656 | ✗ | fall = -(itemsbuf[stompid].misc1); | |
| 7657 | ✗ | } | |
| 7658 | |||
| 7659 | ✗ | if(itemsbuf[stompid].flags & item_downgrade) | |
| 7660 | ✗ | game->set_item(stompid,false); | |
| 7661 | |||
| 7662 | // Stomp Boots script | ||
| 7663 | ✗ | if(itemsbuf[stompid].script != 0 && !(FFCore.doscript(ScriptType::Item, stompid) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING))) | |
| 7664 | { | ||
| 7665 | ✗ | int i = stompid; | |
| 7666 | ✗ | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 7667 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[stompid].script, i); | |
| 7668 | ✗ | FFCore.deallocateAllScriptOwned(ScriptType::Item, i); | |
| 7669 | ✗ | } | |
| 7670 | |||
| 7671 | ✗ | return -1; | |
| 7672 | } | ||
| 7673 |
6/6✓ Branch 0 taken 26573 times.
✓ Branch 1 taken 4261 times.
✓ Branch 2 taken 25785 times.
✓ Branch 3 taken 788 times.
✓ Branch 4 taken 47 times.
✓ Branch 5 taken 25738 times.
|
30834 | else if(superman || !scriptcoldet || fallclk) |
| 7674 | 5096 | return 0; | |
| 7675 | //!TODO SOLIDPUSH Enemy flag to make them not deal contact damage | ||
| 7676 | //!Add a flag check to this if: | ||
| 7677 |
5/6✓ Branch 0 taken 9384 times.
✓ Branch 1 taken 16354 times.
✓ Branch 2 taken 9384 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2619 times.
✓ Branch 5 taken 6765 times.
|
25740 | else if (!(enemyptr->stunclk==0 && enemyptr->frozenclock==0 && (!get_qr(qr_SAFEENEMYFADE) || enemyptr->fading != fade_flicker) |
| 7678 |
4/4✓ Branch 0 taken 2374 times.
✓ Branch 1 taken 245 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 9137 times.
|
9384 | && (enemyptr->d->family != eeGUY || enemyptr->dmisc1))) |
| 7679 | { | ||
| 7680 | 16599 | return -1; | |
| 7681 | } | ||
| 7682 | |||
| 7683 | 9139 | std::vector<int32_t> &ev = FFCore.eventData; | |
| 7684 | 9139 | ev.clear(); | |
| 7685 | //Args: 'damage (pre-ring)','hitdir','nullifyhit','type:npc','npc uid' | ||
| 7686 | 9139 | ev.push_back((enemy_dp(hit2) *10000)); | |
| 7687 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9139 times.
|
9139 | ev.push_back((force_hdir>-1 ? force_hdir : ((sprite*)enemyptr)->hitdir(x,y,16,16,dir))*10000); |
| 7688 | 9139 | ev.push_back(0); | |
| 7689 | 9139 | ev.push_back(DivineProtectionShieldClk>0?10000:0); | |
| 7690 | 9139 | ev.push_back(48*10000); | |
| 7691 | 9139 | ev.push_back(ZSD_NPC*10000); | |
| 7692 | 9139 | ev.push_back(enemyptr->getUID()); | |
| 7693 | 9139 | ev.push_back(ZSD_NONE*10000); | |
| 7694 | 9139 | ev.push_back(0); | |
| 7695 | |||
| 7696 | 9139 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_1); | |
| 7697 | 9139 | int32_t dmg = ev[0] / 10000; | |
| 7698 | 9139 | bool nullhit = ev[2] != 0; | |
| 7699 | |||
| 7700 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 9138 times.
|
9139 | if(nullhit) {ev.clear(); return -1;} |
| 7701 | |||
| 7702 | //Args: 'damage (post-ring)','hitdir','nullifyhit','type:npc','npc uid' | ||
| 7703 | 9138 | ev[0] = ((ringpower(dmg)*10000)); | |
| 7704 | |||
| 7705 | 9138 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_2); | |
| 7706 | 9138 | dmg = ev[0] / 10000; | |
| 7707 | 9138 | int32_t hdir = ev[1] / 10000; | |
| 7708 | 9138 | nullhit = ev[2] != 0; | |
| 7709 | 9138 | bool divineprot = ev[3] != 0; | |
| 7710 | 9138 | int32_t iframes = ev[4] / 10000; | |
| 7711 | 9138 | ev.clear(); | |
| 7712 | |||
| 7713 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9138 times.
|
9138 | if(nullhit) return -1; |
| 7714 | |||
| 7715 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9138 times.
|
9138 | if(!divineprot) |
| 7716 | { | ||
| 7717 |
2/2✓ Branch 0 taken 9084 times.
✓ Branch 1 taken 54 times.
|
9138 | game->set_life(zc_max(game->get_life()-dmg,0)); |
| 7718 | 9138 | sethitHeroUID(HIT_BY_NPC,(hit2+1)); | |
| 7719 | 9138 | sethitHeroUID(HIT_BY_NPC_UID,enemyptr->getUID()); | |
| 7720 |
2/2✓ Branch 0 taken 8901 times.
✓ Branch 1 taken 237 times.
|
9138 | if (get_qr(qr_BROKENHITBY)) |
| 7721 | { | ||
| 7722 | 8901 | sethitHeroUID(HIT_BY_NPC_UID,enemyptr->getUID()); | |
| 7723 | 8901 | } | |
| 7724 | else | ||
| 7725 | { | ||
| 7726 | 237 | sethitHeroUID(HIT_BY_NPC_UID,enemyptr->script_UID); | |
| 7727 | } | ||
| 7728 | 9138 | sethitHeroUID(HIT_BY_NPC_ENGINE_UID,enemyptr->getUID()); | |
| 7729 | 9138 | sethitHeroUID(HIT_BY_NPC_ID, enemyptr->id); | |
| 7730 | 9138 | sethitHeroUID(HIT_BY_NPC_TYPE, enemyptr->family); | |
| 7731 | 9138 | } | |
| 7732 | |||
| 7733 | 9138 | hitdir = hdir; | |
| 7734 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9138 times.
|
9138 | if (IsSideSwim()) |
| 7735 | { | ||
| 7736 | ✗ | action=sideswimhit; FFCore.setHeroAction(sideswimhit); | |
| 7737 | ✗ | } | |
| 7738 |
3/4✓ Branch 0 taken 9068 times.
✓ Branch 1 taken 70 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 9068 times.
|
9138 | else if(action==swimming || hopclk==0xFF) |
| 7739 | { | ||
| 7740 | 70 | action=swimhit; FFCore.setHeroAction(swimhit); | |
| 7741 | 70 | } | |
| 7742 | else | ||
| 7743 | { | ||
| 7744 | 9068 | action=gothit; FFCore.setHeroAction(gothit); | |
| 7745 | } | ||
| 7746 | |||
| 7747 | 9138 | hclk=iframes; | |
| 7748 | 9138 | sfx(getHurtSFX(),pan(x.getInt())); | |
| 7749 | |||
| 7750 |
8/8✓ Branch 0 taken 9114 times.
✓ Branch 1 taken 24 times.
✓ Branch 2 taken 9111 times.
✓ Branch 3 taken 3 times.
✓ Branch 4 taken 3757 times.
✓ Branch 5 taken 5354 times.
✓ Branch 6 taken 158 times.
✓ Branch 7 taken 3599 times.
|
9138 | if(charging > 0 || spins > 0 || attack == wSword || attack == wHammer) |
| 7751 | { | ||
| 7752 | 5539 | spins = charging = attackclk = 0; | |
| 7753 | 5539 | attack=none; | |
| 7754 | 5539 | tapping = false; | |
| 7755 | 5539 | } | |
| 7756 | |||
| 7757 | 9138 | enemy_scored(hit2); | |
| 7758 | 9138 | int32_t dm7 = enemyptr->dmisc7; | |
| 7759 | 9138 | int32_t dm8 = enemyptr->dmisc8; | |
| 7760 | |||
| 7761 |
3/3✓ Branch 0 taken 4457 times.
✓ Branch 1 taken 9 times.
✓ Branch 2 taken 4672 times.
|
9138 | switch(enemyptr->family) |
| 7762 | { | ||
| 7763 | case eeWALLM: | ||
| 7764 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
|
9 | if(enemyptr->hp>0) |
| 7765 | { | ||
| 7766 | 9 | GrabHero(hit2); | |
| 7767 | 9 | inwallm=true; | |
| 7768 | 9 | action=none; FFCore.setHeroAction(none); | |
| 7769 | 9 | } | |
| 7770 | 9 | break; | |
| 7771 | |||
| 7772 | //case eBUBBLEST: | ||
| 7773 | //case eeBUBBLE: | ||
| 7774 | case eeWALK: | ||
| 7775 | { | ||
| 7776 | 4672 | int32_t itemid = current_item_id(itype_whispring); | |
| 7777 | //I can only assume these are supposed to be int32_t, not bool ~pkmnfrk | ||
| 7778 |
3/4✓ Branch 0 taken 875 times.
✓ Branch 1 taken 3797 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 875 times.
|
4672 | int32_t sworddivisor = ((itemid>-1 && itemsbuf[itemid].misc1 & 1) ? itemsbuf[itemid].power : 1); |
| 7779 |
3/4✓ Branch 0 taken 875 times.
✓ Branch 1 taken 3797 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 875 times.
|
4672 | int32_t itemdivisor = ((itemid>-1 && itemsbuf[itemid].misc1 & 2) ? itemsbuf[itemid].power : 1); |
| 7780 |
3/4✓ Branch 0 taken 875 times.
✓ Branch 1 taken 3797 times.
✓ Branch 2 taken 875 times.
✗ Branch 3 not taken.
|
4672 | int32_t shielddivisor = ((itemid > -1 && itemsbuf[itemid].misc1 & 4) ? itemsbuf[itemid].power : 1); |
| 7781 |
7/7✓ Branch 0 taken 3791 times.
✓ Branch 1 taken 448 times.
✓ Branch 2 taken 145 times.
✓ Branch 3 taken 256 times.
✓ Branch 4 taken 5 times.
✓ Branch 5 taken 21 times.
✓ Branch 6 taken 6 times.
|
4672 | switch(dm7) |
| 7782 | { | ||
| 7783 | case e7tTEMPJINX: | ||
| 7784 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 400 times.
|
448 | if(dm8&e8tSWORD) |
| 7785 |
4/4✓ Branch 0 taken 389 times.
✓ Branch 1 taken 11 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 386 times.
|
786 | if(swordclk>=0 && !(sworddivisor==0)) |
| 7786 | 386 | swordclk=int32_t(150/sworddivisor); | |
| 7787 | |||
| 7788 |
2/2✓ Branch 0 taken 398 times.
✓ Branch 1 taken 50 times.
|
448 | if(dm8&e8tITEM) |
| 7789 |
3/4✓ Branch 0 taken 50 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 49 times.
|
99 | if(itemclk>=0 && !(itemdivisor==0)) |
| 7790 | 49 | itemclk=int32_t(150/itemdivisor); | |
| 7791 | |||
| 7792 |
1/2✓ Branch 0 taken 448 times.
✗ Branch 1 not taken.
|
448 | if(dm8&e8tSHIELD) |
| 7793 | ✗ | if (shieldjinxclk >= 0 && !(shielddivisor==0)) | |
| 7794 | ✗ | shieldjinxclk=int32_t(150/shielddivisor); | |
| 7795 | |||
| 7796 | 448 | break; | |
| 7797 | |||
| 7798 | case e7tPERMJINX: | ||
| 7799 |
2/2✓ Branch 0 taken 46 times.
✓ Branch 1 taken 99 times.
|
145 | if (dm8&e8tSWORD) |
| 7800 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 99 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 93 times.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
|
99 | if(sworddivisor) swordclk=(itemid >-1 && itemsbuf[itemid].flags & item_flag1)? int32_t(150/sworddivisor) : -1; |
| 7801 | |||
| 7802 |
2/2✓ Branch 0 taken 99 times.
✓ Branch 1 taken 46 times.
|
145 | if (dm8&e8tITEM) |
| 7803 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 46 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 36 times.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
|
46 | if(itemdivisor) itemclk=(itemid >-1 && itemsbuf[itemid].flags & item_flag1)? int32_t(150/itemdivisor) : -1; |
| 7804 | |||
| 7805 |
1/2✓ Branch 0 taken 145 times.
✗ Branch 1 not taken.
|
145 | if (dm8&e8tSHIELD) |
| 7806 | ✗ | if(shielddivisor) shieldjinxclk=(itemid >-1 && itemsbuf[itemid].flags & item_flag1)? int32_t(150/shielddivisor) : -1; | |
| 7807 | |||
| 7808 | 145 | break; | |
| 7809 | |||
| 7810 | case e7tUNJINX: | ||
| 7811 |
2/2✓ Branch 0 taken 57 times.
✓ Branch 1 taken 199 times.
|
256 | if (dm8&e8tSWORD) |
| 7812 | 199 | swordclk=0; | |
| 7813 | |||
| 7814 |
2/2✓ Branch 0 taken 180 times.
✓ Branch 1 taken 76 times.
|
256 | if (dm8&e8tITEM) |
| 7815 | 76 | itemclk=0; | |
| 7816 | |||
| 7817 |
1/2✓ Branch 0 taken 256 times.
✗ Branch 1 not taken.
|
256 | if (dm8&e8tSHIELD) |
| 7818 | ✗ | shieldjinxclk=0; | |
| 7819 | |||
| 7820 | 256 | break; | |
| 7821 | |||
| 7822 | case e7tTAKEMAGIC: | ||
| 7823 | 5 | game->change_dmagic(-dm8*game->get_magicdrainrate()); | |
| 7824 | 5 | break; | |
| 7825 | |||
| 7826 | case e7tTAKERUPEES: | ||
| 7827 | 21 | game->change_drupy(-dm8); | |
| 7828 | 21 | break; | |
| 7829 | |||
| 7830 | case e7tDRUNK: | ||
| 7831 | 6 | drunkclk += dm8; | |
| 7832 | 6 | break; | |
| 7833 | } | ||
| 7834 | 4672 | verifyAWpn(); | |
| 7835 |
2/2✓ Branch 0 taken 4534 times.
✓ Branch 1 taken 138 times.
|
4672 | if(dm7 >= e7tEATITEMS) |
| 7836 | { | ||
| 7837 | 138 | EatHero(hit2); | |
| 7838 | 138 | inlikelike=(dm7 == e7tEATHURT ? 2:1); | |
| 7839 | 138 | action=none; FFCore.setHeroAction(none); | |
| 7840 | 138 | } | |
| 7841 | } | ||
| 7842 | 4672 | } | |
| 7843 | 9138 | return 0; | |
| 7844 | 30834 | } | |
| 7845 | |||
| 7846 | 513551 | void HeroClass::addsparkle(int32_t wpn) | |
| 7847 | { | ||
| 7848 | //return; | ||
| 7849 | 513551 | weapon *w = (weapon*)Lwpns.spr(wpn); | |
| 7850 | 513551 | int32_t itemid = w->parentitem; | |
| 7851 | |||
| 7852 |
2/2✓ Branch 0 taken 508050 times.
✓ Branch 1 taken 5501 times.
|
513551 | if(itemid<0) |
| 7853 | 5501 | return; | |
| 7854 | |||
| 7855 | 508050 | int32_t itemtype = itemsbuf[itemid].family; | |
| 7856 | |||
| 7857 |
4/4✓ Branch 0 taken 507977 times.
✓ Branch 1 taken 73 times.
✓ Branch 2 taken 127016 times.
✓ Branch 3 taken 380961 times.
|
508050 | if(itemtype!=itype_cbyrna && frame%4) |
| 7858 | 380961 | return; | |
| 7859 | |||
| 7860 |
2/2✓ Branch 0 taken 73 times.
✓ Branch 1 taken 127016 times.
|
127089 | int32_t wpn2 = (itemtype==itype_cbyrna) ? itemsbuf[itemid].wpn4 : itemsbuf[itemid].wpn2; |
| 7861 |
2/2✓ Branch 0 taken 73 times.
✓ Branch 1 taken 127016 times.
|
127089 | int32_t wpn3 = (itemtype==itype_cbyrna) ? itemsbuf[itemid].wpn5 : itemsbuf[itemid].wpn3; |
| 7862 | // Either one (wpn2) or the other (wpn3). If both are present, randomise. | ||
| 7863 |
5/8✓ Branch 0 taken 37740 times.
✓ Branch 1 taken 89349 times.
✓ Branch 2 taken 69175 times.
✓ Branch 3 taken 20174 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 37740 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
127089 | int32_t sparkle_type = (!wpn2 ? (!wpn3 ? 0 : wpn3) : (!wpn3 ? wpn2 : (zc_oldrand()&1 ? wpn2 : wpn3))); |
| 7864 | 127089 | int32_t direction=w->dir; | |
| 7865 | |||
| 7866 |
2/2✓ Branch 0 taken 69175 times.
✓ Branch 1 taken 57914 times.
|
127089 | if(sparkle_type) |
| 7867 | { | ||
| 7868 | 57914 | int32_t h=0; | |
| 7869 | 57914 | int32_t v=0; | |
| 7870 | |||
| 7871 |
6/6✓ Branch 0 taken 45738 times.
✓ Branch 1 taken 12176 times.
✓ Branch 2 taken 40646 times.
✓ Branch 3 taken 5092 times.
✓ Branch 4 taken 7701 times.
✓ Branch 5 taken 32945 times.
|
57914 | if(w->dir==right||w->dir==r_up||w->dir==r_down) |
| 7872 | { | ||
| 7873 | 24969 | h=-1; | |
| 7874 | 24969 | } | |
| 7875 | |||
| 7876 |
6/6✓ Branch 0 taken 46119 times.
✓ Branch 1 taken 11795 times.
✓ Branch 2 taken 39437 times.
✓ Branch 3 taken 6682 times.
✓ Branch 4 taken 5665 times.
✓ Branch 5 taken 33772 times.
|
57914 | if(w->dir==left||w->dir==l_up||w->dir==l_down) |
| 7877 | { | ||
| 7878 | 24142 | h=1; | |
| 7879 | 24142 | } | |
| 7880 | |||
| 7881 |
6/6✓ Branch 0 taken 54015 times.
✓ Branch 1 taken 3899 times.
✓ Branch 2 taken 48350 times.
✓ Branch 3 taken 5665 times.
✓ Branch 4 taken 7701 times.
✓ Branch 5 taken 40649 times.
|
57914 | if(w->dir==down||w->dir==l_down||w->dir==r_down) |
| 7882 | { | ||
| 7883 | 17265 | v=-1; | |
| 7884 | 17265 | } | |
| 7885 | |||
| 7886 |
6/6✓ Branch 0 taken 53010 times.
✓ Branch 1 taken 4904 times.
✓ Branch 2 taken 46328 times.
✓ Branch 3 taken 6682 times.
✓ Branch 4 taken 5092 times.
✓ Branch 5 taken 41236 times.
|
57914 | if(w->dir==up||w->dir==l_up||w->dir==r_up) |
| 7887 | { | ||
| 7888 | 16678 | v=1; | |
| 7889 | 16678 | } | |
| 7890 | |||
| 7891 | // Damaging boomerang sparkle? | ||
| 7892 |
3/4✓ Branch 0 taken 20174 times.
✓ Branch 1 taken 37740 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 20174 times.
|
57914 | if(wpn3 && itemtype==itype_brang) |
| 7893 | { | ||
| 7894 | // If the boomerang just bounced, flip the sparkle direction so it doesn't hit | ||
| 7895 | // whatever it just bounced off of if it's shielded from that direction. | ||
| 7896 |
6/6✓ Branch 0 taken 13170 times.
✓ Branch 1 taken 7004 times.
✓ Branch 2 taken 12323 times.
✓ Branch 3 taken 847 times.
✓ Branch 4 taken 5336 times.
✓ Branch 5 taken 6987 times.
|
20174 | if(w->misc==1 && w->clk2>256 && w->clk2<272) |
| 7897 | 6987 | direction=oppositeDir[direction]; | |
| 7898 | 20174 | } | |
| 7899 |
4/4✓ Branch 0 taken 53641 times.
✓ Branch 1 taken 4273 times.
✓ Branch 2 taken 23899 times.
✓ Branch 3 taken 29742 times.
|
57914 | if(itemtype==itype_brang && get_qr(qr_WRONG_BRANG_TRAIL_DIR)) direction = 0; |
| 7900 |
2/2✓ Branch 0 taken 73 times.
✓ Branch 1 taken 57841 times.
|
57914 | zfix x = w->x+(itemtype==itype_cbyrna ? 2 : zc_oldrand()%4)+(h*4); |
| 7901 |
2/2✓ Branch 0 taken 73 times.
✓ Branch 1 taken 57841 times.
|
57914 | zfix y = w->y+(itemtype==itype_cbyrna ? 2 : zc_oldrand()%4)+(v*4)-w->fakez; |
| 7902 |
5/10✓ Branch 0 taken 57914 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 57914 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 57914 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 57914 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 57914 times.
✗ Branch 9 not taken.
|
57914 | Lwpns.add(new weapon(x, y, w->z, sparkle_type==wpn3 ? wFSparkle : wSSparkle,sparkle_type,0,direction,itemid,getUID(),false,false,true, 0, sparkle_type)); |
| 7903 | 57914 | weapon *w = (weapon*)(Lwpns.spr(Lwpns.Count()-1)); | |
| 7904 | 57914 | } | |
| 7905 | 513551 | } | |
| 7906 | |||
| 7907 | // For wPhantoms | ||
| 7908 | 7410 | void HeroClass::addsparkle2(int32_t type1, int32_t type2) | |
| 7909 | { | ||
| 7910 |
2/2✓ Branch 0 taken 5586 times.
✓ Branch 1 taken 1824 times.
|
7410 | if(frame%4) return; |
| 7911 | |||
| 7912 | 1824 | int32_t arrow = -1; | |
| 7913 | |||
| 7914 |
2/2✓ Branch 0 taken 1520 times.
✓ Branch 1 taken 10041 times.
|
11561 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 7915 | { | ||
| 7916 | 10041 | weapon *w = (weapon*)Lwpns.spr(i); | |
| 7917 | |||
| 7918 |
4/4✓ Branch 0 taken 6249 times.
✓ Branch 1 taken 3792 times.
✓ Branch 2 taken 5945 times.
✓ Branch 3 taken 304 times.
|
10041 | if(w->id == wPhantom && w->type == type1) |
| 7919 | { | ||
| 7920 | 304 | arrow = i; | |
| 7921 | 304 | break; | |
| 7922 | } | ||
| 7923 | 9737 | } | |
| 7924 | |||
| 7925 |
2/2✓ Branch 0 taken 304 times.
✓ Branch 1 taken 1520 times.
|
1824 | if(arrow==-1) |
| 7926 | { | ||
| 7927 | 1520 | return; | |
| 7928 | } | ||
| 7929 | |||
| 7930 | 304 | zfix x = (Lwpns.spr(arrow)->x-3)+(zc_oldrand()%7); | |
| 7931 | 304 | zfix y = (Lwpns.spr(arrow)->y-3)+(zc_oldrand()%7)-Lwpns.spr(arrow)->fakez; | |
| 7932 |
6/12✓ Branch 0 taken 304 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 304 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 304 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 304 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 304 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 304 times.
✗ Branch 11 not taken.
|
304 | Lwpns.add(new weapon(x, y, Lwpns.spr(arrow)->z, wPhantom, type2,0,0,((weapon*)Lwpns.spr(arrow))->parentitem,-1)); |
| 7933 | 7410 | } | |
| 7934 | |||
| 7935 | //cleans up decorations that exit the bounds of the screen for a int32_t time, to prevebt them wrapping around. | ||
| 7936 | 14151802 | void HeroClass::PhantomsCleanup() | |
| 7937 | { | ||
| 7938 |
2/2✓ Branch 0 taken 14150568 times.
✓ Branch 1 taken 1234 times.
|
14151802 | if(Lwpns.idCount(wPhantom)) |
| 7939 | { | ||
| 7940 |
2/2✓ Branch 0 taken 8023 times.
✓ Branch 1 taken 1234 times.
|
9257 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 7941 | { | ||
| 7942 | 8023 | weapon *w = ((weapon *)Lwpns.spr(i)); | |
| 7943 |
3/4✓ Branch 0 taken 4869 times.
✓ Branch 1 taken 3154 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4869 times.
|
8023 | if ( w->id == wPhantom && !w->isScriptGenerated() ) |
| 7944 | { | ||
| 7945 |
4/8✓ Branch 0 taken 4869 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4869 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4869 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 4869 times.
|
4869 | if ( w->x < -10000 || w->y > 10000 || w->x < -10000 || w->y > 10000 ) |
| 7946 | { | ||
| 7947 | ✗ | Lwpns.remove(w); | |
| 7948 | ✗ | } | |
| 7949 | 4869 | } | |
| 7950 | 8023 | } | |
| 7951 | 1234 | } | |
| 7952 | 14151802 | } | |
| 7953 | |||
| 7954 | //Waitframe handler for refilling operations | ||
| 7955 | 6288 | static void do_refill_waitframe() | |
| 7956 | { | ||
| 7957 | 6288 | put_passive_subscr(framebuf,0,passive_subscreen_offset,game->should_show_time(),sspUP); | |
| 7958 |
1/2✓ Branch 0 taken 6288 times.
✗ Branch 1 not taken.
|
6288 | if(get_qr(qr_PASSIVE_SUBSCRIPT_RUNS_WHEN_GAME_IS_FROZEN)) |
| 7959 | { | ||
| 7960 | ✗ | script_drawing_commands.Clear(); | |
| 7961 | ✗ | if(DMaps[currdmap].passive_sub_script != 0) | |
| 7962 | ✗ | ZScriptVersion::RunScript(ScriptType::ScriptedPassiveSubscreen, DMaps[currdmap].passive_sub_script, currdmap); | |
| 7963 | |||
| 7964 | ✗ | if (FFCore.waitdraw(ScriptType::ScriptedPassiveSubscreen) && DMaps[currdmap].passive_sub_script != 0 && FFCore.doscript(ScriptType::ScriptedPassiveSubscreen)) | |
| 7965 | { | ||
| 7966 | ✗ | ZScriptVersion::RunScript(ScriptType::ScriptedPassiveSubscreen, DMaps[currdmap].passive_sub_script, currdmap); | |
| 7967 | ✗ | FFCore.waitdraw(ScriptType::ScriptedPassiveSubscreen) = false; | |
| 7968 | ✗ | } | |
| 7969 | ✗ | do_script_draws(framebuf, tmpscr, 0, playing_field_offset); | |
| 7970 | ✗ | } | |
| 7971 | 6288 | advanceframe(true); | |
| 7972 | 6288 | } | |
| 7973 | //Special handler if it's a "fairy revive" | ||
| 7974 | ✗ | static void do_death_refill_waitframe() | |
| 7975 | { | ||
| 7976 | //!TODO Run a new script slot each frame here, before calling do_refill_waitframe() | ||
| 7977 | //This script should be able to draw a 'fairy saving the player' animation -Em | ||
| 7978 | ✗ | do_refill_waitframe(); | |
| 7979 | ✗ | } | |
| 7980 | |||
| 7981 | 1 | static size_t find_bottle_for_slot(size_t slot, bool unowned=false) | |
| 7982 | { | ||
| 7983 | 1 | int32_t found_unowned = -1; | |
| 7984 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 153 times.
|
153 | for(int q = 0; q < MAXITEMS; ++q) |
| 7985 | { | ||
| 7986 |
3/4✓ Branch 0 taken 1 times.
✓ Branch 1 taken 152 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
|
153 | if(itemsbuf[q].family == itype_bottle && itemsbuf[q].misc1 == slot) |
| 7987 | { | ||
| 7988 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if(game->get_item(q)) |
| 7989 | 1 | return q; | |
| 7990 | ✗ | if(unowned) | |
| 7991 | ✗ | found_unowned = q; | |
| 7992 | ✗ | } | |
| 7993 | 152 | } | |
| 7994 | ✗ | return found_unowned; | |
| 7995 | 1 | } | |
| 7996 | |||
| 7997 | ✗ | int32_t getPushDir(int32_t flag) | |
| 7998 | { | ||
| 7999 | ✗ | switch(flag) | |
| 8000 | { | ||
| 8001 | case mfPUSHUD: case mfPUSH4: case mfPUSHU: case mfPUSHUDNS: | ||
| 8002 | case mfPUSH4NS: case mfPUSHUNS: case mfPUSHUDINS: case mfPUSH4INS: | ||
| 8003 | case mfPUSHUINS: | ||
| 8004 | ✗ | return up; | |
| 8005 | case mfPUSHD: case mfPUSHDNS: case mfPUSHDINS: | ||
| 8006 | ✗ | return down; | |
| 8007 | case mfPUSHLR: case mfPUSHL: case mfPUSHLRNS: case mfPUSHLNS: | ||
| 8008 | case mfPUSHLRINS: case mfPUSHLINS: | ||
| 8009 | ✗ | return left; | |
| 8010 | case mfPUSHR: case mfPUSHRNS: case mfPUSHRINS: | ||
| 8011 | ✗ | return right; | |
| 8012 | } | ||
| 8013 | ✗ | return -1; | |
| 8014 | ✗ | } | |
| 8015 | |||
| 8016 | void post_item_collect(); | ||
| 8017 | |||
| 8018 | 14153431 | bool HeroClass::handle_portal_collide(portal* p) | |
| 8019 | { | ||
| 8020 |
1/2✓ Branch 0 taken 14153431 times.
✗ Branch 1 not taken.
|
14153431 | if(!p) return false; |
| 8021 | 14153431 | p->animate(0); | |
| 8022 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 14153431 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
14153431 | if(p->destdmap < 0 || p->destdmap >= MAXDMAPS) |
| 8023 | 14153431 | return false; | |
| 8024 | ✗ | if(abs(x - p->x) < 12 | |
| 8025 | ✗ | && abs(y - p->y) < 12) | |
| 8026 | { | ||
| 8027 | ✗ | if(p->prox_active) | |
| 8028 | { | ||
| 8029 | //Store some values to restore if 'warp fails' | ||
| 8030 | ✗ | int32_t tLastEntrance = lastentrance, | |
| 8031 | ✗ | tLastEntranceDMap = lastentrance_dmap, | |
| 8032 | ✗ | tContScr = game->get_continue_scrn(), | |
| 8033 | ✗ | tContDMap = game->get_continue_dmap(); | |
| 8034 | ✗ | int32_t sourcescr = currscr, sourcedmap = currdmap; | |
| 8035 | ✗ | zfix tx = x, ty = y, tz = z; | |
| 8036 | ✗ | x = p->x; | |
| 8037 | ✗ | y = p->y; | |
| 8038 | |||
| 8039 | ✗ | int32_t weff = p->weffect, | |
| 8040 | ✗ | wsfx = p->wsfx; | |
| 8041 | |||
| 8042 | ✗ | int32_t savep = p->saved_data; | |
| 8043 | //After this line, 'p' becomes INVALID! | ||
| 8044 | ✗ | FFCore.warp_player(wtIWARP, p->destdmap, p->destscr, | |
| 8045 | ✗ | -1, -1, weff, wsfx, 0, -1); | |
| 8046 | |||
| 8047 | ✗ | if(mirrorBonk()) //Invalid landing, warp back! | |
| 8048 | { | ||
| 8049 | ✗ | action = none; FFCore.setHeroAction(none); | |
| 8050 | ✗ | lastentrance = tLastEntrance; | |
| 8051 | ✗ | lastentrance_dmap = tLastEntranceDMap; | |
| 8052 | ✗ | game->set_continue_scrn(tContScr); | |
| 8053 | ✗ | game->set_continue_dmap(tContDMap); | |
| 8054 | ✗ | x = tx; | |
| 8055 | ✗ | y = ty; | |
| 8056 | ✗ | z = tz; | |
| 8057 | ✗ | FFCore.warp_player(wtIWARP, sourcedmap, sourcescr, -1, -1, weff, | |
| 8058 | ✗ | wsfx, 0, -1); | |
| 8059 | ✗ | handle_portal_prox(&mirror_portal); | |
| 8060 | ✗ | portals.forEach([&](sprite& p) | |
| 8061 | { | ||
| 8062 | ✗ | handle_portal_prox((portal*)&p); | |
| 8063 | ✗ | return false; | |
| 8064 | }); | ||
| 8065 | ✗ | } | |
| 8066 | ✗ | else game->clear_portal(savep); //Remove portal once used | |
| 8067 | ✗ | return true; | |
| 8068 | } | ||
| 8069 | ✗ | } | |
| 8070 | ✗ | else p->prox_active = true; | |
| 8071 | ✗ | return false; | |
| 8072 | 14153431 | } | |
| 8073 | 143 | void HeroClass::handle_portal_prox(portal* p) | |
| 8074 | { | ||
| 8075 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 143 times.
|
143 | if(!p) return; |
| 8076 |
2/2✓ Branch 0 taken 120 times.
✓ Branch 1 taken 23 times.
|
143 | p->prox_active = !(abs(x - p->x) < 12 && abs(y - p->y) < 12); |
| 8077 | 143 | } | |
| 8078 | // returns true when game over | ||
| 8079 | 41846577 | bool HeroClass::animate(int32_t) | |
| 8080 | { | ||
| 8081 | 41846577 | int32_t lsave=0; | |
| 8082 |
1/2✓ Branch 0 taken 41846577 times.
✗ Branch 1 not taken.
|
41846577 | if(immortal > 0) |
| 8083 | ✗ | --immortal; | |
| 8084 | 41846577 | prompt_combo = 0; | |
| 8085 |
2/2✓ Branch 0 taken 27693769 times.
✓ Branch 1 taken 14152808 times.
|
41846577 | if (onpassivedmg) |
| 8086 | { | ||
| 8087 | 27693769 | onpassivedmg=false; | |
| 8088 | 27693769 | } | |
| 8089 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 14152803 times.
|
14152808 | else if (damageovertimeclk) |
| 8090 | { | ||
| 8091 | 5 | damageovertimeclk = 0; | |
| 8092 | 5 | } | |
| 8093 | |||
| 8094 |
2/2✓ Branch 0 taken 41836171 times.
✓ Branch 1 taken 10406 times.
|
41846577 | if(lift_wpn) |
| 8095 | { | ||
| 8096 | 10406 | auto oldid = lift_wpn->id; | |
| 8097 |
2/2✓ Branch 0 taken 923 times.
✓ Branch 1 taken 9483 times.
|
10406 | switch(lift_wpn->id) |
| 8098 | { | ||
| 8099 | case wLitBomb: | ||
| 8100 | case wBomb: | ||
| 8101 | case wLitSBomb: | ||
| 8102 | case wSBomb: | ||
| 8103 |
2/4✓ Branch 0 taken 923 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 923 times.
|
923 | if(lift_wpn->misc && get_qr(qr_HELD_BOMBS_EXPLODE)) //timed fuse |
| 8104 | { | ||
| 8105 | 923 | lift_wpn->limited_animate(); | |
| 8106 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 923 times.
|
923 | if(lift_wpn->id != oldid) |
| 8107 | { | ||
| 8108 | ✗ | lift_wpn->moveflags &= ~move_obeys_grav; | |
| 8109 | ✗ | drop_liftwpn(); | |
| 8110 | ✗ | goto heroanimate_skip_liftwpn; | |
| 8111 | } | ||
| 8112 | 923 | ++lift_wpn->clk; | |
| 8113 | 923 | } | |
| 8114 | 923 | break; | |
| 8115 | } | ||
| 8116 |
1/2✓ Branch 0 taken 10406 times.
✗ Branch 1 not taken.
|
10406 | if(lift_wpn->dead>0) |
| 8117 | ✗ | --lift_wpn->dead; | |
| 8118 | |||
| 8119 |
1/2✓ Branch 0 taken 10406 times.
✗ Branch 1 not taken.
|
10406 | if(lift_wpn->dead==0) |
| 8120 | { | ||
| 8121 | ✗ | if(lift_wpn->death_spawnitem > -1) | |
| 8122 | { | ||
| 8123 | ✗ | item* itm = (new item(lift_wpn->x, lift_wpn->y, lift_wpn->z, lift_wpn->death_spawnitem, lift_wpn->death_item_pflags, 0)); | |
| 8124 | ✗ | itm->fakez = lift_wpn->fakez; | |
| 8125 | ✗ | items.add(itm); | |
| 8126 | ✗ | } | |
| 8127 | ✗ | if(lift_wpn->death_spawndropset > -1) | |
| 8128 | { | ||
| 8129 | ✗ | auto itid = select_dropitem(lift_wpn->death_spawndropset); | |
| 8130 | ✗ | if(itid > -1) | |
| 8131 | { | ||
| 8132 | ✗ | item* itm = (new item(lift_wpn->x, lift_wpn->y, lift_wpn->z, itid, lift_wpn->death_item_pflags, 0)); | |
| 8133 | ✗ | itm->fakez = lift_wpn->fakez; | |
| 8134 | ✗ | itm->from_dropset = lift_wpn->death_spawndropset; | |
| 8135 | ✗ | items.add(itm); | |
| 8136 | ✗ | } | |
| 8137 | ✗ | } | |
| 8138 | ✗ | switch(lift_wpn->death_sprite) | |
| 8139 | { | ||
| 8140 | ✗ | case -2: decorations.add(new dBushLeaves(lift_wpn->x, lift_wpn->y-(lift_wpn->z+lift_wpn->fakez), dBUSHLEAVES, 0, 0)); break; | |
| 8141 | ✗ | case -3: decorations.add(new dFlowerClippings(lift_wpn->x, lift_wpn->y-(lift_wpn->z+lift_wpn->fakez), dFLOWERCLIPPINGS, 0, 0)); break; | |
| 8142 | ✗ | case -4: decorations.add(new dGrassClippings(lift_wpn->x, lift_wpn->y-(lift_wpn->z+lift_wpn->fakez), dGRASSCLIPPINGS, 0, 0)); break; | |
| 8143 | default: | ||
| 8144 | ✗ | if(lift_wpn->death_sprite < 0) break; | |
| 8145 | ✗ | decorations.add(new comboSprite(lift_wpn->x, lift_wpn->y-(lift_wpn->z+lift_wpn->fakez), dCOMBOSPRITE, 0, lift_wpn->death_sprite)); | |
| 8146 | ✗ | } | |
| 8147 | ✗ | if(lift_wpn->death_sfx > 0) | |
| 8148 | ✗ | sfx(lift_wpn->death_sfx, pan(int32_t(lift_wpn->x))); | |
| 8149 | ✗ | delete lift_wpn; | |
| 8150 | ✗ | lift_wpn = nullptr; | |
| 8151 | ✗ | } | |
| 8152 | heroanimate_skip_liftwpn:; | ||
| 8153 | 10406 | } | |
| 8154 | |||
| 8155 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 41846577 times.
|
41846577 | if(cheats_execute_goto) |
| 8156 | { | ||
| 8157 | ✗ | didpit=true; | |
| 8158 | ✗ | pitx=x; | |
| 8159 | ✗ | pity=y; | |
| 8160 | ✗ | dowarp(3,0); | |
| 8161 | ✗ | cheats_execute_goto=false; | |
| 8162 | ✗ | solid_update(false); | |
| 8163 | ✗ | return false; | |
| 8164 | } | ||
| 8165 | |||
| 8166 |
1/2✓ Branch 0 taken 41846577 times.
✗ Branch 1 not taken.
|
41846577 | if(cheats_execute_light) |
| 8167 | { | ||
| 8168 | ✗ | toggle_lights(pal_litOVERRIDE); //Forcibly set permLit, overriding its current setting | |
| 8169 | ✗ | cheats_execute_light = false; | |
| 8170 | ✗ | } | |
| 8171 | |||
| 8172 |
3/4✓ Branch 0 taken 14153431 times.
✓ Branch 1 taken 27693146 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 14153431 times.
|
41846577 | if(action!=climbcovertop&&action!=climbcoverbottom) |
| 8173 | { | ||
| 8174 | 14153431 | climb_cover_x=-1000; | |
| 8175 | 14153431 | climb_cover_y=-1000; | |
| 8176 | 14153431 | } | |
| 8177 | |||
| 8178 | 41846577 | handle_portal_collide(&mirror_portal); | |
| 8179 |
1/2✓ Branch 0 taken 41846577 times.
✗ Branch 1 not taken.
|
41846577 | portals.forEach([&](sprite& p) |
| 8180 | { | ||
| 8181 | ✗ | return handle_portal_collide((portal*)&p); | |
| 8182 | }); | ||
| 8183 | |||
| 8184 |
3/4✓ Branch 0 taken 14137840 times.
✓ Branch 1 taken 27708737 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 14137840 times.
|
41846577 | if(z<=8&&fakez<=8) //Tall Grass |
| 8185 | { | ||
| 8186 | 14137840 | int maxlyr = get_qr(qr_BUSHESONLAYERS1AND2) ? 2 : 0; | |
| 8187 |
2/2✓ Branch 0 taken 632264 times.
✓ Branch 1 taken 13505576 times.
|
14137840 | if (get_qr(qr_GRASS_SENSITIVE)) |
| 8188 | { | ||
| 8189 | 632264 | bool g1 = false, g2 = false, g3 = false, g4 = false; | |
| 8190 |
2/2✓ Branch 0 taken 1813730 times.
✓ Branch 1 taken 632264 times.
|
2445994 | for(int q = maxlyr; q >= 0; --q) |
| 8191 | { | ||
| 8192 |
2/2✓ Branch 0 taken 2282 times.
✓ Branch 1 taken 1811448 times.
|
1813730 | g1 = g1 || isGrassType(combobuf[MAPCOMBO2(q-1,x+4,y+15)].type); |
| 8193 |
2/2✓ Branch 0 taken 2251 times.
✓ Branch 1 taken 1811479 times.
|
1813730 | g2 = g2 || isGrassType(combobuf[MAPCOMBO2(q-1,x+11,y+15)].type); |
| 8194 |
2/2✓ Branch 0 taken 2323 times.
✓ Branch 1 taken 1811407 times.
|
1813730 | g3 = g3 || isGrassType(combobuf[MAPCOMBO2(q-1,x+4,y+9)].type); |
| 8195 |
2/2✓ Branch 0 taken 2350 times.
✓ Branch 1 taken 1811380 times.
|
1813730 | g4 = g4 || isGrassType(combobuf[MAPCOMBO2(q-1,x+11,y+9)].type); |
| 8196 | 1813730 | } | |
| 8197 |
8/8✓ Branch 0 taken 8260 times.
✓ Branch 1 taken 624004 times.
✓ Branch 2 taken 7135 times.
✓ Branch 3 taken 1125 times.
✓ Branch 4 taken 6227 times.
✓ Branch 5 taken 908 times.
✓ Branch 6 taken 62 times.
✓ Branch 7 taken 6165 times.
|
632264 | if(g1 && g2 && g3 && g4) |
| 8198 | { | ||
| 8199 | 6165 | int grasscid = 0; | |
| 8200 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16508 times.
|
16508 | for(int q = maxlyr; q >= 0; --q) |
| 8201 | { | ||
| 8202 | 16508 | int cid = MAPCOMBO2(q-1,x+8,y+12); | |
| 8203 |
4/4✓ Branch 0 taken 7637 times.
✓ Branch 1 taken 8871 times.
✓ Branch 2 taken 1472 times.
✓ Branch 3 taken 6165 times.
|
16508 | if(cid > 0 && isGrassType(combobuf[cid].type)) |
| 8204 | { | ||
| 8205 | 6165 | grasscid = cid; | |
| 8206 | 6165 | break; | |
| 8207 | } | ||
| 8208 | 10343 | } | |
| 8209 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6165 times.
|
6165 | if(grasscid) |
| 8210 | { | ||
| 8211 | 6165 | newcombo const& cmb = combobuf[grasscid]; | |
| 8212 |
2/2✓ Branch 0 taken 5003 times.
✓ Branch 1 taken 1162 times.
|
6165 | if(decorations.idCount(dTALLGRASS)==0) |
| 8213 | { | ||
| 8214 |
3/6✓ Branch 0 taken 1162 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1162 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1162 times.
✗ Branch 5 not taken.
|
1162 | decorations.add(new dTallGrass(x, y, dTALLGRASS, 0, cmb.attribytes[6])); |
| 8215 | 1162 | } | |
| 8216 | 6165 | int32_t thesfx = cmb.attribytes[3]; | |
| 8217 |
2/2✓ Branch 0 taken 2035 times.
✓ Branch 1 taken 4130 times.
|
6165 | if (action==walking) |
| 8218 | 4130 | sfx_no_repeat(thesfx,pan((int32_t)x)); | |
| 8219 | 6165 | } | |
| 8220 | 6165 | } | |
| 8221 | 632264 | } | |
| 8222 | else | ||
| 8223 | { | ||
| 8224 | 13505576 | bool g1 = false, g2 = false; | |
| 8225 |
2/2✓ Branch 0 taken 13773986 times.
✓ Branch 1 taken 13505576 times.
|
27279562 | for(int q = maxlyr; q >= 0; --q) |
| 8226 | { | ||
| 8227 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13773986 times.
|
13773986 | g1 = g1 || isGrassType(combobuf[MAPCOMBO2(q-1,x,y+15)].type); |
| 8228 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13773986 times.
|
13773986 | g2 = g2 || isGrassType(combobuf[MAPCOMBO2(q-1,x+15,y+15)].type); |
| 8229 | 13773986 | } | |
| 8230 |
4/4✓ Branch 0 taken 135009 times.
✓ Branch 1 taken 13370567 times.
✓ Branch 2 taken 30116 times.
✓ Branch 3 taken 104893 times.
|
13505576 | if(g1 && g2) |
| 8231 | { | ||
| 8232 | 104893 | int grasscid = 0; | |
| 8233 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 107089 times.
|
107089 | for(int q = maxlyr; q >= 0; --q) |
| 8234 | { | ||
| 8235 | 107089 | int cid = MAPCOMBO2(q-1,x+8,y+15); | |
| 8236 |
3/4✓ Branch 0 taken 104893 times.
✓ Branch 1 taken 2196 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 104893 times.
|
107089 | if(cid > 0 && isGrassType(combobuf[cid].type)) |
| 8237 | { | ||
| 8238 | 104893 | grasscid = cid; | |
| 8239 | 104893 | break; | |
| 8240 | } | ||
| 8241 | 2196 | } | |
| 8242 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 104893 times.
|
104893 | if(grasscid) |
| 8243 | { | ||
| 8244 | 104893 | newcombo const& cmb = combobuf[grasscid]; | |
| 8245 |
2/2✓ Branch 0 taken 102285 times.
✓ Branch 1 taken 2608 times.
|
104893 | if(decorations.idCount(dTALLGRASS)==0) |
| 8246 | { | ||
| 8247 |
3/6✓ Branch 0 taken 2608 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2608 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2608 times.
✗ Branch 5 not taken.
|
2608 | decorations.add(new dTallGrass(x, y, dTALLGRASS, 0, cmb.attribytes[6])); |
| 8248 | 2608 | } | |
| 8249 | 104893 | int32_t thesfx = cmb.attribytes[3]; | |
| 8250 |
2/2✓ Branch 0 taken 38191 times.
✓ Branch 1 taken 66702 times.
|
104893 | if (action==walking ) |
| 8251 | 66702 | sfx_no_repeat(thesfx,pan((int32_t)x)); | |
| 8252 | 104893 | } | |
| 8253 | 104893 | } | |
| 8254 | } | ||
| 8255 | 14137840 | } | |
| 8256 |
3/4✓ Branch 0 taken 14135735 times.
✓ Branch 1 taken 27710842 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 14135735 times.
|
41846577 | if(z==0 && fakez==0) //Shallow Water / Custom Walk SFX |
| 8257 | { | ||
| 8258 |
2/2✓ Branch 0 taken 1108752 times.
✓ Branch 1 taken 13026983 times.
|
14135735 | if (get_qr(qr_SHALLOW_SENSITIVE)) |
| 8259 | { | ||
| 8260 |
18/22✓ Branch 0 taken 1100697 times.
✓ Branch 1 taken 8055 times.
✓ Branch 2 taken 1100697 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1096441 times.
✓ Branch 5 taken 4256 times.
✓ Branch 6 taken 1096185 times.
✓ Branch 7 taken 256 times.
✓ Branch 8 taken 1096185 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 1096185 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1092685 times.
✓ Branch 13 taken 3500 times.
✓ Branch 14 taken 1092685 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 1092652 times.
✓ Branch 17 taken 33 times.
✓ Branch 18 taken 1082241 times.
✓ Branch 19 taken 10411 times.
✓ Branch 20 taken 1288 times.
✓ Branch 21 taken 1080953 times.
|
1108752 | if (action != swimming && action != isdiving && action != drowning && action!=lavadrowning && action!=sidedrowning && action!=rafting && action != falling && !IsSideSwim() && !(ladderx+laddery) && !pull_hero && !toogam) |
| 8261 | { | ||
| 8262 |
2/2✓ Branch 0 taken 1028145 times.
✓ Branch 1 taken 52808 times.
|
1141508 | if (iswaterex(FFORCOMBO(x+11,y+15), currmap, currscr, -1, x+11,y+15, false, false, true, true) |
| 8263 |
2/2✓ Branch 0 taken 60555 times.
✓ Branch 1 taken 1020398 times.
|
1080953 | && iswaterex(FFORCOMBO(x+4,y+15), currmap, currscr, -1, x+4,y+15, false, false, true, true) |
| 8264 |
2/2✓ Branch 0 taken 56317 times.
✓ Branch 1 taken 4238 times.
|
60555 | && iswaterex(FFORCOMBO(x+11,y+9), currmap, currscr, -1, x+11,y+9, false, false, true, true) |
| 8265 |
2/2✓ Branch 0 taken 3363 times.
✓ Branch 1 taken 52954 times.
|
56317 | && iswaterex(FFORCOMBO(x+4,y+9), currmap, currscr, -1, x+4,y+9, false, false, true, true)) |
| 8266 | { | ||
| 8267 | 52808 | int watercheck_x = x.getInt()+7.5, watercheck_y = y.getInt()+12; | |
| 8268 | 52808 | int ffpos = getFFCAt(watercheck_x,watercheck_y); | |
| 8269 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 52808 times.
|
52808 | int combopos = ffpos < 0 ? COMBOPOS(watercheck_x,watercheck_y) : -1; |
| 8270 |
4/8✓ Branch 0 taken 52808 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 52808 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 52808 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 52808 times.
|
52808 | if(watercheck_x < 0 || watercheck_x > 255 || watercheck_y < 0 || watercheck_y > 175) |
| 8271 | ✗ | combopos = -1; | |
| 8272 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 52808 times.
✓ Branch 2 taken 52808 times.
✗ Branch 3 not taken.
|
52808 | int waterid = ffpos > -1 ? tmpscr->ffcs[ffpos].data : (combopos > -1 ? tmpscr->data[combopos] : 0); |
| 8273 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 52808 times.
|
52808 | if(waterid) |
| 8274 | 52808 | waterid = iswaterex(waterid, currmap, currscr, -1, watercheck_x,watercheck_y, false, false, true, true); | |
| 8275 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 52808 times.
|
52808 | if(waterid) |
| 8276 | { | ||
| 8277 | 52808 | newcombo const& watercmb = combobuf[waterid]; | |
| 8278 | 52808 | auto ripplesprite = watercmb.attribytes[6]; | |
| 8279 |
2/2✓ Branch 0 taken 52361 times.
✓ Branch 1 taken 447 times.
|
52808 | if(decorations.idCount(dRIPPLES)==0) |
| 8280 |
3/6✓ Branch 0 taken 447 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 447 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 447 times.
✗ Branch 5 not taken.
|
447 | decorations.add(new dRipples(x, y, dRIPPLES, 0, ripplesprite)); |
| 8281 |
2/2✓ Branch 0 taken 623 times.
✓ Branch 1 taken 52185 times.
|
52808 | if (watercmb.usrflags&cflag2) |
| 8282 | { | ||
| 8283 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 623 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
623 | if (!(current_item(watercmb.attribytes[2]) > 0 && current_item(watercmb.attribytes[2]) >= watercmb.attribytes[3])) |
| 8284 | { | ||
| 8285 | 623 | onpassivedmg = true; | |
| 8286 |
2/2✓ Branch 0 taken 309 times.
✓ Branch 1 taken 314 times.
|
623 | if (!damageovertimeclk) |
| 8287 | { | ||
| 8288 | 314 | int32_t curhp = game->get_life(); | |
| 8289 | 314 | auto dmg = watercmb.attributes[1]/10000L; | |
| 8290 | 314 | auto hitsfx = watercmb.attributes[2]/10000L; | |
| 8291 |
1/2✓ Branch 0 taken 314 times.
✗ Branch 1 not taken.
|
314 | bool hitstun = dmg < 0 && (watercmb.usrflags&cflag7); |
| 8292 | |||
| 8293 |
2/4✓ Branch 0 taken 314 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 314 times.
|
314 | if(game->get_life() == curhp && (watercmb.usrflags&cflag6)) |
| 8294 | 314 | hitsfx = 0; | |
| 8295 | |||
| 8296 | 314 | std::vector<int32_t> &ev = FFCore.eventData; | |
| 8297 | 314 | ev.clear(); | |
| 8298 | 314 | ev.push_back(-dmg*10000); | |
| 8299 | 314 | ev.push_back(-1*10000); | |
| 8300 | 314 | ev.push_back(0); | |
| 8301 | 314 | ev.push_back(0); | |
| 8302 | 314 | ev.push_back(48*10000); | |
| 8303 | 314 | ev.push_back(ZSD_COMBODATA*10000); | |
| 8304 | 314 | ev.push_back(waterid); | |
| 8305 | 314 | ev.push_back((ffpos > -1 ? ZSD_FFC : ZSD_COMBOPOS)*10000); | |
| 8306 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 314 times.
|
314 | ev.push_back(ffpos > -1 ? ffpos : combopos*10000); |
| 8307 | |||
| 8308 | 314 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_1); | |
| 8309 | |||
| 8310 |
1/2✓ Branch 0 taken 314 times.
✗ Branch 1 not taken.
|
314 | if(watercmb.usrflags & cflag5) |
| 8311 | ✗ | ev[0] = ringpower(ev[0]/10000) * 10000; | |
| 8312 | |||
| 8313 | 314 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_2); | |
| 8314 | 314 | dmg = -ev[0]/10000; | |
| 8315 | |||
| 8316 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 314 times.
|
314 | if(!ev[2]) //nullify |
| 8317 | { | ||
| 8318 | 314 | game->set_life(vbound(game->get_life()+dmg, 0, game->get_maxlife())); | |
| 8319 |
1/2✓ Branch 0 taken 314 times.
✗ Branch 1 not taken.
|
314 | if (hitsfx) |
| 8320 | ✗ | sfx(hitsfx); | |
| 8321 |
1/2✓ Branch 0 taken 314 times.
✗ Branch 1 not taken.
|
314 | if (hitstun) |
| 8322 | { | ||
| 8323 | ✗ | hclk = ev[4]/10000; | |
| 8324 | ✗ | hitdir = ev[1]/10000; | |
| 8325 | ✗ | action = gothit; FFCore.setHeroAction(gothit); | |
| 8326 | ✗ | } | |
| 8327 | 314 | } | |
| 8328 | 314 | } | |
| 8329 |
1/2✓ Branch 0 taken 623 times.
✗ Branch 1 not taken.
|
623 | if (watercmb.attribytes[1] > 0) |
| 8330 | { | ||
| 8331 |
3/4✓ Branch 0 taken 309 times.
✓ Branch 1 taken 314 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 309 times.
|
623 | if (!damageovertimeclk || damageovertimeclk > watercmb.attribytes[1]) damageovertimeclk = watercmb.attribytes[1]; |
| 8332 | 309 | else --damageovertimeclk; | |
| 8333 | 623 | } | |
| 8334 | ✗ | else damageovertimeclk = 0; | |
| 8335 | 623 | } | |
| 8336 | ✗ | else damageovertimeclk = 0; | |
| 8337 | 623 | } | |
| 8338 | 52185 | else damageovertimeclk = 0; | |
| 8339 | 52808 | int32_t thesfx = watercmb.attribytes[0]; | |
| 8340 |
4/4✓ Branch 0 taken 51858 times.
✓ Branch 1 taken 950 times.
✓ Branch 2 taken 46233 times.
✓ Branch 3 taken 5625 times.
|
52808 | if (watercmb.type != cSHALLOWWATER || !get_qr(qr_OLD_SHALLOW_SFX)) |
| 8341 | { | ||
| 8342 | 6575 | thesfx = watercmb.attribytes[5]; | |
| 8343 | 6575 | } | |
| 8344 |
2/2✓ Branch 0 taken 28715 times.
✓ Branch 1 taken 24093 times.
|
52808 | if (action==walking) |
| 8345 | 24093 | sfx_no_repeat(thesfx,pan((int32_t)x)); | |
| 8346 | 52808 | } | |
| 8347 | 52808 | } | |
| 8348 | 1080953 | } | |
| 8349 | 1108752 | } | |
| 8350 | else | ||
| 8351 | { | ||
| 8352 |
4/4✓ Branch 0 taken 12871554 times.
✓ Branch 1 taken 155429 times.
✓ Branch 2 taken 12884792 times.
✓ Branch 3 taken 142191 times.
|
13026983 | if((COMBOTYPE(x,y+15)==cSHALLOWWATER)&&(COMBOTYPE(x+15,y+15)==cSHALLOWWATER)) |
| 8353 | { | ||
| 8354 | 142191 | int32_t watercheck = FFORCOMBO(x+7.5,y.getInt()+15); | |
| 8355 | 142191 | auto ripplesprite = combobuf[watercheck].attribytes[6]; | |
| 8356 |
2/2✓ Branch 0 taken 140789 times.
✓ Branch 1 taken 1402 times.
|
142191 | if(decorations.idCount(dRIPPLES)==0) |
| 8357 | { | ||
| 8358 |
3/6✓ Branch 0 taken 1402 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1402 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1402 times.
✗ Branch 5 not taken.
|
1402 | decorations.add(new dRipples(x, y, dRIPPLES, 0, ripplesprite)); |
| 8359 | 1402 | } | |
| 8360 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 142191 times.
|
142191 | if (combobuf[watercheck].usrflags&cflag2) |
| 8361 | { | ||
| 8362 | ✗ | if (!(current_item(combobuf[watercheck].attribytes[2]) > 0 && current_item(combobuf[watercheck].attribytes[2]) >= combobuf[watercheck].attribytes[3])) | |
| 8363 | { | ||
| 8364 | ✗ | onpassivedmg = true; | |
| 8365 | ✗ | if (!damageovertimeclk) | |
| 8366 | { | ||
| 8367 | ✗ | int32_t curhp = game->get_life(); | |
| 8368 | ✗ | if (combobuf[watercheck].usrflags&cflag5) game->set_life(vbound(game->get_life()+ringpower(combobuf[watercheck].attributes[1]/10000L), 0, game->get_maxlife())); //Affected by rings | |
| 8369 | ✗ | else game->set_life(vbound(game->get_life()+(combobuf[watercheck].attributes[1]/10000L), 0, game->get_maxlife())); | |
| 8370 | ✗ | if ((combobuf[watercheck].attributes[2]/10000L) && (game->get_life() != curhp || !(combobuf[watercheck].usrflags&cflag6))) sfx(combobuf[watercheck].attributes[2]/10000L); | |
| 8371 | ✗ | } | |
| 8372 | ✗ | if (combobuf[watercheck].attribytes[1] > 0) | |
| 8373 | { | ||
| 8374 | ✗ | if (!damageovertimeclk || damageovertimeclk > combobuf[watercheck].attribytes[1]) damageovertimeclk = combobuf[watercheck].attribytes[1]; | |
| 8375 | ✗ | else --damageovertimeclk; | |
| 8376 | ✗ | } | |
| 8377 | ✗ | else damageovertimeclk = 0; | |
| 8378 | ✗ | } | |
| 8379 | ✗ | else damageovertimeclk = 0; | |
| 8380 | ✗ | } | |
| 8381 | 142191 | else damageovertimeclk = 0; | |
| 8382 | 142191 | int32_t thesfx = combobuf[watercheck].attribytes[0]; | |
| 8383 |
2/2✓ Branch 0 taken 53383 times.
✓ Branch 1 taken 88808 times.
|
142191 | if (action==walking ) |
| 8384 | 88808 | sfx_no_repeat(thesfx,pan((int32_t)x)); | |
| 8385 | 142191 | } | |
| 8386 | } | ||
| 8387 | |||
| 8388 | 14135735 | auto cpos = COMBOPOS(x+8,y+(sideview_mode()?16:12)); | |
| 8389 |
2/2✓ Branch 0 taken 98950145 times.
✓ Branch 1 taken 14135735 times.
|
113085880 | for(int q = 0; q < 7; ++q) |
| 8390 | { | ||
| 8391 | 98950145 | mapscr* lyr = FFCore.tempScreens[q]; | |
| 8392 | 98950145 | auto cid = lyr->data[cpos]; | |
| 8393 | 98950145 | newcombo const& cmb = combobuf[cid]; | |
| 8394 |
2/2✓ Branch 0 taken 52528945 times.
✓ Branch 1 taken 46421200 times.
|
98950145 | byte csfx = action == walking ? cmb.sfx_walking : cmb.sfx_standing; |
| 8395 |
2/2✓ Branch 0 taken 52528945 times.
✓ Branch 1 taken 46421200 times.
|
98950145 | byte cspr = action == walking ? cmb.spr_walking : cmb.spr_standing; |
| 8396 |
2/2✓ Branch 0 taken 9624 times.
✓ Branch 1 taken 98940521 times.
|
98950145 | if(csfx) |
| 8397 | 9624 | sfx_no_repeat(csfx); | |
| 8398 | 98950145 | auto indx = decorations.idFirst(dCUSTOMWALK); | |
| 8399 |
1/2✓ Branch 0 taken 98950145 times.
✗ Branch 1 not taken.
|
98950145 | if(cspr) |
| 8400 | { | ||
| 8401 | ✗ | if(indx < 0) | |
| 8402 | { | ||
| 8403 | ✗ | if(decorations.add(new customWalkSprite(x, y, dCUSTOMWALK, 0, -1))) | |
| 8404 | ✗ | indx = decorations.Count()-1; | |
| 8405 | ✗ | } | |
| 8406 | ✗ | if(indx > -1) | |
| 8407 | { | ||
| 8408 | ✗ | if(customWalkSprite* spr = dynamic_cast<customWalkSprite*>(decorations.spr(indx))) | |
| 8409 | ✗ | spr->run_sprite(cspr); | |
| 8410 | ✗ | } | |
| 8411 | ✗ | } | |
| 8412 | 98950145 | } | |
| 8413 | 14135735 | } | |
| 8414 | |||
| 8415 |
2/2✓ Branch 0 taken 41846180 times.
✓ Branch 1 taken 397 times.
|
41846577 | if(stomping) |
| 8416 | 397 | stomping = false; | |
| 8417 | |||
| 8418 |
1/2✓ Branch 0 taken 41846577 times.
✗ Branch 1 not taken.
|
41846577 | if(getOnSideviewLadder()) |
| 8419 | { | ||
| 8420 | ✗ | if(!canSideviewLadder() || jumping<0 || fall!=0 || fakefall!=0) | |
| 8421 | { | ||
| 8422 | ✗ | setOnSideviewLadder(false); | |
| 8423 | ✗ | } | |
| 8424 | ✗ | else if(CANFORCEFACEUP) | |
| 8425 | { | ||
| 8426 | ✗ | setDir(up); | |
| 8427 | ✗ | } | |
| 8428 | ✗ | } | |
| 8429 | |||
| 8430 |
7/8✓ Branch 0 taken 14136949 times.
✓ Branch 1 taken 27709628 times.
✓ Branch 2 taken 14130965 times.
✓ Branch 3 taken 5984 times.
✓ Branch 4 taken 14130709 times.
✓ Branch 5 taken 256 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 14130709 times.
|
41846577 | if(action!=inwind && action!=drowning && action!=lavadrowning && action!= sidedrowning) |
| 8431 | { | ||
| 8432 |
2/2✓ Branch 0 taken 13146005 times.
✓ Branch 1 taken 984704 times.
|
14130709 | if(!get_qr(qr_OLD_CHEST_COLLISION)) |
| 8433 | { | ||
| 8434 | 984704 | checkchest(cCHEST); | |
| 8435 | 984704 | checkchest(cLOCKEDCHEST); | |
| 8436 | 984704 | checkchest(cBOSSCHEST); | |
| 8437 | 984704 | } | |
| 8438 |
2/2✓ Branch 0 taken 13582672 times.
✓ Branch 1 taken 548037 times.
|
14130709 | if(!get_qr(qr_OLD_LOCKBLOCK_COLLISION)) |
| 8439 | { | ||
| 8440 | 548037 | checkchest(cLOCKBLOCK); | |
| 8441 | 548037 | checkchest(cBOSSLOCKBLOCK); | |
| 8442 | 548037 | } | |
| 8443 | 14130709 | } | |
| 8444 | 41846577 | checksigns(); | |
| 8445 | 41846577 | checkgenpush(); | |
| 8446 | |||
| 8447 |
4/4✓ Branch 0 taken 13409731 times.
✓ Branch 1 taken 28436846 times.
✓ Branch 2 taken 2586 times.
✓ Branch 3 taken 13407145 times.
|
41846577 | if(isStanding(true) && fall == 0) |
| 8448 | { | ||
| 8449 |
1/2✓ Branch 0 taken 13407145 times.
✗ Branch 1 not taken.
|
13407145 | if(extra_jump_count > 0) |
| 8450 | ✗ | extra_jump_count = 0; | |
| 8451 | 13407145 | coyotetime = 0; | |
| 8452 | 13407145 | } | |
| 8453 |
2/2✓ Branch 0 taken 27707546 times.
✓ Branch 1 taken 731886 times.
|
28439432 | else if(coyotetime < 65535) |
| 8454 | { | ||
| 8455 | 731886 | ++coyotetime; | |
| 8456 | 731886 | } | |
| 8457 |
2/2✓ Branch 0 taken 41838288 times.
✓ Branch 1 taken 8289 times.
|
41846577 | if(can_use_item(itype_hoverboots,i_hoverboots)) |
| 8458 | { | ||
| 8459 | 8289 | int32_t hoverid = current_item_id(itype_hoverboots); | |
| 8460 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8289 times.
|
8289 | if(!(itemsbuf[hoverid].flags & item_flag1)) |
| 8461 | { | ||
| 8462 |
1/2✓ Branch 0 taken 8289 times.
✗ Branch 1 not taken.
|
8289 | if(hoverclk < 0) hoverclk = 0; |
| 8463 | 8289 | hoverflags &= ~HOV_OUT; | |
| 8464 | 8289 | } | |
| 8465 | 8289 | } | |
| 8466 | 41846577 | bool platformfell2 = false; | |
| 8467 | 41846577 | int32_t gravity3 = (zinit.gravity/100); | |
| 8468 | 41846577 | int32_t termv = (zinit.terminalv); | |
| 8469 | 41846577 | int32_t rocs = getRocsPressed(); | |
| 8470 |
2/2✓ Branch 0 taken 41841000 times.
✓ Branch 1 taken 5577 times.
|
41846577 | if (rocs != -1) |
| 8471 | { | ||
| 8472 | 5577 | itemdata const& itm = itemsbuf[rocs]; | |
| 8473 |
1/2✓ Branch 0 taken 5577 times.
✗ Branch 1 not taken.
|
5577 | if (itm.flags & item_flag2) |
| 8474 | { | ||
| 8475 | ✗ | if ((!(itm.flags & item_flag3) || fall < 0) && | |
| 8476 | ✗ | (!(itm.flags & item_flag4) || fall > 0)) gravity3 = itm.misc3; | |
| 8477 | ✗ | } | |
| 8478 |
1/2✓ Branch 0 taken 5577 times.
✗ Branch 1 not taken.
|
5577 | if (itm.flags & item_flag5) |
| 8479 | { | ||
| 8480 | ✗ | termv = itm.misc4; | |
| 8481 | ✗ | if (fall > termv) fall = termv; | |
| 8482 | ✗ | } | |
| 8483 | 5577 | } | |
| 8484 |
2/2✓ Branch 0 taken 253982 times.
✓ Branch 1 taken 41592595 times.
|
41846577 | if(sideview_mode()) // Sideview gravity |
| 8485 | { | ||
| 8486 | //Handle falling through a platform | ||
| 8487 | 253982 | bool platformfell = false; | |
| 8488 |
3/4✓ Branch 0 taken 127897 times.
✓ Branch 1 taken 126085 times.
✓ Branch 2 taken 127897 times.
✗ Branch 3 not taken.
|
253982 | if (on_sideview_solid_oldpos(this,true,3) && !on_sideview_solid_oldpos(this,false,3)) |
| 8489 | { | ||
| 8490 | ✗ | if (!(!on_sideview_slope(Hero.x, Hero.y,Hero.old_x,Hero.old_y) && (on_sideview_slope(Hero.x,Hero.y+1,Hero.old_x,Hero.old_y) || on_sideview_slope(Hero.x, Hero.y + 2, Hero.old_x, Hero.old_y)) && Down())) platformfell = true; | |
| 8491 | ✗ | y+=1; //Fall down a pixel instantly, through the platform. | |
| 8492 | ✗ | if(fall < 0) fall = 0; | |
| 8493 | ✗ | if(jumping < 0) jumping = 0; | |
| 8494 | ✗ | platformfell2 = true; | |
| 8495 | ✗ | } | |
| 8496 | //Unless using old collision, run this check BEFORE moving Hero, to prevent clipping into the ceiling. | ||
| 8497 |
2/2✓ Branch 0 taken 250696 times.
✓ Branch 1 taken 3286 times.
|
253982 | if(!get_qr(qr_OLD_SIDEVIEW_CEILING_COLLISON)) |
| 8498 | { | ||
| 8499 |
14/22✓ Branch 0 taken 2664 times.
✓ Branch 1 taken 622 times.
✓ Branch 2 taken 622 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 622 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 622 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 622 times.
✓ Branch 10 taken 8 times.
✓ Branch 11 taken 614 times.
✓ Branch 12 taken 614 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 614 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 614 times.
✓ Branch 18 taken 614 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 3278 times.
✓ Branch 21 taken 8 times.
|
3908 | if(fall < 0 && (_walkflag(x+4,y+((bigHitbox||!diagonalMovement)?(fall/100):(fall/100)+8),1,SWITCHBLOCK_STATE) || _walkflag(x+12,y+((bigHitbox||!diagonalMovement)?(fall/100):(fall/100)+8),1,SWITCHBLOCK_STATE) |
| 8500 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 614 times.
✓ Branch 2 taken 614 times.
✗ Branch 3 not taken.
|
614 | || ((y+(fall/100)<=0) && |
| 8501 | // Extra checks if Smart Screen Scrolling is enabled | ||
| 8502 | ✗ | (nextcombo_wf(up) || ((get_qr(qr_SMARTSCREENSCROLL)&&(!(tmpscr->flags&fMAZE)) && | |
| 8503 | ✗ | !(tmpscr->flags2&wfUP)) && (nextcombo_solid(up))))))) | |
| 8504 | { | ||
| 8505 | 8 | fall = jumping = 0; // Bumped his head | |
| 8506 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if(get_qr(qr_OLD_SIDEVIEW_LANDING_CODE)) |
| 8507 | ✗ | y -= y.getInt()%8; //fix coords | |
| 8508 | // ... maybe on spikes //this is the change from 2.50.1RC3 that Saffith made, that breaks some old quests. -Z | ||
| 8509 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | if ( !get_qr(qr_OLDSIDEVIEWSPIKES) ) //fix for older sideview quests -Z |
| 8510 | { | ||
| 8511 | 8 | checkdamagecombos(x+4, x+12, y-1, y-1); | |
| 8512 | 8 | } | |
| 8513 | 8 | } | |
| 8514 | 3286 | } | |
| 8515 | // Fall, unless on a ladder, sideview ladder, rafting, using the hookshot, drowning, sideswimming or cheating. | ||
| 8516 |
7/14✗ Branch 0 not taken.
✓ Branch 1 taken 253982 times.
✓ Branch 2 taken 253982 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 253982 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 253982 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 253982 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 253982 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 253982 times.
|
253982 | if(!(toogam && Up()) && !drownclk && action!=rafting && !IsSideSwim() && !pull_hero && !((ladderx || laddery) && fall>0) && !getOnSideviewLadder()) |
| 8517 | { | ||
| 8518 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 253982 times.
|
253982 | int32_t ydiff = fall/(spins && fall<0 ? 200:100); |
| 8519 | 253982 | falling_oldy = y; // Stomp Boots-related variable | |
| 8520 |
5/8✓ Branch 0 taken 47822 times.
✓ Branch 1 taken 206160 times.
✓ Branch 2 taken 47822 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 47822 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 253982 times.
✗ Branch 7 not taken.
|
253982 | if(fall > 0 && (checkSVLadderPlatform(x+4,y+ydiff+15)||checkSVLadderPlatform(x+12,y+ydiff+15)) && (((y.getInt()+ydiff+15)&0xF0)!=((y.getInt()+15)&0xF0)) && !platform_fallthrough()) |
| 8521 | { | ||
| 8522 | ✗ | ydiff -= (y.getInt()+ydiff)%16; | |
| 8523 | ✗ | } | |
| 8524 |
4/4✓ Branch 0 taken 68044 times.
✓ Branch 1 taken 185938 times.
✓ Branch 2 taken 66794 times.
✓ Branch 3 taken 1250 times.
|
253982 | if(ydiff && !get_qr(qr_OLD_SIDEVIEW_LANDING_CODE)) |
| 8525 | { | ||
| 8526 |
2/2✓ Branch 0 taken 714 times.
✓ Branch 1 taken 536 times.
|
1250 | if(ydiff > 0) |
| 8527 | { | ||
| 8528 |
2/2✓ Branch 0 taken 684 times.
✓ Branch 1 taken 1464 times.
|
2148 | for(auto q = 0; q < ydiff; ++q) |
| 8529 | { | ||
| 8530 |
2/2✓ Branch 0 taken 1434 times.
✓ Branch 1 taken 30 times.
|
1464 | if(on_sideview_solid_oldpos(this, false, 0, 0, q)) |
| 8531 | { | ||
| 8532 | 30 | ydiff = q; | |
| 8533 | 30 | break; | |
| 8534 | } | ||
| 8535 | 1434 | } | |
| 8536 | 714 | } | |
| 8537 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 536 times.
|
536 | else if(ydiff < 0) |
| 8538 | { | ||
| 8539 |
2/2✓ Branch 0 taken 536 times.
✓ Branch 1 taken 1096 times.
|
1632 | for(auto q = 0; q > ydiff; --q) |
| 8540 | { | ||
| 8541 |
1/2✓ Branch 0 taken 1096 times.
✗ Branch 1 not taken.
|
1096 | if(_walkflag(x+4,y+(bigHitbox?0:8)+q-1,1) |
| 8542 |
1/2✓ Branch 0 taken 1096 times.
✗ Branch 1 not taken.
|
1096 | || _walkflag(x+12,y+(bigHitbox?0:8)+q,1)) |
| 8543 | { | ||
| 8544 | ✗ | ydiff = q; | |
| 8545 | ✗ | break; | |
| 8546 | } | ||
| 8547 | 1096 | } | |
| 8548 | 536 | } | |
| 8549 | 1250 | } | |
| 8550 | 253982 | y+=ydiff; | |
| 8551 | 253982 | hs_starty+=ydiff; | |
| 8552 | |||
| 8553 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 253982 times.
|
253982 | for(int32_t j=0; j<chainlinks.Count(); j++) |
| 8554 | { | ||
| 8555 | ✗ | chainlinks.spr(j)->y+=ydiff; | |
| 8556 | ✗ | } | |
| 8557 | |||
| 8558 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 253982 times.
|
253982 | if(Lwpns.idFirst(wHookshot)>-1) |
| 8559 | { | ||
| 8560 | ✗ | Lwpns.spr(Lwpns.idFirst(wHookshot))->y+=ydiff; | |
| 8561 | ✗ | } | |
| 8562 | |||
| 8563 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 253982 times.
|
253982 | if(Lwpns.idFirst(wHSHandle)>-1) |
| 8564 | { | ||
| 8565 | ✗ | Lwpns.spr(Lwpns.idFirst(wHSHandle))->y+=ydiff; | |
| 8566 | ✗ | } | |
| 8567 | 253982 | } | |
| 8568 | ✗ | else if(IsSideSwim() && action != sidewaterhold1 && action != sidewaterhold2 && action != sideswimcasting && action != sideswimfreeze) | |
| 8569 | { | ||
| 8570 | ✗ | fall = hoverclk = jumping = 0; | |
| 8571 | ✗ | inair = false; | |
| 8572 | ✗ | hoverflags = 0; | |
| 8573 | ✗ | if(!DrunkUp() && !DrunkDown() && !DrunkLeft() && !DrunkRight() && !autostep) | |
| 8574 | { | ||
| 8575 | ✗ | WalkflagInfo info; | |
| 8576 | ✗ | if (game->get_watergrav()<0) | |
| 8577 | { | ||
| 8578 | ✗ | info = walkflag(x,y+8-(bigHitbox*8)-2,2,up); | |
| 8579 | ✗ | execute(info); | |
| 8580 | ✗ | } | |
| 8581 | else | ||
| 8582 | { | ||
| 8583 | ✗ | info = walkflag(x,y+15+2,2,down); | |
| 8584 | ✗ | execute(info); | |
| 8585 | } | ||
| 8586 | ✗ | if(!info.isUnwalkable() && (game->get_watergrav() > 0 || iswaterex(MAPCOMBO(x,y+8-(bigHitbox*8)-2), currmap, currscr, -1, x, y+8-(bigHitbox*8)-2, true, false))) y+=(game->get_watergrav()/10000.0); | |
| 8587 | ✗ | } | |
| 8588 | ✗ | } | |
| 8589 | // Stop hovering/falling if you land on something. | ||
| 8590 | 253982 | bool needFall = false; | |
| 8591 |
6/8✓ Branch 0 taken 125600 times.
✓ Branch 1 taken 128382 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 253982 times.
✓ Branch 4 taken 128382 times.
✓ Branch 5 taken 125600 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 128382 times.
|
253982 | if((on_sideview_solid_oldpos(this) || getOnSideviewLadder()) && !(pull_hero && dir==down) && action!=rafting && !platformfell2) |
| 8592 | { | ||
| 8593 | 128382 | stop_item_sfx(itype_hoverboots); | |
| 8594 |
2/2✓ Branch 0 taken 126660 times.
✓ Branch 1 taken 1722 times.
|
128382 | if(get_qr(qr_OLD_SIDEVIEW_LANDING_CODE)) |
| 8595 | { | ||
| 8596 |
4/6✓ Branch 0 taken 126660 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 124016 times.
✓ Branch 3 taken 2644 times.
✓ Branch 4 taken 124016 times.
✗ Branch 5 not taken.
|
126660 | if(!getOnSideviewLadder() && (fall > 0 || get_qr(qr_OLD_SIDEVIEW_CEILING_COLLISON))) |
| 8597 | { | ||
| 8598 | 126660 | y.doFloor(); | |
| 8599 | 126660 | y-=(int32_t)y%8; //fix position | |
| 8600 | 126660 | } | |
| 8601 | 126660 | } | |
| 8602 | else | ||
| 8603 | { | ||
| 8604 | 1722 | snap_platform(); | |
| 8605 | } | ||
| 8606 | 128382 | fall = hoverclk = jumping = 0; | |
| 8607 | 128382 | inair = false; | |
| 8608 | 128382 | hoverflags = 0; | |
| 8609 | |||
| 8610 |
4/6✓ Branch 0 taken 8 times.
✓ Branch 1 taken 128374 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
|
128382 | if(y>=160 && currscr>=0x70 && !(tmpscr->flags2&wfDOWN)) // Landed on the bottommost screen. |
| 8611 | 8 | y = 160; | |
| 8612 | 128382 | } | |
| 8613 | // Stop hovering if you press down. | ||
| 8614 |
3/6✓ Branch 0 taken 125600 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 125600 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 125600 times.
✗ Branch 5 not taken.
|
125600 | else if((hoverclk>0 || ladderx || laddery) && DrunkDown()) |
| 8615 | { | ||
| 8616 | ✗ | stop_item_sfx(itype_hoverboots); | |
| 8617 | ✗ | hoverclk = -hoverclk; | |
| 8618 | ✗ | reset_ladder(); | |
| 8619 | ✗ | fall = gravity3; | |
| 8620 | ✗ | inair = false; | |
| 8621 | ✗ | } | |
| 8622 |
8/10✓ Branch 0 taken 125600 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2868 times.
✓ Branch 3 taken 122732 times.
✓ Branch 4 taken 1127 times.
✓ Branch 5 taken 1741 times.
✓ Branch 6 taken 1127 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 283 times.
✓ Branch 9 taken 844 times.
|
125600 | else if (hoverclk < 1 && !inair && fall == 0 && !IsSideSwim() && justmoved <= 0) |
| 8623 | { | ||
| 8624 | 844 | needFall = true; | |
| 8625 |
2/2✓ Branch 0 taken 728 times.
✓ Branch 1 taken 116 times.
|
844 | if (replay_version_check(0, 23)) |
| 8626 | { | ||
| 8627 | 728 | zfix my = y + 4; | |
| 8628 |
2/2✓ Branch 0 taken 602 times.
✓ Branch 1 taken 1971 times.
|
2573 | for (zfix ty = y + 1; ty < my; ++ty) |
| 8629 | { | ||
| 8630 |
2/2✓ Branch 0 taken 1845 times.
✓ Branch 1 taken 126 times.
|
1971 | if (on_sideview_solid_oldpos(this, false, 0, 0, ty-y)) |
| 8631 | { | ||
| 8632 | 126 | y = ty; | |
| 8633 |
1/2✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
|
126 | if (check_new_slope(x, ty + 1, 16, 16, old_x, old_y, false) < 0) |
| 8634 | { | ||
| 8635 | ✗ | if (!slopeid) | |
| 8636 | ✗ | slopeid = get_new_slope(x, ty + 1, 16, 16, old_x, old_y).get_info().slope(); | |
| 8637 | ✗ | onplatid = 1; | |
| 8638 | ✗ | } | |
| 8639 | 126 | needFall = false; | |
| 8640 | 126 | break; | |
| 8641 | } | ||
| 8642 | 1845 | } | |
| 8643 | 728 | } | |
| 8644 | else | ||
| 8645 | { | ||
| 8646 | 116 | zfix dy = 0; | |
| 8647 | 116 | bool landed = false; | |
| 8648 |
3/6✓ Branch 0 taken 116 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 116 times.
✗ Branch 5 not taken.
|
2088 | dy = binary_search_zfix(0, 4, [&](zfix val, zfix& retval) |
| 8649 | { | ||
| 8650 |
2/2✓ Branch 0 taken 116 times.
✓ Branch 1 taken 1856 times.
|
1972 | if (on_sideview_solid_oldpos(this, false, 0, 0, val)) |
| 8651 | { | ||
| 8652 | 116 | retval = val; | |
| 8653 | 116 | landed = true; | |
| 8654 | 116 | return BSEARCH_CONTINUE_TOWARD0; | |
| 8655 | } | ||
| 8656 | 1856 | else return BSEARCH_CONTINUE_AWAY0; | |
| 8657 | 1972 | }); | |
| 8658 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 112 times.
|
116 | if (dy) |
| 8659 | { | ||
| 8660 | 112 | push_move(0, dy); | |
| 8661 | 112 | } | |
| 8662 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 112 times.
|
116 | if (landed) |
| 8663 | { | ||
| 8664 |
2/2✓ Branch 0 taken 96 times.
✓ Branch 1 taken 16 times.
|
112 | if (check_new_slope(x, y + 0.0001_zf, 16, 16, old_x, old_y, false, true) < 0) |
| 8665 | { | ||
| 8666 |
2/2✓ Branch 0 taken 80 times.
✓ Branch 1 taken 16 times.
|
96 | if (!slopeid) |
| 8667 | 16 | slopeid = get_new_slope(x, y + 0.0001_zf, 16, 16, old_x, old_y).get_info().slope(); | |
| 8668 | 96 | onplatid = 1; | |
| 8669 | 96 | } | |
| 8670 | 112 | needFall = false; | |
| 8671 | 112 | } | |
| 8672 | } | ||
| 8673 | 844 | } | |
| 8674 | 124756 | else needFall = true; | |
| 8675 | // Continue falling. | ||
| 8676 | |||
| 8677 |
4/4✓ Branch 0 taken 246608 times.
✓ Branch 1 taken 7374 times.
✓ Branch 2 taken 128620 times.
✓ Branch 3 taken 117988 times.
|
253982 | if(fall <= termv && needFall) |
| 8678 | { | ||
| 8679 | 117988 | inair = true; | |
| 8680 |
3/4✓ Branch 0 taken 47075 times.
✓ Branch 1 taken 70913 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 47075 times.
|
117988 | if(fall != 0 || hoverclk>0) |
| 8681 | 70913 | jumping++; | |
| 8682 | |||
| 8683 | // Bump head if: hit a solid combo from beneath, or hit a solid combo in the screen above this one. | ||
| 8684 |
2/2✓ Branch 0 taken 116656 times.
✓ Branch 1 taken 1332 times.
|
117988 | if(get_qr(qr_OLD_SIDEVIEW_CEILING_COLLISON)) |
| 8685 | { | ||
| 8686 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 116656 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 116656 times.
✓ Branch 4 taken 116065 times.
✓ Branch 5 taken 591 times.
|
233312 | if((_walkflag(x+4,y-(bigHitbox?9:1),0,SWITCHBLOCK_STATE) |
| 8687 |
4/4✓ Branch 0 taken 111190 times.
✓ Branch 1 taken 5466 times.
✓ Branch 2 taken 906 times.
✓ Branch 3 taken 110284 times.
|
116656 | || (y<=(bigHitbox?9:1) && |
| 8688 | // Extra checks if Smart Screen Scrolling is enabled | ||
| 8689 |
2/6✓ Branch 0 taken 906 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 906 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
906 | (nextcombo_wf(up) || ((get_qr(qr_SMARTSCREENSCROLL)&&(!(tmpscr->flags&fMAZE)) && |
| 8690 | ✗ | !(tmpscr->flags2&wfUP)) && (nextcombo_solid(up)))))) | |
| 8691 |
0/2✗ Branch 0 not taken.
✗ Branch 1 not taken.
|
5466 | && fall < 0) |
| 8692 | { | ||
| 8693 | 591 | fall = jumping = 0; // Bumped his head | |
| 8694 | |||
| 8695 | // ... maybe on spikes //this is the change from 2.50.1RC3 that Saffith made, that breaks some old quests. -Z | ||
| 8696 |
2/2✓ Branch 0 taken 481 times.
✓ Branch 1 taken 110 times.
|
591 | if ( !get_qr(qr_OLDSIDEVIEWSPIKES) ) //fix for older sideview quests -Z |
| 8697 | { | ||
| 8698 | 110 | checkdamagecombos(x+4, x+12, y-1, y-1); | |
| 8699 | 110 | } | |
| 8700 | 591 | } | |
| 8701 | 116656 | } | |
| 8702 | else | ||
| 8703 | { | ||
| 8704 |
10/16✗ Branch 0 not taken.
✓ Branch 1 taken 1332 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1332 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1332 times.
✓ Branch 6 taken 10 times.
✓ Branch 7 taken 1322 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1322 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 1322 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 1322 times.
✓ Branch 14 taken 1330 times.
✓ Branch 15 taken 2 times.
|
2664 | if((_walkflag(x+4,y+((bigHitbox||!diagonalMovement)?-1:7),1,SWITCHBLOCK_STATE) || _walkflag(x+12,y+((bigHitbox||!diagonalMovement)?-1:7),1,SWITCHBLOCK_STATE) |
| 8705 |
2/4✓ Branch 0 taken 1322 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1322 times.
|
1322 | || ((y<=0) && |
| 8706 | // Extra checks if Smart Screen Scrolling is enabled | ||
| 8707 | ✗ | (nextcombo_wf(up) || ((get_qr(qr_SMARTSCREENSCROLL)&&(!(tmpscr->flags&fMAZE)) && | |
| 8708 | ✗ | !(tmpscr->flags2&wfUP)) && (nextcombo_solid(up)))))) | |
| 8709 |
0/2✗ Branch 0 not taken.
✗ Branch 1 not taken.
|
10 | && fall < 0) |
| 8710 | { | ||
| 8711 | 2 | fall = jumping = 0; // Bumped his head | |
| 8712 | 2 | y -= y.getInt()%8; //fix coords | |
| 8713 | // ... maybe on spikes //this is the change from 2.50.1RC3 that Saffith made, that breaks some old quests. -Z | ||
| 8714 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if ( !get_qr(qr_OLDSIDEVIEWSPIKES) ) //fix for older sideview quests -Z |
| 8715 | { | ||
| 8716 | 2 | checkdamagecombos(x+4, x+12, y-1, y-1); | |
| 8717 | 2 | } | |
| 8718 | 2 | } | |
| 8719 | } | ||
| 8720 | |||
| 8721 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 117988 times.
|
117988 | if(hoverclk > 0) |
| 8722 | { | ||
| 8723 | ✗ | if(hoverclk > 0 && !(hoverflags&HOV_INF)) | |
| 8724 | { | ||
| 8725 | ✗ | --hoverclk; | |
| 8726 | ✗ | } | |
| 8727 | |||
| 8728 | ✗ | if(!hoverclk && !ladderx && !laddery) | |
| 8729 | { | ||
| 8730 | ✗ | fall += gravity3; | |
| 8731 | ✗ | hoverflags |= HOV_OUT | HOV_PITFALL_OUT; | |
| 8732 | ✗ | } | |
| 8733 | ✗ | } | |
| 8734 |
5/12✓ Branch 0 taken 85536 times.
✓ Branch 1 taken 32452 times.
✓ Branch 2 taken 47774 times.
✓ Branch 3 taken 37762 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 47774 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
117988 | else if(fall+gravity3 > 0 && fall<=0 && can_use_item(itype_hoverboots,i_hoverboots) && !ladderx && !laddery && !(hoverflags & HOV_OUT)) |
| 8735 | { | ||
| 8736 | ✗ | int32_t itemid = current_item_id(itype_hoverboots); | |
| 8737 | ✗ | if(hoverclk < 0) | |
| 8738 | ✗ | hoverclk = -hoverclk; | |
| 8739 | else | ||
| 8740 | { | ||
| 8741 | ✗ | fall = jumping = 0; | |
| 8742 | ✗ | if(itemsbuf[itemid].misc1) | |
| 8743 | ✗ | hoverclk = itemsbuf[itemid].misc1; | |
| 8744 | else | ||
| 8745 | { | ||
| 8746 | ✗ | hoverclk = 1; | |
| 8747 | ✗ | hoverflags |= HOV_INF; | |
| 8748 | } | ||
| 8749 | |||
| 8750 | |||
| 8751 | ✗ | sfx(itemsbuf[itemid].usesound,pan(x.getInt())); | |
| 8752 | } | ||
| 8753 | ✗ | if(itemsbuf[itemid].wpn) | |
| 8754 | ✗ | decorations.add(new dHover(x, y, dHOVER, 0)); | |
| 8755 | ✗ | } | |
| 8756 |
4/8✓ Branch 0 taken 117988 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 117988 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 117988 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 117988 times.
|
117988 | else if(!ladderx && !laddery && !getOnSideviewLadder() && !IsSideSwim()) |
| 8757 | { | ||
| 8758 | 117988 | fall += gravity3; | |
| 8759 | |||
| 8760 | 117988 | } | |
| 8761 | 117988 | } | |
| 8762 | 253982 | } | |
| 8763 | else // Topdown gravity | ||
| 8764 | { | ||
| 8765 |
4/4✓ Branch 0 taken 27693148 times.
✓ Branch 1 taken 13899447 times.
✓ Branch 2 taken 13895989 times.
✓ Branch 3 taken 3458 times.
|
41592595 | if (!(moveflags & move_no_fake_z)) fakez-=fakefall/(spins && fakefall>0 ? 200:100); |
| 8766 |
4/4✓ Branch 0 taken 27693148 times.
✓ Branch 1 taken 13899447 times.
✓ Branch 2 taken 13895989 times.
✓ Branch 3 taken 3458 times.
|
41592595 | if (!(moveflags & move_no_real_z)) z-=fall/(spins && fall>0 ? 200:100); |
| 8767 |
4/4✓ Branch 0 taken 13881768 times.
✓ Branch 1 taken 27710827 times.
✓ Branch 2 taken 27728506 times.
✓ Branch 3 taken 41610274 times.
|
41592595 | if(z>0||fakez>0) |
| 8768 | { | ||
| 8769 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 17679 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
55439333 | switch(action) |
| 8770 | { | ||
| 8771 | case swimming: | ||
| 8772 | { | ||
| 8773 | ✗ | diveclk=0; | |
| 8774 | ✗ | action=walking; FFCore.setHeroAction(walking); | |
| 8775 | |||
| 8776 | ✗ | break; | |
| 8777 | } | ||
| 8778 | case waterhold1: | ||
| 8779 | { | ||
| 8780 | ✗ | action=landhold1; FFCore.setHeroAction(landhold1); | |
| 8781 | ✗ | break; | |
| 8782 | } | ||
| 8783 | |||
| 8784 | case waterhold2: | ||
| 8785 | { | ||
| 8786 | ✗ | action=landhold2; FFCore.setHeroAction(landhold2); | |
| 8787 | ✗ | break; | |
| 8788 | } | ||
| 8789 | |||
| 8790 | default: | ||
| 8791 | 17679 | break; | |
| 8792 | } | ||
| 8793 | 17679 | } | |
| 8794 | |||
| 8795 |
2/2✓ Branch 0 taken 160107 times.
✓ Branch 1 taken 41627953 times.
|
41788060 | for(int32_t j=0; j<chainlinks.Count(); j++) |
| 8796 | { | ||
| 8797 | 160107 | chainlinks.spr(j)->z=z; | |
| 8798 | 160107 | chainlinks.spr(j)->fakez=fakez; | |
| 8799 | 160107 | } | |
| 8800 | |||
| 8801 |
2/2✓ Branch 0 taken 41583109 times.
✓ Branch 1 taken 44844 times.
|
41627953 | if(Lwpns.idFirst(wHookshot)>-1) |
| 8802 | { | ||
| 8803 | 44844 | Lwpns.spr(Lwpns.idFirst(wHookshot))->z=z; | |
| 8804 | 44844 | Lwpns.spr(Lwpns.idFirst(wHookshot))->fakez=fakez; | |
| 8805 | 44844 | } | |
| 8806 | |||
| 8807 |
2/2✓ Branch 0 taken 41580677 times.
✓ Branch 1 taken 47276 times.
|
41627953 | if(Lwpns.idFirst(wHSHandle)>-1) |
| 8808 | { | ||
| 8809 | 47276 | Lwpns.spr(Lwpns.idFirst(wHSHandle))->z=z; | |
| 8810 | 47276 | Lwpns.spr(Lwpns.idFirst(wHSHandle))->fakez=fakez; | |
| 8811 | 47276 | } | |
| 8812 | |||
| 8813 |
3/4✓ Branch 0 taken 13881768 times.
✓ Branch 1 taken 27746185 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 13881768 times.
|
41627953 | if(z<=0&&!(moveflags & move_no_real_z)) |
| 8814 | { | ||
| 8815 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 13881768 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
13881768 | if (fakez <= 0 || (moveflags & move_no_fake_z)) |
| 8816 | { | ||
| 8817 |
2/2✓ Branch 0 taken 13881359 times.
✓ Branch 1 taken 409 times.
|
13881768 | if(fall > 0) |
| 8818 | { | ||
| 8819 |
7/8✓ Branch 0 taken 10 times.
✓ Branch 1 taken 399 times.
✓ Branch 2 taken 9 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 387 times.
✓ Branch 7 taken 22 times.
|
409 | if((iswaterex(MAPCOMBO(x,y+8), currmap, currscr, -1, x, y+8, true, false) && ladderx<=0 && laddery<=0) || COMBOTYPE(x,y+8)==cSHALLOWWATER) |
| 8820 | 22 | sfx(WAV_ZN1SPLASH,x.getInt()); | |
| 8821 | |||
| 8822 | 409 | stomping = true; | |
| 8823 | 409 | } | |
| 8824 | 13881768 | } | |
| 8825 | 13881768 | z = fall = 0; | |
| 8826 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 13881768 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
13881768 | if (fakez <= 0 || (moveflags & move_no_fake_z)) |
| 8827 | { | ||
| 8828 | 13881768 | jumping = 0; | |
| 8829 |
2/2✓ Branch 0 taken 13877913 times.
✓ Branch 1 taken 3855 times.
|
13881768 | if(check_pitslide(true) == -1) |
| 8830 | { | ||
| 8831 | 13877913 | hoverclk = 0; | |
| 8832 | 13877913 | hoverflags = 0; | |
| 8833 | 13877913 | } | |
| 8834 |
3/4✓ Branch 0 taken 17 times.
✓ Branch 1 taken 3838 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 17 times.
|
3855 | else if(hoverclk > 0 && !(hoverflags&HOV_INF)) |
| 8835 | { | ||
| 8836 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!--hoverclk) |
| 8837 | { | ||
| 8838 | ✗ | hoverflags |= HOV_OUT | HOV_PITFALL_OUT; | |
| 8839 | ✗ | } | |
| 8840 | 17 | } | |
| 8841 | 13881768 | } | |
| 8842 | 13881768 | } | |
| 8843 |
3/4✓ Branch 0 taken 13899447 times.
✓ Branch 1 taken 27728506 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 13899447 times.
|
41627953 | if(fakez<=0&&!(moveflags & move_no_fake_z)) |
| 8844 | { | ||
| 8845 |
3/4✓ Branch 0 taken 17679 times.
✓ Branch 1 taken 13881768 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 17679 times.
|
13899447 | if (z <= 0 || (moveflags & move_no_real_z)) |
| 8846 | { | ||
| 8847 |
1/2✓ Branch 0 taken 13881768 times.
✗ Branch 1 not taken.
|
13881768 | if(fakefall > 0) |
| 8848 | { | ||
| 8849 | ✗ | if((iswaterex(MAPCOMBO(x,y+8), currmap, currscr, -1, x, y+8, true, false) && ladderx<=0 && laddery<=0) || COMBOTYPE(x,y+8)==cSHALLOWWATER) | |
| 8850 | ✗ | sfx(WAV_ZN1SPLASH,x.getInt()); | |
| 8851 | |||
| 8852 | ✗ | stomping = true; | |
| 8853 | ✗ | } | |
| 8854 | 13881768 | } | |
| 8855 | 13899447 | fakez = fakefall = 0; | |
| 8856 |
3/4✓ Branch 0 taken 17679 times.
✓ Branch 1 taken 13881768 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 17679 times.
|
13899447 | if (z <= 0 || (moveflags & move_no_real_z)) |
| 8857 | { | ||
| 8858 | 13881768 | jumping = 0; | |
| 8859 |
2/2✓ Branch 0 taken 13877913 times.
✓ Branch 1 taken 3855 times.
|
13881768 | if(check_pitslide(true) == -1) |
| 8860 | { | ||
| 8861 | 13877913 | hoverclk = 0; | |
| 8862 | 13877913 | hoverflags = 0; | |
| 8863 | 13877913 | } | |
| 8864 |
3/4✓ Branch 0 taken 17 times.
✓ Branch 1 taken 3838 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 17 times.
|
3855 | else if(hoverclk > 0 && !(hoverflags&HOV_INF)) |
| 8865 | { | ||
| 8866 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!--hoverclk) |
| 8867 | { | ||
| 8868 | ✗ | hoverflags |= HOV_OUT | HOV_PITFALL_OUT; | |
| 8869 | ✗ | } | |
| 8870 | 17 | } | |
| 8871 | 13881768 | } | |
| 8872 | 13899447 | } | |
| 8873 |
8/10✓ Branch 0 taken 13899365 times.
✓ Branch 1 taken 27728588 times.
✓ Branch 2 taken 13899365 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 13864253 times.
✓ Branch 5 taken 35112 times.
✓ Branch 6 taken 13881850 times.
✓ Branch 7 taken 13881850 times.
✓ Branch 8 taken 13881850 times.
✗ Branch 9 not taken.
|
41627953 | if(fall <= termv && !(moveflags & move_no_real_z) && z>0 || fakefall <= termv && !(moveflags & move_no_fake_z) && fakez > 0) |
| 8874 | { | ||
| 8875 |
4/6✓ Branch 0 taken 3049 times.
✓ Branch 1 taken 14548 times.
✓ Branch 2 taken 3049 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 3049 times.
|
27746103 | if(fall != 0 || fakefall != 0 || hoverclk>0) |
| 8876 | 14548 | jumping++; | |
| 8877 | |||
| 8878 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17597 times.
|
17597 | if(hoverclk > 0) |
| 8879 | { | ||
| 8880 | ✗ | if(hoverclk > 0 && !(hoverflags&HOV_INF)) | |
| 8881 | { | ||
| 8882 | ✗ | --hoverclk; | |
| 8883 | ✗ | } | |
| 8884 | |||
| 8885 | ✗ | if(!hoverclk) | |
| 8886 | { | ||
| 8887 | ✗ | if (fall <= termv && !(moveflags & move_no_real_z) && z > 0) fall += gravity3; | |
| 8888 | ✗ | if (fakefall <= termv && !(moveflags & move_no_fake_z) && fakez > 0) fakefall += gravity3; | |
| 8889 | ✗ | hoverflags |= HOV_OUT | HOV_PITFALL_OUT; | |
| 8890 | ✗ | } | |
| 8891 | ✗ | } | |
| 8892 |
9/16✓ Branch 0 taken 10338 times.
✓ Branch 1 taken 7259 times.
✓ Branch 2 taken 3112 times.
✓ Branch 3 taken 7226 times.
✓ Branch 4 taken 3112 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 14485 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 14485 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 14485 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 17597 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
17597 | else if(((fall+(int32_t)(zinit.gravity / 100) > 0 && fall<=0 && !(moveflags & move_no_real_z) && z > 0) || (fakefall+gravity3 > 0 && fakefall<=0 && !(moveflags & move_no_fake_z) && fakez > 0)) && can_use_item(itype_hoverboots,i_hoverboots) && !(hoverflags & HOV_OUT)) |
| 8893 | { | ||
| 8894 | ✗ | if(hoverclk < 0) | |
| 8895 | ✗ | hoverclk = -hoverclk; | |
| 8896 | else | ||
| 8897 | { | ||
| 8898 | ✗ | fall = 0; | |
| 8899 | ✗ | fakefall = 0; | |
| 8900 | ✗ | int32_t itemid = current_item_id(itype_hoverboots); | |
| 8901 | ✗ | if(itemsbuf[itemid].misc1) | |
| 8902 | ✗ | hoverclk = itemsbuf[itemid].misc1; | |
| 8903 | else | ||
| 8904 | { | ||
| 8905 | ✗ | hoverclk = 1; | |
| 8906 | ✗ | hoverflags |= HOV_INF; | |
| 8907 | } | ||
| 8908 | ✗ | sfx(itemsbuf[current_item_id(itype_hoverboots)].usesound,pan(x.getInt())); | |
| 8909 | } | ||
| 8910 | ✗ | decorations.add(new dHover(x, y, dHOVER, 0)); | |
| 8911 | ✗ | } | |
| 8912 | else | ||
| 8913 | { | ||
| 8914 |
3/6✓ Branch 0 taken 17597 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17597 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 17597 times.
|
17597 | if (fall <= termv && !(moveflags & move_no_real_z) && z > 0) fall += gravity3; |
| 8915 |
3/6✓ Branch 0 taken 17597 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17597 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 17597 times.
✗ Branch 5 not taken.
|
17597 | if (fakefall <= termv && !(moveflags & move_no_fake_z) && fakez > 0) fakefall += gravity3; |
| 8916 | } | ||
| 8917 | 17597 | } | |
| 8918 |
1/2✓ Branch 0 taken 13899447 times.
✗ Branch 1 not taken.
|
13899447 | if (fakez<0) fakez = 0; |
| 8919 |
1/2✓ Branch 0 taken 13899447 times.
✗ Branch 1 not taken.
|
13899447 | if (z<0) z = 0; |
| 8920 | } | ||
| 8921 | |||
| 8922 |
2/2✓ Branch 0 taken 14152681 times.
✓ Branch 1 taken 748 times.
|
14153429 | if(drunkclk) |
| 8923 | { | ||
| 8924 | 748 | --drunkclk; | |
| 8925 | 748 | } | |
| 8926 | |||
| 8927 |
2/2✓ Branch 0 taken 14153102 times.
✓ Branch 1 taken 327 times.
|
14153429 | if(lstunclock > 0) |
| 8928 | { | ||
| 8929 | // also cancel Hero's attack | ||
| 8930 | 327 | attackclk = 0; | |
| 8931 | |||
| 8932 |
2/2✓ Branch 0 taken 84 times.
✓ Branch 1 taken 243 times.
|
327 | if( FFCore.getHeroAction() != stunned ) |
| 8933 | { | ||
| 8934 | 243 | tempaction=action; //update so future checks won't do this | |
| 8935 | //action=freeze; //setting this makes the player invincible while stunned -V | ||
| 8936 | 243 | FFCore.setHeroAction(stunned); | |
| 8937 | 243 | } | |
| 8938 | 327 | --lstunclock; | |
| 8939 | 327 | } | |
| 8940 | //if the stun action is still set in FFCore, but he isn't stunned, then the timer reached 0 | ||
| 8941 | //, so we unfreeze him here, and return him to the action that he had when he was stunned. | ||
| 8942 |
4/4✓ Branch 0 taken 327 times.
✓ Branch 1 taken 14153102 times.
✓ Branch 2 taken 311 times.
✓ Branch 3 taken 16 times.
|
14153429 | if ( FFCore.getHeroAction() == stunned && !lstunclock ) |
| 8943 | { | ||
| 8944 | 16 | action=tempaction; FFCore.setHeroAction(tempaction); | |
| 8945 | 16 | } | |
| 8946 | |||
| 8947 |
1/2✓ Branch 0 taken 14153429 times.
✗ Branch 1 not taken.
|
14153429 | if( lbunnyclock > 0 ) |
| 8948 | { | ||
| 8949 | ✗ | --lbunnyclock; | |
| 8950 | ✗ | } | |
| 8951 |
2/2✓ Branch 0 taken 1925 times.
✓ Branch 1 taken 14151504 times.
|
14153429 | if(DMaps[currdmap].flags&dmfBUNNYIFNOPEARL) |
| 8952 | { | ||
| 8953 | 1925 | int32_t itemid = current_item_id(itype_pearl); | |
| 8954 |
2/2✓ Branch 0 taken 123 times.
✓ Branch 1 taken 1802 times.
|
1925 | if(itemid > -1) |
| 8955 | { | ||
| 8956 |
2/2✓ Branch 0 taken 122 times.
✓ Branch 1 taken 1 times.
|
123 | if(lbunnyclock == -1) //cure dmap-caused bunny effect |
| 8957 | 1 | lbunnyclock = 0; | |
| 8958 | 123 | } | |
| 8959 |
2/2✓ Branch 0 taken 1801 times.
✓ Branch 1 taken 1 times.
|
1802 | else if(lbunnyclock > -1) //No pearl, force into bunny mode |
| 8960 | { | ||
| 8961 | 1 | lbunnyclock = -1; | |
| 8962 | 1 | } | |
| 8963 | 1925 | } | |
| 8964 |
1/2✓ Branch 0 taken 14151504 times.
✗ Branch 1 not taken.
|
14151504 | else if(lbunnyclock == -1) //dmap-caused bunny effect |
| 8965 | { | ||
| 8966 | ✗ | lbunnyclock = 0; | |
| 8967 | ✗ | } | |
| 8968 | |||
| 8969 |
7/20✗ Branch 0 not taken.
✓ Branch 1 taken 14153429 times.
✓ Branch 2 taken 14153429 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 14153429 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 14153429 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 14153429 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 14153429 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 14153429 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
|
28306858 | bool is_broken_behavior = replay_is_active() && replay_get_meta_str("sav") == "link_to_the_zelda_2_of_3.sav"; |
| 8970 |
5/6✓ Branch 0 taken 141619 times.
✓ Branch 1 taken 14011810 times.
✓ Branch 2 taken 17349 times.
✓ Branch 3 taken 124270 times.
✓ Branch 4 taken 14029159 times.
✗ Branch 5 not taken.
|
28182588 | bool fall_check = (fall == 0 || z > 0) && (fakefall == 0 || fakez > 0); |
| 8971 |
2/2✓ Branch 0 taken 13836636 times.
✓ Branch 1 taken 316793 times.
|
14153429 | if (is_broken_behavior) |
| 8972 |
5/6✓ Branch 0 taken 1196 times.
✓ Branch 1 taken 315597 times.
✓ Branch 2 taken 156 times.
✓ Branch 3 taken 1040 times.
✓ Branch 4 taken 1040 times.
✗ Branch 5 not taken.
|
316793 | fall_check = (fall == 0 || z > 0) || (fakefall == 0 || fakez > 0); |
| 8973 | |||
| 8974 |
12/14✓ Branch 0 taken 14098710 times.
✓ Branch 1 taken 54719 times.
✓ Branch 2 taken 9703358 times.
✓ Branch 3 taken 4395352 times.
✓ Branch 4 taken 9703358 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 9703358 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 9703348 times.
✓ Branch 9 taken 10 times.
✓ Branch 10 taken 9701539 times.
✓ Branch 11 taken 1809 times.
✓ Branch 12 taken 78688 times.
✓ Branch 13 taken 9622257 times.
|
14153429 | if(!is_on_conveyor && !(diagonalMovement||NO_GRIDLOCK) && fall_check && charging==0 && spins<=5 |
| 8975 |
2/2✓ Branch 0 taken 9700945 times.
✓ Branch 1 taken 594 times.
|
9701539 | && action != gothit) |
| 8976 | { | ||
| 8977 |
2/3✓ Branch 0 taken 4349346 times.
✓ Branch 1 taken 5272911 times.
✗ Branch 2 not taken.
|
9622257 | switch(dir) |
| 8978 | { | ||
| 8979 | case up: | ||
| 8980 | case down: | ||
| 8981 | 4349346 | x=(x.getInt()+4)&0xFFF8; | |
| 8982 | 4349346 | break; | |
| 8983 | |||
| 8984 | case left: | ||
| 8985 | case right: | ||
| 8986 | 5272911 | y=(y.getInt()+4)&0xFFF8; | |
| 8987 | 5272911 | break; | |
| 8988 | } | ||
| 8989 | 9622257 | } | |
| 8990 | |||
| 8991 |
4/4✓ Branch 0 taken 137817 times.
✓ Branch 1 taken 14015612 times.
✓ Branch 2 taken 52294 times.
✓ Branch 3 taken 85523 times.
|
14153429 | if((watch==true) && clockclk) |
| 8992 | { | ||
| 8993 | 52294 | --clockclk; | |
| 8994 | |||
| 8995 |
2/2✓ Branch 0 taken 52151 times.
✓ Branch 1 taken 143 times.
|
52294 | if(!clockclk) |
| 8996 | { | ||
| 8997 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 143 times.
|
143 | if(cheat_superman==false) |
| 8998 | { | ||
| 8999 | 143 | setClock(false); | |
| 9000 | 143 | } | |
| 9001 | |||
| 9002 | 143 | watch=false; | |
| 9003 | |||
| 9004 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 143 times.
|
73359 | for(int32_t i=0; i<eMAXGUYS; i++) |
| 9005 | { | ||
| 9006 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 73216 times.
|
73223 | for(int32_t zoras=0; zoras<clock_zoras[i]; zoras++) |
| 9007 | { | ||
| 9008 | 7 | addenemy(0,0,i,0); | |
| 9009 | 7 | } | |
| 9010 | 73216 | } | |
| 9011 | 143 | } | |
| 9012 | 52294 | } | |
| 9013 | |||
| 9014 |
4/4✓ Branch 0 taken 14106153 times.
✓ Branch 1 taken 47276 times.
✓ Branch 2 taken 8704 times.
✓ Branch 3 taken 14097449 times.
|
14153429 | if(hookshot_frozen || switch_hooked) |
| 9015 | { | ||
| 9016 |
4/4✓ Branch 0 taken 11136 times.
✓ Branch 1 taken 44844 times.
✓ Branch 2 taken 8704 times.
✓ Branch 3 taken 2432 times.
|
55980 | if(hookshot_used || switch_hooked) |
| 9017 | { | ||
| 9018 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 53548 times.
|
53548 | if (IsSideSwim()) {action=sideswimfreeze; FFCore.setHeroAction(sideswimfreeze);} |
| 9019 | 53548 | else {action=freeze; FFCore.setHeroAction(freeze);} //could be LA_HOOKSHOT for FFCore. -Z | |
| 9020 | |||
| 9021 |
3/4✓ Branch 0 taken 36199 times.
✓ Branch 1 taken 17349 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 36199 times.
|
53548 | if(pull_hero || switch_hooked) |
| 9022 | { | ||
| 9023 |
3/4✓ Branch 0 taken 8585 times.
✓ Branch 1 taken 8764 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 8585 times.
|
17349 | if(hs_switcher || switch_hooked) |
| 9024 | { | ||
| 9025 | 8764 | hs_fix = false; | |
| 9026 |
1/2✓ Branch 0 taken 8764 times.
✗ Branch 1 not taken.
|
8764 | if(switchhookclk) |
| 9027 | { | ||
| 9028 | 8764 | --switchhookclk; | |
| 9029 |
2/2✓ Branch 0 taken 137 times.
✓ Branch 1 taken 8627 times.
|
8764 | if(switchhookclk==switchhookmaxtime/2) //Perform swaps |
| 9030 | { | ||
| 9031 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 137 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
137 | if(switchhook_cost_item > -1 && !checkmagiccost(switchhook_cost_item)) |
| 9032 | ✗ | reset_hookshot(); | |
| 9033 | else | ||
| 9034 | { | ||
| 9035 | 137 | weapon *w = (weapon*)Lwpns.spr(Lwpns.idFirst(wHookshot)), | |
| 9036 | 137 | *hw = (weapon*)Lwpns.spr(Lwpns.idFirst(wHSHandle)); | |
| 9037 | |||
| 9038 |
2/2✓ Branch 0 taken 132 times.
✓ Branch 1 taken 5 times.
|
137 | if(hooked_combopos > -1) //Switching combos |
| 9039 | { | ||
| 9040 | 132 | uint16_t targpos = hooked_combopos, plpos = COMBOPOS(x+8,y+8); | |
| 9041 |
3/6✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 132 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 132 times.
|
132 | if(targpos < 176 && plpos < 176 && hooked_layerbits) |
| 9042 | { | ||
| 9043 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | int32_t max_layer = get_qr(qr_HOOKSHOTALLLAYER) ? 6 : (get_qr(qr_HOOKSHOTLAYERFIX) ? 2 : 0); |
| 9044 |
2/2✓ Branch 0 taken 924 times.
✓ Branch 1 taken 132 times.
|
1056 | for(int q = max_layer; q > -1; --q) |
| 9045 | { | ||
| 9046 |
2/2✓ Branch 0 taken 132 times.
✓ Branch 1 taken 792 times.
|
924 | if(!(hooked_layerbits & (1<<q))) |
| 9047 | 792 | continue; //non-switching layer | |
| 9048 | 132 | mapscr* scr = FFCore.tempScreens[q]; | |
| 9049 | 132 | newcombo const& cmb = combobuf[scr->data[targpos]]; | |
| 9050 | 132 | int32_t srcfl = scr->sflag[targpos]; | |
| 9051 | 132 | newcombo const& comb2 = combobuf[scr->data[plpos]]; | |
| 9052 | 132 | int32_t c = scr->data[plpos], cs = scr->cset[plpos], fl = scr->sflag[plpos]; | |
| 9053 | //{Check push status | ||
| 9054 | 132 | bool isFakePush = false; | |
| 9055 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
|
132 | if(cmb.type == cSWITCHHOOK) |
| 9056 | { | ||
| 9057 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | if(cmb.usrflags&cflag7) //counts as 'pushblock' |
| 9058 | ✗ | isFakePush = true; | |
| 9059 | 132 | } | |
| 9060 | 132 | bool isPush = isFakePush; | |
| 9061 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 132 times.
|
132 | if(!isPush) switch(srcfl) |
| 9062 | { | ||
| 9063 | case mfPUSHUD: case mfPUSHUDNS: case mfPUSHUDINS: | ||
| 9064 | case mfPUSHLR: case mfPUSHLRNS: case mfPUSHLRINS: | ||
| 9065 | case mfPUSHU: case mfPUSHUNS: case mfPUSHUINS: | ||
| 9066 | case mfPUSHD: case mfPUSHDNS: case mfPUSHDINS: | ||
| 9067 | case mfPUSHL: case mfPUSHLNS: case mfPUSHLINS: | ||
| 9068 | case mfPUSHR: case mfPUSHRNS: case mfPUSHRINS: | ||
| 9069 | case mfPUSH4: case mfPUSH4NS: case mfPUSH4INS: | ||
| 9070 | ✗ | isPush = true; | |
| 9071 | 132 | } | |
| 9072 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 132 times.
|
132 | if(!isPush) switch(cmb.flag) |
| 9073 | { | ||
| 9074 | case mfPUSHUD: case mfPUSHUDNS: case mfPUSHUDINS: | ||
| 9075 | case mfPUSHLR: case mfPUSHLRNS: case mfPUSHLRINS: | ||
| 9076 | case mfPUSHU: case mfPUSHUNS: case mfPUSHUINS: | ||
| 9077 | case mfPUSHD: case mfPUSHDNS: case mfPUSHDINS: | ||
| 9078 | case mfPUSHL: case mfPUSHLNS: case mfPUSHLINS: | ||
| 9079 | case mfPUSHR: case mfPUSHRNS: case mfPUSHRINS: | ||
| 9080 | case mfPUSH4: case mfPUSH4NS: case mfPUSH4INS: | ||
| 9081 | ✗ | isPush = true; | |
| 9082 | 132 | } | |
| 9083 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | if(srcfl==mfPUSHED) isPush = false; |
| 9084 | //} | ||
| 9085 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | if(cmb.type == cSWITCHHOOK) //custom flags and such |
| 9086 | { | ||
| 9087 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
|
132 | if(cmb.usrflags&cflag3) //Breaks on swap |
| 9088 | { | ||
| 9089 | ✗ | int32_t it = -1; | |
| 9090 | ✗ | int32_t thedropset = -1; | |
| 9091 | ✗ | if(cmb.usrflags&cflag4) //drop item | |
| 9092 | { | ||
| 9093 | ✗ | if(cmb.usrflags&cflag5) | |
| 9094 | ✗ | it = cmb.attribytes[2]; | |
| 9095 | else | ||
| 9096 | { | ||
| 9097 | ✗ | it = select_dropitem(cmb.attribytes[2]); | |
| 9098 | ✗ | thedropset = cmb.attribytes[2]; | |
| 9099 | } | ||
| 9100 | ✗ | } | |
| 9101 | |||
| 9102 | ✗ | breakable* br = new breakable(x, y, 0_zf, | |
| 9103 | ✗ | cmb, scr->cset[targpos], it, thedropset, cmb.attribytes[2], | |
| 9104 | ✗ | cmb.attribytes[1] ? -1 : 0, cmb.attribytes[1], switchhookclk); | |
| 9105 | ✗ | br->switch_hooked = true; | |
| 9106 | ✗ | decorations.add(br); | |
| 9107 | ✗ | hooked_layerbits &= ~(0x101<<q); //this swap completed entirely | |
| 9108 | ✗ | hooked_undercombos[q] = -1; | |
| 9109 | |||
| 9110 | ✗ | if(cmb.usrflags&cflag6) | |
| 9111 | { | ||
| 9112 | ✗ | scr->data[targpos]++; | |
| 9113 | ✗ | } | |
| 9114 | else | ||
| 9115 | { | ||
| 9116 | ✗ | scr->data[targpos] = scr->undercombo; | |
| 9117 | ✗ | scr->cset[targpos] = scr->undercset; | |
| 9118 | ✗ | if(cmb.usrflags&cflag2) | |
| 9119 | ✗ | scr->sflag[targpos] = 0; | |
| 9120 | } | ||
| 9121 | ✗ | } | |
| 9122 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
|
132 | else if(isPush) |
| 9123 | { | ||
| 9124 | //Simulate a block clicking into place | ||
| 9125 | ✗ | movingblock mtemp; | |
| 9126 | ✗ | mtemp.clear(); | |
| 9127 | ✗ | mtemp.set(COMBOX(plpos),COMBOY(plpos),scr->data[targpos],scr->cset[targpos],q,scr->sflag[targpos]); | |
| 9128 | ✗ | mtemp.dir = getPushDir(scr->sflag[targpos]); | |
| 9129 | ✗ | if(mtemp.dir < 0) | |
| 9130 | ✗ | mtemp.dir = getPushDir(cmb.flag); | |
| 9131 | ✗ | mtemp.clk = 1; | |
| 9132 | ✗ | mtemp.force_many = isFakePush; | |
| 9133 | ✗ | mtemp.no_icy = true; | |
| 9134 | ✗ | mtemp.animate(0); | |
| 9135 | ✗ | if((mtemp.bhole || mtemp.trigger) | |
| 9136 | ✗ | && (fl == mfBLOCKTRIGGER || fl == mfBLOCKHOLE | |
| 9137 | ✗ | || comb2.flag == mfBLOCKTRIGGER | |
| 9138 | ✗ | || comb2.flag == mfBLOCKHOLE)) | |
| 9139 | { | ||
| 9140 | ✗ | scr->data[targpos] = scr->undercombo; | |
| 9141 | ✗ | scr->cset[targpos] = scr->undercset; | |
| 9142 | ✗ | scr->sflag[targpos] = 0; | |
| 9143 | ✗ | } | |
| 9144 | else | ||
| 9145 | { | ||
| 9146 | ✗ | scr->data[targpos] = c; | |
| 9147 | ✗ | scr->cset[targpos] = cs; | |
| 9148 | ✗ | if(cmb.usrflags&cflag2) | |
| 9149 | ✗ | scr->sflag[targpos] = fl; | |
| 9150 | else | ||
| 9151 | ✗ | scr->sflag[targpos] = 0; | |
| 9152 | } | ||
| 9153 | ✗ | } | |
| 9154 | else | ||
| 9155 | { | ||
| 9156 | 132 | scr->data[plpos] = scr->data[targpos]; | |
| 9157 | 132 | scr->cset[plpos] = scr->cset[targpos]; | |
| 9158 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | if(cmb.usrflags&cflag2) |
| 9159 | ✗ | scr->sflag[plpos] = scr->sflag[targpos]; | |
| 9160 | 132 | scr->data[targpos] = c; | |
| 9161 | 132 | scr->cset[targpos] = cs; | |
| 9162 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | if(cmb.usrflags&cflag2) |
| 9163 | ✗ | scr->sflag[targpos] = fl; | |
| 9164 | } | ||
| 9165 | 132 | } | |
| 9166 | ✗ | else if(isCuttableType(cmb.type)) //Break and drop effects | |
| 9167 | { | ||
| 9168 | ✗ | int32_t breakcs = scr->cset[targpos]; | |
| 9169 | ✗ | if(isCuttableNextType(cmb.type)) //next instead of undercmb | |
| 9170 | { | ||
| 9171 | ✗ | scr->data[targpos]++; | |
| 9172 | ✗ | } | |
| 9173 | else | ||
| 9174 | { | ||
| 9175 | ✗ | scr->data[targpos] = scr->undercombo; | |
| 9176 | ✗ | scr->cset[targpos] = scr->undercset; | |
| 9177 | ✗ | scr->sflag[targpos] = 0; | |
| 9178 | } | ||
| 9179 | |||
| 9180 | ✗ | int32_t it = -1; | |
| 9181 | ✗ | int32_t thedropset = -1; | |
| 9182 | ✗ | if(isCuttableItemType(cmb.type)) //Drop an item | |
| 9183 | { | ||
| 9184 | ✗ | if ( (cmb.usrflags&cflag2) ) | |
| 9185 | { | ||
| 9186 | ✗ | if(cmb.usrflags&cflag11) | |
| 9187 | ✗ | it = cmb.attribytes[1]; | |
| 9188 | else | ||
| 9189 | { | ||
| 9190 | ✗ | it = select_dropitem(cmb.attribytes[1]); | |
| 9191 | ✗ | thedropset = cmb.attribytes[1]; | |
| 9192 | } | ||
| 9193 | ✗ | } | |
| 9194 | else | ||
| 9195 | { | ||
| 9196 | ✗ | it = select_dropitem(12); | |
| 9197 | ✗ | thedropset = 12; | |
| 9198 | } | ||
| 9199 | ✗ | } | |
| 9200 | |||
| 9201 | ✗ | byte breaksfx = 0; | |
| 9202 | ✗ | if(get_qr(qr_MORESOUNDS)) //SFX | |
| 9203 | { | ||
| 9204 | ✗ | if (cmb.usrflags&cflag3) | |
| 9205 | { | ||
| 9206 | ✗ | breaksfx = cmb.attribytes[2]; | |
| 9207 | ✗ | } | |
| 9208 | ✗ | else if(isBushType(cmb.type) | |
| 9209 | ✗ | || isFlowersType(cmb.type) | |
| 9210 | ✗ | || isGrassType(cmb.type)) | |
| 9211 | { | ||
| 9212 | ✗ | breaksfx = QMisc.miscsfx[sfxBUSHGRASS]; | |
| 9213 | ✗ | } | |
| 9214 | ✗ | } | |
| 9215 | |||
| 9216 | //Clipping sprite | ||
| 9217 | ✗ | int16_t decotype = (cmb.usrflags & cflag1) ? | |
| 9218 | ✗ | ((cmb.usrflags & cflag10) | |
| 9219 | ✗ | ? (cmb.attribytes[0]) | |
| 9220 | : (-1)) | ||
| 9221 | : (0); | ||
| 9222 | ✗ | if(decotype > 3) decotype = 0; | |
| 9223 | ✗ | if(!decotype) | |
| 9224 | ✗ | decotype = (isBushType(cmb.type) ? 1 | |
| 9225 | ✗ | : (isFlowersType(cmb.type) ? 2 | |
| 9226 | ✗ | : (isGrassType(cmb.type) ? 3 | |
| 9227 | ✗ | : ((cmb.usrflags & cflag1) ? -1 | |
| 9228 | : -2)))); | ||
| 9229 | |||
| 9230 | ✗ | breakable* br = new breakable(x, y, 0_zf, | |
| 9231 | ✗ | cmb, breakcs, it, thedropset, breaksfx, | |
| 9232 | ✗ | decotype, cmb.attribytes[0], switchhookclk); | |
| 9233 | ✗ | br->switch_hooked = true; | |
| 9234 | ✗ | decorations.add(br); | |
| 9235 | ✗ | hooked_layerbits &= ~(0x101<<q); //this swap completed entirely | |
| 9236 | ✗ | hooked_undercombos[q] = -1; | |
| 9237 | ✗ | } | |
| 9238 | else //Unknown type, just swap combos. | ||
| 9239 | { | ||
| 9240 | ✗ | if(isPush) | |
| 9241 | { | ||
| 9242 | //Simulate a block clicking into place | ||
| 9243 | ✗ | movingblock mtemp; | |
| 9244 | ✗ | mtemp.clear(); | |
| 9245 | ✗ | mtemp.set(COMBOX(plpos),COMBOY(plpos),scr->data[targpos],scr->cset[targpos],q,scr->sflag[targpos]); | |
| 9246 | ✗ | mtemp.dir = getPushDir(scr->sflag[targpos]); | |
| 9247 | ✗ | if(mtemp.dir < 0) | |
| 9248 | ✗ | mtemp.dir = getPushDir(cmb.flag); | |
| 9249 | ✗ | mtemp.clk = 1; | |
| 9250 | ✗ | mtemp.animate(0); | |
| 9251 | ✗ | if(mtemp.bhole || mtemp.trigger) | |
| 9252 | { | ||
| 9253 | ✗ | scr->data[targpos] = scr->undercombo; | |
| 9254 | ✗ | scr->cset[targpos] = scr->undercset; | |
| 9255 | ✗ | scr->sflag[targpos] = 0; | |
| 9256 | ✗ | } | |
| 9257 | else | ||
| 9258 | { | ||
| 9259 | ✗ | scr->data[targpos] = c; | |
| 9260 | ✗ | scr->cset[targpos] = cs; | |
| 9261 | ✗ | scr->sflag[targpos] = 0; | |
| 9262 | } | ||
| 9263 | ✗ | } | |
| 9264 | else | ||
| 9265 | { | ||
| 9266 | ✗ | scr->data[plpos] = scr->data[targpos]; | |
| 9267 | ✗ | scr->cset[plpos] = scr->cset[targpos]; | |
| 9268 | ✗ | scr->data[targpos] = c; | |
| 9269 | ✗ | scr->cset[targpos] = cs; | |
| 9270 | } | ||
| 9271 | } | ||
| 9272 | 132 | } | |
| 9273 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | if(switchhook_cost_item > -1) |
| 9274 | ✗ | paymagiccost(switchhook_cost_item); | |
| 9275 | 132 | zfix tx = x, ty = y; | |
| 9276 | //Position the player at the combo | ||
| 9277 | 132 | x = COMBOX(targpos); | |
| 9278 | 132 | y = COMBOY(targpos); | |
| 9279 | 132 | dir = oppositeDir[dir]; | |
| 9280 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
132 | if(w && hw) |
| 9281 | { | ||
| 9282 | //Calculate chain shift | ||
| 9283 | ✗ | zfix dx = (x-tx); | |
| 9284 | ✗ | zfix dy = (y-ty); | |
| 9285 | ✗ | if(w->dir < 4) | |
| 9286 | { | ||
| 9287 | ✗ | if(w->dir & 2) | |
| 9288 | ✗ | dx = 0; | |
| 9289 | ✗ | else dy = 0; | |
| 9290 | ✗ | } | |
| 9291 | //Position the hook head at the handle | ||
| 9292 | ✗ | w->x = hw->x + dx; | |
| 9293 | ✗ | w->y = hw->y + dy; | |
| 9294 | ✗ | w->dir = oppositeDir[w->dir]; | |
| 9295 | ✗ | w->doAutoRotate(true); | |
| 9296 | ✗ | byte hflip = (w->dir > 3 ? 3 : ((w->dir & 2) ? 1 : 2)); | |
| 9297 | ✗ | w->flip ^= hflip; | |
| 9298 | //Position the handle appropriately | ||
| 9299 | ✗ | hw->x = x-(hw->x-tx); | |
| 9300 | ✗ | hw->y = y-(hw->y-ty); | |
| 9301 | ✗ | hw->dir = oppositeDir[hw->dir]; | |
| 9302 | ✗ | hw->doAutoRotate(true); | |
| 9303 | ✗ | hw->flip ^= hflip; | |
| 9304 | //Move chains | ||
| 9305 | ✗ | for(int32_t j=0; j<chainlinks.Count(); j++) | |
| 9306 | { | ||
| 9307 | ✗ | chainlinks.spr(j)->x += dx; | |
| 9308 | ✗ | chainlinks.spr(j)->y += dy; | |
| 9309 | ✗ | } | |
| 9310 | ✗ | } | |
| 9311 | 132 | hooked_combopos = plpos; //flip positions | |
| 9312 | 132 | } | |
| 9313 | ✗ | else reset_hookshot(); | |
| 9314 | 132 | } | |
| 9315 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
5 | else if(switching_object) //Switching an object |
| 9316 | { | ||
| 9317 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
5 | if(switchhook_cost_item > -1) |
| 9318 | ✗ | paymagiccost(switchhook_cost_item); | |
| 9319 | 5 | zfix tx = x, ty = y; | |
| 9320 | //Position the player at the object | ||
| 9321 | 5 | x = switching_object->x; | |
| 9322 | 5 | y = switching_object->y; | |
| 9323 | 5 | dir = oppositeDir[dir]; | |
| 9324 | //Position the object at the player | ||
| 9325 | 5 | switching_object->x = tx; | |
| 9326 | 5 | switching_object->y = ty; | |
| 9327 |
3/4✓ Branch 0 taken 3 times.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
|
5 | if(switching_object->dir == dir || switching_object->dir == oppositeDir[dir]) |
| 9328 | 2 | switching_object->dir = oppositeDir[switching_object->dir]; | |
| 9329 | 5 | solid_update(false); | |
| 9330 | 5 | switching_object->solid_update(false); | |
| 9331 |
2/4✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
|
5 | if(item* it = dynamic_cast<item*>(switching_object)) |
| 9332 | { | ||
| 9333 | ✗ | if(itemsbuf[it->id].family == itype_fairy && itemsbuf[it->id].misc3) | |
| 9334 | { | ||
| 9335 | ✗ | movefairynew2(it->x, it->y, *it); | |
| 9336 | ✗ | } | |
| 9337 | ✗ | } | |
| 9338 |
3/4✓ Branch 0 taken 1 times.
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
|
5 | if(w && hw) //!TODO No fucking clue if diagonals work |
| 9339 | { | ||
| 9340 | //Calculate chain shift | ||
| 9341 | 1 | zfix dx = (x-tx); | |
| 9342 | 1 | zfix dy = (y-ty); | |
| 9343 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if(w->dir < 4) |
| 9344 | { | ||
| 9345 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if(w->dir & 2) |
| 9346 | 1 | dx = 0; | |
| 9347 | ✗ | else dy = 0; | |
| 9348 | 1 | } | |
| 9349 | //Position the hook head at the handle | ||
| 9350 | 1 | w->x = hw->x + dx; | |
| 9351 | 1 | w->y = hw->y + dy; | |
| 9352 | 1 | w->dir = oppositeDir[w->dir]; | |
| 9353 | 1 | w->doAutoRotate(true); | |
| 9354 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | byte hflip = (w->dir > 3 ? 3 : ((w->dir & 2) ? 1 : 2)); |
| 9355 | 1 | w->flip ^= hflip; | |
| 9356 | 1 | w->solid_update(false); | |
| 9357 | //Position the handle appropriately | ||
| 9358 | 1 | hw->x = x-(hw->x-tx); | |
| 9359 | 1 | hw->y = y-(hw->y-ty); | |
| 9360 | 1 | hw->dir = oppositeDir[hw->dir]; | |
| 9361 | 1 | hw->doAutoRotate(true); | |
| 9362 | 1 | hw->flip ^= hflip; | |
| 9363 | 1 | hw->solid_update(false); | |
| 9364 | //Move chains | ||
| 9365 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1 times.
|
6 | for(int32_t j=0; j<chainlinks.Count(); j++) |
| 9366 | { | ||
| 9367 | 5 | chainlinks.spr(j)->x += dx; | |
| 9368 | 5 | chainlinks.spr(j)->y += dy; | |
| 9369 | 5 | } | |
| 9370 | 1 | } | |
| 9371 | 5 | } | |
| 9372 | } | ||
| 9373 | 137 | } | |
| 9374 |
2/2✓ Branch 0 taken 8490 times.
✓ Branch 1 taken 137 times.
|
8627 | else if(!switchhookclk) |
| 9375 | { | ||
| 9376 | 137 | reset_hookshot(); | |
| 9377 | 137 | } | |
| 9378 | 8764 | } | |
| 9379 | ✗ | else reset_hookshot(); | |
| 9380 | 8764 | } | |
| 9381 | else | ||
| 9382 | { | ||
| 9383 | sprite *t; | ||
| 9384 | int32_t i; | ||
| 9385 | |||
| 9386 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 8761 times.
✓ Branch 2 taken 176 times.
✓ Branch 3 taken 8585 times.
|
8761 | for(i=0; i<Lwpns.Count() && (Lwpns.spr(i)->id!=wHSHandle); i++) |
| 9387 | { | ||
| 9388 | /* do nothing */ | ||
| 9389 | 176 | } | |
| 9390 | |||
| 9391 | 8585 | t = Lwpns.spr(i); | |
| 9392 | |||
| 9393 |
2/2✓ Branch 0 taken 17399 times.
✓ Branch 1 taken 8585 times.
|
25984 | for(i=0; i<Lwpns.Count(); i++) |
| 9394 | { | ||
| 9395 | 17399 | sprite *s = Lwpns.spr(i); | |
| 9396 | |||
| 9397 |
2/2✓ Branch 0 taken 8814 times.
✓ Branch 1 taken 8585 times.
|
17399 | if(s->id==wHookshot) |
| 9398 | { | ||
| 9399 |
2/2✓ Branch 0 taken 2098 times.
✓ Branch 1 taken 6487 times.
|
8585 | if (abs((s->y) - y) >= 1) |
| 9400 | { | ||
| 9401 |
2/2✓ Branch 0 taken 1219 times.
✓ Branch 1 taken 879 times.
|
2098 | if((s->y)>y) |
| 9402 | { | ||
| 9403 | 879 | y+=4; | |
| 9404 | |||
| 9405 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 879 times.
|
879 | if(Lwpns.idFirst(wHSHandle)!=-1) |
| 9406 | { | ||
| 9407 | 879 | t->y+=4; | |
| 9408 | 879 | } | |
| 9409 | |||
| 9410 | 879 | hs_starty+=4; | |
| 9411 | 879 | } | |
| 9412 | |||
| 9413 |
2/2✓ Branch 0 taken 879 times.
✓ Branch 1 taken 1219 times.
|
2098 | if((s->y)<y) |
| 9414 | { | ||
| 9415 | 1219 | y-=4; | |
| 9416 | |||
| 9417 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1219 times.
|
1219 | if(Lwpns.idFirst(wHSHandle)!=-1) |
| 9418 | { | ||
| 9419 | 1219 | t->y-=4; | |
| 9420 | 1219 | } | |
| 9421 | |||
| 9422 | 1219 | hs_starty-=4; | |
| 9423 | 1219 | } | |
| 9424 | 2098 | } | |
| 9425 | else | ||
| 9426 | { | ||
| 9427 | 6487 | y = (s->y); | |
| 9428 | } | ||
| 9429 |
2/2✓ Branch 0 taken 6487 times.
✓ Branch 1 taken 2098 times.
|
8585 | if (abs((s->x) - x) >= 1) |
| 9430 | { | ||
| 9431 |
2/2✓ Branch 0 taken 3152 times.
✓ Branch 1 taken 3335 times.
|
6487 | if((s->x)>x) |
| 9432 | { | ||
| 9433 | 3335 | x+=4; | |
| 9434 | |||
| 9435 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3335 times.
|
3335 | if(Lwpns.idFirst(wHSHandle)!=-1) |
| 9436 | { | ||
| 9437 | 3335 | t->x+=4; | |
| 9438 | 3335 | } | |
| 9439 | |||
| 9440 | 3335 | hs_startx+=4; | |
| 9441 | 3335 | } | |
| 9442 | |||
| 9443 |
2/2✓ Branch 0 taken 3335 times.
✓ Branch 1 taken 3152 times.
|
6487 | if((s->x)<x) |
| 9444 | { | ||
| 9445 | 3152 | x-=4; | |
| 9446 | |||
| 9447 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3152 times.
|
3152 | if(Lwpns.idFirst(wHSHandle)!=-1) |
| 9448 | { | ||
| 9449 | 3152 | t->x-=4; | |
| 9450 | 3152 | } | |
| 9451 | |||
| 9452 | 3152 | hs_startx-=4; | |
| 9453 | 3152 | } | |
| 9454 | 6487 | } | |
| 9455 | else | ||
| 9456 | { | ||
| 9457 | 2098 | x = (s->x); | |
| 9458 | } | ||
| 9459 | 8585 | } | |
| 9460 | 17399 | } | |
| 9461 | } | ||
| 9462 | 17349 | } | |
| 9463 | 53548 | } | |
| 9464 | else | ||
| 9465 | { | ||
| 9466 | 2432 | Lwpns.del(Lwpns.idFirst(wHSHandle)); | |
| 9467 | 2432 | reset_hookshot(); | |
| 9468 | } | ||
| 9469 | |||
| 9470 |
1/2✓ Branch 0 taken 55980 times.
✗ Branch 1 not taken.
|
55980 | if(hs_fix) |
| 9471 | { | ||
| 9472 | ✗ | if(dir==up) | |
| 9473 | { | ||
| 9474 | ✗ | y=int32_t(y+7)&0xF0; | |
| 9475 | ✗ | } | |
| 9476 | |||
| 9477 | ✗ | if(dir==down) | |
| 9478 | { | ||
| 9479 | ✗ | y=int32_t(y+7)&0xF0; | |
| 9480 | ✗ | } | |
| 9481 | |||
| 9482 | ✗ | if(dir==left) | |
| 9483 | { | ||
| 9484 | ✗ | x=int32_t(x+7)&0xF0; | |
| 9485 | ✗ | } | |
| 9486 | |||
| 9487 | ✗ | if(dir==right) | |
| 9488 | { | ||
| 9489 | ✗ | x=int32_t(x+7)&0xF0; | |
| 9490 | ✗ | } | |
| 9491 | |||
| 9492 | ✗ | hs_fix=false; | |
| 9493 | ✗ | } | |
| 9494 | |||
| 9495 | 55980 | } | |
| 9496 | |||
| 9497 |
2/2✓ Branch 0 taken 1262482 times.
✓ Branch 1 taken 12890947 times.
|
14153429 | if(!get_qr(qr_NO_L_R_BUTTON_INVENTORY_SWAP)) |
| 9498 | { | ||
| 9499 |
2/2✓ Branch 0 taken 5305 times.
✓ Branch 1 taken 12885642 times.
|
12890947 | if(DrunkrLbtn()) |
| 9500 | 5305 | selectNextBWpn(SEL_LEFT); | |
| 9501 |
2/2✓ Branch 0 taken 12878167 times.
✓ Branch 1 taken 7475 times.
|
12885642 | else if(DrunkrRbtn()) |
| 9502 | 7475 | selectNextBWpn(SEL_RIGHT); | |
| 9503 | 12890947 | } | |
| 9504 |
4/4✓ Branch 0 taken 949920 times.
✓ Branch 1 taken 13203509 times.
✓ Branch 2 taken 939265 times.
✓ Branch 3 taken 10655 times.
|
14153429 | if (get_qr(qr_SELECTAWPN) && get_qr(qr_USE_EX1_EX2_INVENTORYSWAP)) |
| 9505 | { | ||
| 9506 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10655 times.
|
10655 | if (rEx3btn()) |
| 9507 | ✗ | selectNextAWpn(SEL_LEFT); | |
| 9508 |
2/2✓ Branch 0 taken 10654 times.
✓ Branch 1 taken 1 times.
|
10655 | else if (rEx4btn()) |
| 9509 | 1 | selectNextAWpn(SEL_RIGHT); | |
| 9510 | 10655 | } | |
| 9511 | |||
| 9512 |
2/2✓ Branch 0 taken 14152351 times.
✓ Branch 1 taken 1078 times.
|
14153429 | if(rPbtn()) |
| 9513 | { | ||
| 9514 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1075 times.
|
1078 | if( !FFCore.runOnMapScriptEngine() ) //OnMap script replaces the 'onViewMap()' call |
| 9515 | 1075 | onViewMap(); | |
| 9516 | 1078 | } | |
| 9517 |
2/2✓ Branch 0 taken 5024178 times.
✓ Branch 1 taken 14153429 times.
|
19177607 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 9518 | { | ||
| 9519 | 5024178 | weapon *w = ((weapon*)Lwpns.spr(i)); | |
| 9520 | |||
| 9521 |
6/6✓ Branch 0 taken 4973275 times.
✓ Branch 1 taken 50903 times.
✓ Branch 2 taken 4510700 times.
✓ Branch 3 taken 462575 times.
✓ Branch 4 taken 73 times.
✓ Branch 5 taken 4510627 times.
|
5024178 | if(w->id == wArrow || w->id == wBrang || w->id == wCByrna) |
| 9522 | 513551 | addsparkle(i); | |
| 9523 | 5024178 | } | |
| 9524 | |||
| 9525 |
2/2✓ Branch 0 taken 14152194 times.
✓ Branch 1 taken 1235 times.
|
14153429 | if(Lwpns.idCount(wPhantom)) |
| 9526 | { | ||
| 9527 | 1235 | addsparkle2(pDIVINEFIREROCKET,pDIVINEFIREROCKETTRAIL); | |
| 9528 | 1235 | addsparkle2(pDIVINEFIREROCKETRETURN,pDIVINEFIREROCKETTRAILRETURN); | |
| 9529 | 1235 | addsparkle2(pDIVINEPROTECTIONROCKET1,pDIVINEPROTECTIONROCKETTRAIL1); | |
| 9530 | 1235 | addsparkle2(pDIVINEPROTECTIONROCKET2,pDIVINEPROTECTIONROCKETTRAIL2); | |
| 9531 | 1235 | addsparkle2(pDIVINEPROTECTIONROCKETRETURN1,pDIVINEPROTECTIONROCKETTRAILRETURN1); | |
| 9532 | 1235 | addsparkle2(pDIVINEPROTECTIONROCKETRETURN2,pDIVINEPROTECTIONROCKETTRAILRETURN2); | |
| 9533 | 1235 | } | |
| 9534 | |||
| 9535 | // Pay magic cost for Byrna beams | ||
| 9536 | |||
| 9537 | //Byrna needs a secondary timer, for 254+, as do all items that reduce MP on a per-frae basis. Essentially, we will do % divisor == 0 for that. -Z | ||
| 9538 |
2/2✓ Branch 0 taken 14153356 times.
✓ Branch 1 taken 73 times.
|
14153429 | if(Lwpns.idCount(wCByrna)) |
| 9539 | { | ||
| 9540 | 73 | weapon *ew = (weapon*)(Lwpns.spr(Lwpns.idFirst(wCByrna))); | |
| 9541 | 73 | int32_t itemid = ew->parentitem; | |
| 9542 | |||
| 9543 |
2/4✓ Branch 0 taken 73 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 73 times.
|
73 | if(!(checkbunny(itemid) && checkmagiccost(itemid))) |
| 9544 | { | ||
| 9545 | ✗ | for(int32_t i=0; i<Lwpns.Count(); i++) | |
| 9546 | { | ||
| 9547 | ✗ | weapon *w = ((weapon*)Lwpns.spr(i)); | |
| 9548 | |||
| 9549 | ✗ | if(w->id==wCByrna) | |
| 9550 | { | ||
| 9551 | ✗ | w->dead=1; | |
| 9552 | ✗ | } | |
| 9553 | |||
| 9554 | ✗ | } | |
| 9555 | //kill the sound effect for the orbits -Z 14FEB2019 | ||
| 9556 | ✗ | stop_sfx(itemsbuf[itemid].usesound); | |
| 9557 | ✗ | } | |
| 9558 | 73 | else paymagiccost(itemid); | |
| 9559 | 73 | } | |
| 9560 | |||
| 9561 |
3/4✓ Branch 0 taken 14135750 times.
✓ Branch 1 taken 17679 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 14135750 times.
|
14153429 | if(z==0&&fakez==0) |
| 9562 | { | ||
| 9563 | 14135750 | switchblock_z = 0; | |
| 9564 |
1/2✓ Branch 0 taken 14135750 times.
✗ Branch 1 not taken.
|
14135750 | if(switchblock_offset) |
| 9565 | { | ||
| 9566 | ✗ | switchblock_offset=false; | |
| 9567 | ✗ | yofs += 8; | |
| 9568 | ✗ | } | |
| 9569 | 14135750 | } | |
| 9570 |
2/2✓ Branch 0 taken 253982 times.
✓ Branch 1 taken 13899447 times.
|
14153429 | if(!isSideViewHero()) |
| 9571 | { | ||
| 9572 | 13899447 | int32_t tx = x.getInt()+8, | |
| 9573 | 13899447 | ty = y.getInt()+8;//(bigHitbox?8:12); | |
| 9574 |
4/4✓ Branch 0 taken 13899011 times.
✓ Branch 1 taken 436 times.
✓ Branch 2 taken 368 times.
✓ Branch 3 taken 13898643 times.
|
13899447 | if(!(unsigned(ty)>175 || unsigned(tx) > 255)) |
| 9575 | { | ||
| 9576 |
2/2✓ Branch 0 taken 13898643 times.
✓ Branch 1 taken 41695929 times.
|
55594572 | for(int32_t q = 0; q < 3; ++q) |
| 9577 | { | ||
| 9578 |
4/4✓ Branch 0 taken 27797286 times.
✓ Branch 1 taken 13898643 times.
✓ Branch 2 taken 7744794 times.
✓ Branch 3 taken 20052492 times.
|
41695929 | if(q && !tmpscr2[q-1].valid) continue; |
| 9579 | 21643437 | newcombo const& cmb = combobuf[FFCore.tempScreens[q]->data[COMBOPOS(tx,ty)]]; | |
| 9580 |
3/4✓ Branch 0 taken 4519 times.
✓ Branch 1 taken 21638918 times.
✓ Branch 2 taken 4519 times.
✗ Branch 3 not taken.
|
21643437 | if(cmb.type != cCSWITCHBLOCK || !(cmb.usrflags&cflag9)) continue; |
| 9581 | ✗ | int32_t b = 1; | |
| 9582 | ✗ | if(tx&8) b <<= 2; | |
| 9583 | ✗ | if(ty&8) b <<= 1; | |
| 9584 | ✗ | b |= (b<<4); //check equivalent effect flag too | |
| 9585 | ✗ | if((cmb.walk&b)==b) //solid and effecting | |
| 9586 | { | ||
| 9587 | ✗ | if(z==0&&fakez==0) | |
| 9588 | { | ||
| 9589 | ✗ | if(cmb.usrflags&cflag10) | |
| 9590 | { | ||
| 9591 | ✗ | if(!switchblock_offset) | |
| 9592 | { | ||
| 9593 | ✗ | switchblock_offset=true; | |
| 9594 | ✗ | yofs -= 8; | |
| 9595 | ✗ | } | |
| 9596 | ✗ | } | |
| 9597 | else | ||
| 9598 | { | ||
| 9599 | ✗ | if(switchblock_offset) | |
| 9600 | { | ||
| 9601 | ✗ | switchblock_offset=false; | |
| 9602 | ✗ | yofs += 8; | |
| 9603 | ✗ | } | |
| 9604 | } | ||
| 9605 | ✗ | } | |
| 9606 | ✗ | if(cmb.attributes[2]>0 && switchblock_z>=0) | |
| 9607 | { | ||
| 9608 | ✗ | if(z==0&&fakez==0) | |
| 9609 | ✗ | switchblock_z = zc_max(switchblock_z,zslongToFix(cmb.attributes[2])); | |
| 9610 | ✗ | else if(SWITCHBLOCK_STATE < zslongToFix(cmb.attributes[2])) | |
| 9611 | { | ||
| 9612 | ✗ | switchblock_z += zslongToFix(cmb.attributes[2])-SWITCHBLOCK_STATE; | |
| 9613 | ✗ | } | |
| 9614 | ✗ | } | |
| 9615 | ✗ | else switchblock_z = -1; | |
| 9616 | ✗ | break; | |
| 9617 | } | ||
| 9618 | ✗ | } | |
| 9619 | 13898643 | } | |
| 9620 | 13899447 | } | |
| 9621 | 14153429 | ClearhitHeroUIDs(); //clear them before we advance. | |
| 9622 | 14153429 | checkhit(); | |
| 9623 | |||
| 9624 | 14153429 | bool forcedeath = dying_flags&DYING_FORCED; | |
| 9625 | 14153429 | bool norev = (dying_flags&DYING_NOREV); | |
| 9626 |
4/6✓ Branch 0 taken 14153429 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 560 times.
✓ Branch 3 taken 14152869 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 560 times.
|
14153429 | if(forcedeath || (game->get_life()<=0 && !immortal)) |
| 9627 | { | ||
| 9628 |
1/2✓ Branch 0 taken 560 times.
✗ Branch 1 not taken.
|
560 | if(forcedeath) |
| 9629 | ✗ | game->set_life(0); | |
| 9630 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 560 times.
|
560 | if(!norev) |
| 9631 |
2/2✓ Branch 0 taken 560 times.
✓ Branch 1 taken 143360 times.
|
143920 | for(size_t slot = 0; slot < 256; ++slot) |
| 9632 | { | ||
| 9633 |
2/2✓ Branch 0 taken 143352 times.
✓ Branch 1 taken 8 times.
|
143360 | if(size_t bind = game->get_bottle_slot(slot)) |
| 9634 | { | ||
| 9635 | 8 | bottletype const* bt = &QMisc.bottle_types[bind-1]; | |
| 9636 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | if(!(bt->flags&BTFLAG_AUTOONDEATH)) |
| 9637 | 8 | continue; | |
| 9638 | ✗ | word toFill[3] = { 0 }; | |
| 9639 | ✗ | for(size_t q = 0; q < 3; ++q) | |
| 9640 | { | ||
| 9641 | ✗ | char c = bt->counter[q]; | |
| 9642 | ✗ | if(c > -1) | |
| 9643 | { | ||
| 9644 | ✗ | if(bt->flags & (1<<q)) | |
| 9645 | { | ||
| 9646 | ✗ | toFill[q] = (bt->amount[q]==100) | |
| 9647 | ✗ | ? game->get_maxcounter(c) | |
| 9648 | ✗ | : word((game->get_maxcounter(c)/100.0)*bt->amount[q]); | |
| 9649 | ✗ | } | |
| 9650 | ✗ | else toFill[q] = bt->amount[q]; | |
| 9651 | ✗ | if(toFill[q] + game->get_counter(c) > game->get_maxcounter(c)) | |
| 9652 | { | ||
| 9653 | ✗ | toFill[q] = game->get_maxcounter(c) - game->get_counter(c); | |
| 9654 | ✗ | } | |
| 9655 | ✗ | } | |
| 9656 | ✗ | } | |
| 9657 | ✗ | if(bt->flags & BTFLAG_CURESWJINX) | |
| 9658 | { | ||
| 9659 | ✗ | swordclk = 0; | |
| 9660 | ✗ | verifyAWpn(); | |
| 9661 | ✗ | } | |
| 9662 | ✗ | if(bt->flags & BTFLAG_CUREITJINX) | |
| 9663 | ✗ | itemclk = 0; | |
| 9664 | ✗ | if(bt->flags & BTFLAG_CURESHJINX) | |
| 9665 | ✗ | shieldjinxclk = 0; | |
| 9666 | ✗ | if(word max = std::max(toFill[0], std::max(toFill[1], toFill[2]))) | |
| 9667 | { | ||
| 9668 | ✗ | int32_t itemid = find_bottle_for_slot(slot,true); | |
| 9669 | ✗ | stop_sfx(QMisc.miscsfx[sfxLOWHEART]); //stop heart beep! | |
| 9670 | ✗ | if(itemid > -1) | |
| 9671 | ✗ | sfx(itemsbuf[itemid].usesound,pan(x.getInt())); | |
| 9672 | ✗ | for(size_t q = 0; q < 20; ++q) | |
| 9673 | ✗ | do_death_refill_waitframe(); | |
| 9674 | ✗ | double inc = max/60.0; //1 second | |
| 9675 | ✗ | double xtra[3]{ 0 }; | |
| 9676 | ✗ | for(size_t q = 0; q < 60; ++q) | |
| 9677 | { | ||
| 9678 | ✗ | if(!(q%6) && (toFill[0]||toFill[1]||toFill[2])) | |
| 9679 | ✗ | sfx(QMisc.miscsfx[sfxREFILL]); | |
| 9680 | ✗ | for(size_t j = 0; j < 3; ++j) | |
| 9681 | { | ||
| 9682 | ✗ | xtra[j] += inc; | |
| 9683 | ✗ | word f = floor(xtra[j]); | |
| 9684 | ✗ | xtra[j] -= f; | |
| 9685 | ✗ | if(toFill[j] > f) | |
| 9686 | { | ||
| 9687 | ✗ | toFill[j] -= f; | |
| 9688 | ✗ | game->change_counter(f,bt->counter[j]); | |
| 9689 | ✗ | } | |
| 9690 | ✗ | else if(toFill[j]) | |
| 9691 | { | ||
| 9692 | ✗ | game->change_counter(toFill[j],bt->counter[j]); | |
| 9693 | ✗ | toFill[j] = 0; | |
| 9694 | ✗ | } | |
| 9695 | ✗ | } | |
| 9696 | ✗ | do_death_refill_waitframe(); | |
| 9697 | ✗ | } | |
| 9698 | ✗ | for(size_t j = 0; j < 3; ++j) | |
| 9699 | { | ||
| 9700 | ✗ | if(toFill[j]) | |
| 9701 | { | ||
| 9702 | ✗ | game->change_counter(toFill[j],bt->counter[j]); | |
| 9703 | ✗ | toFill[j] = 0; | |
| 9704 | ✗ | } | |
| 9705 | ✗ | } | |
| 9706 | ✗ | for(size_t q = 0; q < 20; ++q) | |
| 9707 | ✗ | do_death_refill_waitframe(); | |
| 9708 | ✗ | } | |
| 9709 | ✗ | game->set_bottle_slot(slot,bt->next_type); | |
| 9710 | ✗ | if(game->get_life() > 0) | |
| 9711 | { | ||
| 9712 | ✗ | dying_flags = 0; | |
| 9713 | ✗ | forcedeath = false; | |
| 9714 | ✗ | break; //Revived! Stop drinking things... | |
| 9715 | } | ||
| 9716 | ✗ | } | |
| 9717 | 143912 | } | |
| 9718 | |||
| 9719 |
2/2✓ Branch 0 taken 60 times.
✓ Branch 1 taken 500 times.
|
560 | if ( FFCore.getQuestHeaderInfo(vZelda) >= 0x255 ) |
| 9720 | { | ||
| 9721 |
3/6✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 60 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 60 times.
|
60 | if(forcedeath || (game->get_life()<=0 && !immortal)) //Not saved by fairy |
| 9722 | { | ||
| 9723 | // So scripts can have one frame to handle hp zero events | ||
| 9724 |
3/4✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 25 times.
✓ Branch 3 taken 35 times.
|
60 | if(norev || false == (last_hurrah = !last_hurrah)) |
| 9725 | { | ||
| 9726 | 25 | dying_flags = 0; | |
| 9727 | 25 | drunkclk=0; | |
| 9728 | 25 | lstunclock = 0; | |
| 9729 | 25 | is_conveyor_stunned = 0; | |
| 9730 | 25 | FFCore.setHeroAction(dying); | |
| 9731 | 25 | FFCore.deallocateAllScriptOwned(ScriptType::Global, GLOBAL_SCRIPT_GAME); | |
| 9732 | 25 | FFCore.deallocateAllScriptOwned(ScriptType::Player, SCRIPT_PLAYER_ACTIVE); | |
| 9733 | 25 | ALLOFF(true,true); | |
| 9734 | 25 | GameFlags |= GAMEFLAG_NO_F6; | |
| 9735 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 25 times.
|
25 | if(!debug_enabled) |
| 9736 | { | ||
| 9737 | 25 | Paused=false; | |
| 9738 | 25 | } | |
| 9739 |
2/2✓ Branch 0 taken 15 times.
✓ Branch 1 taken 10 times.
|
25 | if(!get_qr(qr_ONDEATH_RUNS_AFTER_DEATH_ANIM)) |
| 9740 | { | ||
| 9741 | 10 | FFCore.runOnDeathEngine(); | |
| 9742 | 10 | FFCore.deallocateAllScriptOwned(ScriptType::Player, SCRIPT_PLAYER_DEATH); | |
| 9743 | 10 | } | |
| 9744 | 25 | Playing = false; | |
| 9745 | 25 | heroDeathAnimation(); | |
| 9746 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 15 times.
|
25 | if(get_qr(qr_ONDEATH_RUNS_AFTER_DEATH_ANIM)) |
| 9747 | { | ||
| 9748 | 15 | Playing = true; | |
| 9749 | 15 | FFCore.runOnDeathEngine(); | |
| 9750 | 15 | FFCore.deallocateAllScriptOwned(ScriptType::Player, SCRIPT_PLAYER_DEATH); | |
| 9751 | 15 | Playing = false; | |
| 9752 | 15 | } | |
| 9753 | 25 | GameFlags &= ~GAMEFLAG_NO_F6; | |
| 9754 | 25 | ALLOFF(true,true); | |
| 9755 | 25 | return true; | |
| 9756 | } | ||
| 9757 | 35 | } | |
| 9758 | 35 | } | |
| 9759 | else //2.50.x | ||
| 9760 | { | ||
| 9761 | // So scripts can have one frame to handle hp zero events | ||
| 9762 |
2/2✓ Branch 0 taken 249 times.
✓ Branch 1 taken 251 times.
|
500 | if(false == (last_hurrah = !last_hurrah)) |
| 9763 | { | ||
| 9764 | 249 | drunkclk=0; | |
| 9765 | 249 | heroDeathAnimation(); | |
| 9766 | |||
| 9767 | 249 | return true; | |
| 9768 | } | ||
| 9769 | } | ||
| 9770 | 286 | } | |
| 9771 | 14152869 | else last_hurrah=false; | |
| 9772 | |||
| 9773 |
2/2✓ Branch 0 taken 14104388 times.
✓ Branch 1 taken 48767 times.
|
14153155 | if(swordclk>0) |
| 9774 | { | ||
| 9775 | 48767 | --swordclk; | |
| 9776 |
2/2✓ Branch 0 taken 48430 times.
✓ Branch 1 taken 337 times.
|
48767 | if(!swordclk) verifyAWpn(); |
| 9777 | 48767 | } | |
| 9778 |
2/2✓ Branch 0 taken 14143997 times.
✓ Branch 1 taken 9158 times.
|
14153155 | if(itemclk>0) |
| 9779 | 9158 | --itemclk; | |
| 9780 |
1/2✓ Branch 0 taken 14153155 times.
✗ Branch 1 not taken.
|
14153155 | if(shieldjinxclk>0) |
| 9781 | ✗ | --shieldjinxclk; | |
| 9782 | |||
| 9783 |
2/2✓ Branch 0 taken 1338 times.
✓ Branch 1 taken 14151817 times.
|
14153155 | if(inwallm) |
| 9784 | { | ||
| 9785 | 1338 | attackclk=0; | |
| 9786 | 1338 | herostep(); | |
| 9787 | |||
| 9788 |
2/2✓ Branch 0 taken 1329 times.
✓ Branch 1 taken 9 times.
|
1338 | if(CarryHero()==false) |
| 9789 | 9 | restart_level(); | |
| 9790 | |||
| 9791 | 1338 | solid_update(false); | |
| 9792 | 1338 | return false; | |
| 9793 | } | ||
| 9794 | |||
| 9795 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 14151814 times.
|
14151817 | if(ewind_restart) |
| 9796 | { | ||
| 9797 | 3 | attackclk=0; | |
| 9798 | 3 | restart_level(); | |
| 9799 | 3 | xofs=0; | |
| 9800 | 3 | action=none; FFCore.setHeroAction(none); | |
| 9801 | 3 | ewind_restart=false; | |
| 9802 | 3 | solid_update(false); | |
| 9803 | 3 | return false; | |
| 9804 | } | ||
| 9805 | |||
| 9806 |
2/2✓ Branch 0 taken 14137733 times.
✓ Branch 1 taken 14081 times.
|
14151814 | if(hopclk) |
| 9807 | { | ||
| 9808 | 14081 | action=hopping; FFCore.setHeroAction(hopping); | |
| 9809 | 14081 | } | |
| 9810 |
2/2✓ Branch 0 taken 14148314 times.
✓ Branch 1 taken 3500 times.
|
14151814 | if(fallclk) |
| 9811 | { | ||
| 9812 | 3500 | action=falling; FFCore.setHeroAction(falling); | |
| 9813 | 3500 | } | |
| 9814 | |||
| 9815 |
5/6✓ Branch 0 taken 136379 times.
✓ Branch 1 taken 14015435 times.
✓ Branch 2 taken 1633 times.
✓ Branch 3 taken 134746 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1633 times.
|
14151814 | if(isSwimming() && (liftflags&LIFTFL_DIS_SWIMMING) && !get_qr(qr_BROKEN_LIFTSWIM)) |
| 9816 | 1633 | drop_liftwpn(); | |
| 9817 | 14151814 | handle_passive_buttons(); | |
| 9818 |
2/2✓ Branch 0 taken 936 times.
✓ Branch 1 taken 14150878 times.
|
14151814 | if(liftclk) |
| 9819 | { | ||
| 9820 |
1/2✓ Branch 0 taken 936 times.
✗ Branch 1 not taken.
|
936 | if(lift_wpn) |
| 9821 | { | ||
| 9822 | 936 | action=lifting; FFCore.setHeroAction(lifting); | |
| 9823 | 936 | } | |
| 9824 | else | ||
| 9825 | { | ||
| 9826 | ✗ | liftclk = 0; | |
| 9827 | ✗ | tliftclk = 0; | |
| 9828 | } | ||
| 9829 | 936 | } | |
| 9830 |
2/2✓ Branch 0 taken 14141424 times.
✓ Branch 1 taken 9454 times.
|
14150878 | else if(lift_wpn) |
| 9831 | { | ||
| 9832 | 9454 | handle_lift(false); | |
| 9833 | 9454 | } | |
| 9834 | |||
| 9835 | |||
| 9836 | // get user input or do other animation | ||
| 9837 | 14151814 | freeze_guys=false; // reset this flag, set it again if holding | |
| 9838 | |||
| 9839 |
14/16✓ Branch 0 taken 14032880 times.
✓ Branch 1 taken 118934 times.
✓ Branch 2 taken 14006568 times.
✓ Branch 3 taken 26312 times.
✓ Branch 4 taken 14005396 times.
✓ Branch 5 taken 1172 times.
✓ Branch 6 taken 14004745 times.
✓ Branch 7 taken 651 times.
✓ Branch 8 taken 14004745 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 14004745 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 13981492 times.
✓ Branch 13 taken 23253 times.
✓ Branch 14 taken 13981376 times.
✓ Branch 15 taken 116 times.
|
14151814 | if(action != landhold1 && action != landhold2 && action != waterhold1 && action != waterhold2 && action != sidewaterhold1 && action != sidewaterhold2 && fairyclk==0 && holdclk>0) |
| 9840 | { | ||
| 9841 | 116 | holdclk=0; | |
| 9842 | 116 | } | |
| 9843 | |||
| 9844 | 14151814 | active_shield_id = refreshActiveShield(); | |
| 9845 | 14151814 | bool sh = active_shield_id > -1; | |
| 9846 | 14151814 | itemdata const& shield = itemsbuf[active_shield_id]; | |
| 9847 | //Handle direction forcing. This runs every frame so that scripts can interact with dir still. | ||
| 9848 | 14151814 | shield_forcedir = -1; | |
| 9849 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 14151814 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
14151814 | if(sh && action != rafting && (shield.flags & item_flag11)) //Lock Dir |
| 9850 | { | ||
| 9851 | ✗ | shield_forcedir = dir; | |
| 9852 | ✗ | } | |
| 9853 |
1/2✓ Branch 0 taken 14151814 times.
✗ Branch 1 not taken.
|
14151814 | if(sh != shield_active) //Toggle active shield on/off |
| 9854 | { | ||
| 9855 | ✗ | shield_active = sh; | |
| 9856 | ✗ | if(sh) //Toggle active shield on | |
| 9857 | { | ||
| 9858 | ✗ | sfx(shield.usesound2); //'Activate' sfx | |
| 9859 | ✗ | } | |
| 9860 | ✗ | } | |
| 9861 | |||
| 9862 | 14151814 | bool isthissolid = false; | |
| 9863 |
12/12✓ Branch 0 taken 134909 times.
✓ Branch 1 taken 1823 times.
✓ Branch 2 taken 6144 times.
✓ Branch 3 taken 310942 times.
✓ Branch 4 taken 3887 times.
✓ Branch 5 taken 145246 times.
✓ Branch 6 taken 13411379 times.
✓ Branch 7 taken 102373 times.
✓ Branch 8 taken 3500 times.
✓ Branch 9 taken 14081 times.
✓ Branch 10 taken 16594 times.
✓ Branch 11 taken 936 times.
|
14151814 | switch(action) |
| 9864 | { | ||
| 9865 | case gothit: | ||
| 9866 |
2/2✓ Branch 0 taken 100080 times.
✓ Branch 1 taken 2293 times.
|
102373 | if(attackclk) |
| 9867 |
2/2✓ Branch 0 taken 1986 times.
✓ Branch 1 taken 307 times.
|
2600 | if(!doattack()) |
| 9868 | { | ||
| 9869 | 307 | attackclk=spins=0; | |
| 9870 | 307 | tapping=false; | |
| 9871 | 307 | } | |
| 9872 | |||
| 9873 | 102373 | break; | |
| 9874 | |||
| 9875 | case drowning: | ||
| 9876 | case lavadrowning: | ||
| 9877 | case sidedrowning: | ||
| 9878 | { | ||
| 9879 | 6144 | herostep(); // maybe this line should be elsewhere? | |
| 9880 | |||
| 9881 | //!DROWN | ||
| 9882 | // Helpful comment to find drowning -Dimi | ||
| 9883 | |||
| 9884 | 6144 | drop_liftwpn(); | |
| 9885 |
2/2✓ Branch 0 taken 6048 times.
✓ Branch 1 taken 96 times.
|
6144 | if(--drownclk==0) |
| 9886 | { | ||
| 9887 | 96 | action=none; FFCore.setHeroAction(none); | |
| 9888 |
1/2✓ Branch 0 taken 96 times.
✗ Branch 1 not taken.
|
96 | int32_t water = drownCombo ? drownCombo : iswaterex(MAPCOMBO(x.getInt()+7.5,y.getInt()+12), currmap, currscr, -1, x.getInt()+7.5,y.getInt()+12, true, false); |
| 9889 | |||
| 9890 | 96 | std::vector<int32_t> &ev = FFCore.eventData; | |
| 9891 | 96 | ev.clear(); | |
| 9892 | 96 | ev.push_back(water*10000); | |
| 9893 | |||
| 9894 | 96 | throwGenScriptEvent(GENSCR_EVENT_PLAYER_DROWN); | |
| 9895 | 96 | water = ev[0]/10000; | |
| 9896 | 96 | newcombo const& watercmb = combobuf[water]; | |
| 9897 | |||
| 9898 | 96 | int32_t damage = 4; | |
| 9899 |
2/2✓ Branch 0 taken 68 times.
✓ Branch 1 taken 28 times.
|
96 | if (watercmb.type == cWATER) |
| 9900 | 68 | damage = watercmb.attributes[0]/10000L; | |
| 9901 | 28 | else water = 0; | |
| 9902 | |||
| 9903 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 96 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
96 | if(cheat_superman && damage > 0) |
| 9904 | ✗ | damage = 0; | |
| 9905 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 96 times.
|
96 | if(damage) |
| 9906 | 96 | game->set_life(vbound(game->get_life()-damage,0, game->get_maxlife())); | |
| 9907 | 96 | drownCombo = 0; | |
| 9908 | 96 | go_respawn_point(); | |
| 9909 | 96 | hclk=48; | |
| 9910 | 96 | } | |
| 9911 | |||
| 9912 | 6144 | break; | |
| 9913 | } | ||
| 9914 | case falling: | ||
| 9915 | { | ||
| 9916 | 3500 | herostep(); | |
| 9917 | 3500 | pitfall(); | |
| 9918 | 3500 | break; | |
| 9919 | } | ||
| 9920 | case freeze: | ||
| 9921 | case sideswimfreeze: | ||
| 9922 | case scrolling: | ||
| 9923 | 310942 | break; | |
| 9924 | |||
| 9925 | case casting: | ||
| 9926 | case sideswimcasting: | ||
| 9927 | { | ||
| 9928 |
2/2✓ Branch 0 taken 3878 times.
✓ Branch 1 taken 9 times.
|
3887 | if(magicitem==-1) |
| 9929 | { | ||
| 9930 | 9 | action=none; FFCore.setHeroAction(none); | |
| 9931 | 9 | } | |
| 9932 | |||
| 9933 | 3887 | break; | |
| 9934 | } | ||
| 9935 | case landhold1: | ||
| 9936 | case landhold2: | ||
| 9937 | { | ||
| 9938 |
2/2✓ Branch 0 taken 1212 times.
✓ Branch 1 taken 144034 times.
|
145246 | if(--holdclk <= 0) |
| 9939 | { | ||
| 9940 | //restart music | ||
| 9941 |
4/4✓ Branch 0 taken 84 times.
✓ Branch 1 taken 1128 times.
✓ Branch 2 taken 49 times.
✓ Branch 3 taken 35 times.
|
1212 | if(get_qr(qr_HOLDNOSTOPMUSIC) == 0 && (specialcave < GUYCAVE)) |
| 9942 | 35 | playLevelMusic(); | |
| 9943 | |||
| 9944 | 1212 | action=none; FFCore.setHeroAction(none); | |
| 9945 | 1212 | post_item_collect(); | |
| 9946 | 1212 | } | |
| 9947 | else | ||
| 9948 | 144034 | freeze_guys=true; | |
| 9949 | |||
| 9950 | 145246 | break; | |
| 9951 | } | ||
| 9952 | case waterhold1: | ||
| 9953 | case waterhold2: | ||
| 9954 | case sidewaterhold1: | ||
| 9955 | case sidewaterhold2: | ||
| 9956 | { | ||
| 9957 | 1823 | diveclk=0; | |
| 9958 | |||
| 9959 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 1807 times.
|
1823 | if(--holdclk <= 0) |
| 9960 | { | ||
| 9961 | //restart music | ||
| 9962 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
16 | if(get_qr(qr_HOLDNOSTOPMUSIC) == 0 && (specialcave < GUYCAVE)) |
| 9963 | ✗ | playLevelMusic(); | |
| 9964 | |||
| 9965 | 16 | SetSwim(); | |
| 9966 | 16 | post_item_collect(); | |
| 9967 | 16 | } | |
| 9968 | else | ||
| 9969 | 1807 | freeze_guys=true; | |
| 9970 | |||
| 9971 | 1823 | break; | |
| 9972 | } | ||
| 9973 | case hopping: | ||
| 9974 | { | ||
| 9975 |
3/4✓ Branch 0 taken 13 times.
✓ Branch 1 taken 14068 times.
✓ Branch 2 taken 13 times.
✗ Branch 3 not taken.
|
14081 | if(DRIEDLAKE) |
| 9976 | { | ||
| 9977 | ✗ | action=none; FFCore.setHeroAction(none); | |
| 9978 | ✗ | hopclk = 0; | |
| 9979 | ✗ | diveclk = 0; | |
| 9980 | ✗ | break; | |
| 9981 | } | ||
| 9982 | |||
| 9983 | 14081 | do_hopping(); | |
| 9984 | 14081 | break; | |
| 9985 | } | ||
| 9986 | case inwind: | ||
| 9987 | { | ||
| 9988 | 16594 | int32_t i=Lwpns.idFirst(wWind); | |
| 9989 | |||
| 9990 |
2/2✓ Branch 0 taken 16371 times.
✓ Branch 1 taken 223 times.
|
16594 | if(i<0) |
| 9991 | { | ||
| 9992 | 223 | bool exit=false; | |
| 9993 | |||
| 9994 |
2/2✓ Branch 0 taken 111 times.
✓ Branch 1 taken 112 times.
|
223 | if(whirlwind==255) |
| 9995 | { | ||
| 9996 | 111 | exit=true; | |
| 9997 | 111 | } | |
| 9998 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 112 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
112 | else if(y<=0 && dir==up) y=-1; |
| 9999 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 112 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
112 | else if(y>=160 && dir==down) y=161; |
| 10000 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 112 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
112 | else if(x<=0 && dir==left) x=-1; |
| 10001 |
2/4✓ Branch 0 taken 112 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 112 times.
|
112 | else if(x>=240 && dir==right) x=241; |
| 10002 | ✗ | else exit=true; | |
| 10003 | |||
| 10004 |
2/2✓ Branch 0 taken 112 times.
✓ Branch 1 taken 111 times.
|
223 | if(exit) |
| 10005 | { | ||
| 10006 | 111 | action=none; FFCore.setHeroAction(none); | |
| 10007 | 111 | xofs=0; | |
| 10008 | 111 | whirlwind=0; | |
| 10009 | 111 | lstep=0; | |
| 10010 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 111 times.
|
111 | if ( dontdraw < 2 ) dontdraw=0; |
| 10011 | 111 | set_respawn_point(); | |
| 10012 | 111 | } | |
| 10013 | 223 | } | |
| 10014 | /* | ||
| 10015 | else if (((weapon*)Lwpns.spr(i))->dead==1) | ||
| 10016 | { | ||
| 10017 | whirlwind=255; | ||
| 10018 | } | ||
| 10019 | */ | ||
| 10020 | else | ||
| 10021 | { | ||
| 10022 | 16371 | x=Lwpns.spr(i)->x; | |
| 10023 | 16371 | y=Lwpns.spr(i)->y; | |
| 10024 | 16371 | dir=Lwpns.spr(i)->dir; | |
| 10025 | } | ||
| 10026 | } | ||
| 10027 | 16594 | break; | |
| 10028 | case lifting: | ||
| 10029 | 936 | handle_lift(); | |
| 10030 | 936 | break; | |
| 10031 | |||
| 10032 | case sideswimming: | ||
| 10033 | case sideswimattacking: | ||
| 10034 | case sideswimhit: | ||
| 10035 | case swimhit: | ||
| 10036 | case swimming: | ||
| 10037 | { | ||
| 10038 |
3/4✓ Branch 0 taken 166 times.
✓ Branch 1 taken 134743 times.
✓ Branch 2 taken 166 times.
✗ Branch 3 not taken.
|
134909 | if(DRIEDLAKE) |
| 10039 | { | ||
| 10040 | ✗ | action=none; FFCore.setHeroAction(none); | |
| 10041 | ✗ | hopclk=0; | |
| 10042 | ✗ | break; | |
| 10043 | } | ||
| 10044 | |||
| 10045 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 134909 times.
|
134909 | bool shouldbreak = (action == sideswimhit || action == swimhit); //!DIMITODO: "Can walk while hurt" compat needs to be added here. |
| 10046 | |||
| 10047 |
4/4✓ Branch 0 taken 67399 times.
✓ Branch 1 taken 67510 times.
✓ Branch 2 taken 626 times.
✓ Branch 3 taken 66773 times.
|
134909 | if((frame&1) && !shouldbreak) |
| 10048 | 66773 | herostep(); | |
| 10049 | |||
| 10050 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 134909 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 134909 times.
✓ Branch 4 taken 10279 times.
✓ Branch 5 taken 124630 times.
|
145411 | if (_walkflag(x+7,y+(bigHitbox?6:11),1,SWITCHBLOCK_STATE) |
| 10051 |
4/6✓ Branch 0 taken 124407 times.
✓ Branch 1 taken 10502 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 10502 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 10502 times.
|
134909 | || _walkflag(x+7,y+(bigHitbox?9:12),1,SWITCHBLOCK_STATE) |
| 10052 |
4/6✓ Branch 0 taken 9 times.
✓ Branch 1 taken 10493 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 10493 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 10493 times.
|
10502 | || _walkflag(x+8,y+(bigHitbox?6:11),1,SWITCHBLOCK_STATE) |
| 10053 |
4/6✓ Branch 0 taken 214 times.
✓ Branch 1 taken 10279 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 10279 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 10279 times.
|
135123 | || _walkflag(x+8,y+(bigHitbox?9:12),1,SWITCHBLOCK_STATE)) isthissolid = true; |
| 10054 |
4/4✓ Branch 0 taken 126779 times.
✓ Branch 1 taken 8130 times.
✓ Branch 2 taken 126779 times.
✓ Branch 3 taken 8130 times.
|
134909 | if ((get_qr(qr_NO_HOPPING) || CanSideSwim()) && !isthissolid) //Since hopping won't be set with this on, something needs to kick Hero out of water... |
| 10055 | { | ||
| 10056 |
4/4✓ Branch 0 taken 8082 times.
✓ Branch 1 taken 48 times.
✓ Branch 2 taken 8027 times.
✓ Branch 3 taken 4 times.
|
16161 | if(!iswaterex(MAPCOMBO(x.getInt()+4,y.getInt()+9), currmap, currscr, -1, x.getInt()+4,y.getInt()+9, true, false)||!iswaterex(MAPCOMBO(x.getInt()+4,y.getInt()+15), currmap, currscr, -1, x.getInt()+4,y.getInt()+15, true, false) |
| 10057 |
4/4✓ Branch 0 taken 8058 times.
✓ Branch 1 taken 24 times.
✓ Branch 2 taken 8031 times.
✓ Branch 3 taken 27 times.
|
8082 | || !iswaterex(MAPCOMBO(x.getInt()+11,y.getInt()+9), currmap, currscr, -1, x.getInt()+11,y.getInt()+9, true, false)||!iswaterex(MAPCOMBO(x.getInt()+11,y.getInt()+15), currmap, currscr, -1, x.getInt()+11,y.getInt()+15, true, false)) |
| 10058 | { | ||
| 10059 | 103 | hopclk=0; | |
| 10060 | 103 | diveclk=0; | |
| 10061 |
2/4✓ Branch 0 taken 103 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 103 times.
|
103 | if (action != sideswimattacking && action != attacking) {action=none; FFCore.setHeroAction(none);} |
| 10062 | ✗ | else {action=attacking; FFCore.setHeroAction(attacking);} | |
| 10063 | 103 | hopdir=-1; | |
| 10064 | 103 | } | |
| 10065 | 8130 | } | |
| 10066 |
2/2✓ Branch 0 taken 1259 times.
✓ Branch 1 taken 133650 times.
|
134909 | if (shouldbreak) break; |
| 10067 |
4/6✓ Branch 0 taken 103 times.
✓ Branch 1 taken 133547 times.
✓ Branch 2 taken 103 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 103 times.
|
133650 | if (action == swimming || action == sideswimming || action == sideswimattacking) |
| 10068 | { | ||
| 10069 | 133547 | int32_t watercheck = iswaterex(MAPCOMBO(x.getInt()+7.5,y.getInt()+12), currmap, currscr, -1, x.getInt()+7.5,y.getInt()+12, true, false); | |
| 10070 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 133547 times.
|
133547 | if (combobuf[watercheck].usrflags&cflag2) |
| 10071 | { | ||
| 10072 | ✗ | if (current_item(combobuf[watercheck].attribytes[2]) < combobuf[watercheck].attribytes[3]) | |
| 10073 | { | ||
| 10074 | ✗ | onpassivedmg = true; | |
| 10075 | ✗ | if (damageovertimeclk == 0) | |
| 10076 | { | ||
| 10077 | ✗ | int32_t curhp = game->get_life(); | |
| 10078 | ✗ | if (combobuf[watercheck].usrflags&cflag5) game->set_life(vbound(game->get_life()+ringpower(combobuf[watercheck].attributes[1]/10000L), 0, game->get_maxlife())); //Affected by rings | |
| 10079 | ✗ | else game->set_life(vbound(game->get_life()+(combobuf[watercheck].attributes[1]/10000L), 0, game->get_maxlife())); | |
| 10080 | ✗ | if ((combobuf[watercheck].attributes[2]/10000L) && (game->get_life() != curhp || !(combobuf[watercheck].usrflags&cflag6))) sfx(combobuf[watercheck].attributes[2]/10000L); | |
| 10081 | ✗ | if (game->get_life() < curhp && combobuf[watercheck].usrflags&cflag7) | |
| 10082 | { | ||
| 10083 | ✗ | hclk = 48; | |
| 10084 | ✗ | hitdir = -1; | |
| 10085 | ✗ | if (IsSideSwim()) {action = sideswimhit; FFCore.setHeroAction(sideswimhit);} | |
| 10086 | ✗ | else {action = swimhit; FFCore.setHeroAction(swimhit);} | |
| 10087 | ✗ | } | |
| 10088 | ✗ | } | |
| 10089 | ✗ | if (combobuf[watercheck].attribytes[1] > 0) | |
| 10090 | { | ||
| 10091 | ✗ | if (!damageovertimeclk || damageovertimeclk > combobuf[watercheck].attribytes[1]) damageovertimeclk = combobuf[watercheck].attribytes[1]; | |
| 10092 | ✗ | else --damageovertimeclk; | |
| 10093 | ✗ | } | |
| 10094 | ✗ | else damageovertimeclk = 0; | |
| 10095 | ✗ | } | |
| 10096 | ✗ | else damageovertimeclk = 0; | |
| 10097 | ✗ | } | |
| 10098 | 133547 | else damageovertimeclk = 0; | |
| 10099 | //combobuf[watercheck].attributes[0] | ||
| 10100 | 133547 | } | |
| 10101 | |||
| 10102 | 133650 | } | |
| 10103 | [[fallthrough]]; | ||
| 10104 | default: | ||
| 10105 | // call the main movement routine | ||
| 10106 |
2/2✓ Branch 0 taken 391624 times.
✓ Branch 1 taken 13153405 times.
|
13545029 | if(get_qr(qr_NEW_HERO_MOVEMENT2)) |
| 10107 | { | ||
| 10108 |
2/2✓ Branch 0 taken 37440 times.
✓ Branch 1 taken 354184 times.
|
391624 | if(premove()) |
| 10109 | 354184 | movehero(); | |
| 10110 | 391624 | } | |
| 10111 | else | ||
| 10112 | { | ||
| 10113 | 13153405 | sliding = 0; | |
| 10114 | 13153405 | moveheroOld(); | |
| 10115 | } | ||
| 10116 | 13545029 | } | |
| 10117 |
11/14✓ Branch 0 taken 253972 times.
✓ Branch 1 taken 13897842 times.
✓ Branch 2 taken 854 times.
✓ Branch 3 taken 253118 times.
✓ Branch 4 taken 854 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 834 times.
✓ Branch 7 taken 20 times.
✓ Branch 8 taken 816 times.
✓ Branch 9 taken 18 times.
✓ Branch 10 taken 816 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 816 times.
|
14151814 | if (isSideViewHero() && slopeid && hoverclk < 1 && !inair && fall == 0 && !IsSideSwim() && justmoved <= 0) |
| 10118 | { | ||
| 10119 |
2/2✓ Branch 0 taken 594 times.
✓ Branch 1 taken 222 times.
|
816 | if (!on_sideview_solid_oldpos(this, false, 0)) |
| 10120 | { | ||
| 10121 | 222 | zfix dy = 0; | |
| 10122 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 728 times.
|
728 | for (zfix q = 0; q <= 4; ++q) |
| 10123 | { | ||
| 10124 |
2/2✓ Branch 0 taken 506 times.
✓ Branch 1 taken 222 times.
|
728 | if (on_sideview_solid_oldpos(this, false, 0, 0, q)) |
| 10125 | { | ||
| 10126 | 222 | dy = q; | |
| 10127 | 222 | break; | |
| 10128 | } | ||
| 10129 | 506 | } | |
| 10130 |
3/6✓ Branch 0 taken 222 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 222 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 222 times.
✗ Branch 5 not taken.
|
3634 | dy = binary_search_zfix(0, dy, [&](zfix val, zfix& retval) |
| 10131 | { | ||
| 10132 |
2/2✓ Branch 0 taken 1014 times.
✓ Branch 1 taken 2398 times.
|
3412 | if (on_sideview_solid_oldpos(this, false, 0, 0, val)) |
| 10133 | { | ||
| 10134 | 1014 | retval = val; | |
| 10135 | 1014 | return BSEARCH_CONTINUE_TOWARD0; | |
| 10136 | } | ||
| 10137 | 2398 | else return BSEARCH_CONTINUE_AWAY0; | |
| 10138 | 3412 | }); | |
| 10139 |
2/2✓ Branch 0 taken 112 times.
✓ Branch 1 taken 110 times.
|
222 | if (dy) push_move(0, dy); |
| 10140 | 222 | } | |
| 10141 | 816 | } | |
| 10142 | |||
| 10143 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 14151814 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
14151814 | if(shield_forcedir > -1 && action != rafting) |
| 10144 | ✗ | dir = shield_forcedir; | |
| 10145 | |||
| 10146 | |||
| 10147 | // check for ladder removal | ||
| 10148 |
2/2✓ Branch 0 taken 4404348 times.
✓ Branch 1 taken 9747466 times.
|
14151814 | if(diagonalMovement) |
| 10149 | { | ||
| 10150 |
2/2✓ Branch 0 taken 4395687 times.
✓ Branch 1 taken 8661 times.
|
4404348 | if(ladderx+laddery) |
| 10151 | { | ||
| 10152 |
2/2✓ Branch 0 taken 3309 times.
✓ Branch 1 taken 5352 times.
|
8661 | if(ladderdir<=down) |
| 10153 | { | ||
| 10154 |
10/10✓ Branch 0 taken 2266 times.
✓ Branch 1 taken 1043 times.
✓ Branch 2 taken 68 times.
✓ Branch 3 taken 3241 times.
✓ Branch 4 taken 2229 times.
✓ Branch 5 taken 1012 times.
✓ Branch 6 taken 3210 times.
✓ Branch 7 taken 31 times.
✓ Branch 8 taken 5 times.
✓ Branch 9 taken 3205 times.
|
3309 | if((laddery-y.getInt()>=(16+(ladderstart==dir?ladderstart==down?1:0:0))) || (laddery-y.getInt()<=(-16-(ladderstart==dir?ladderstart==up?1:0:0))) || (abs(ladderx-x.getInt())>8)) |
| 10155 | { | ||
| 10156 | 104 | reset_ladder(); | |
| 10157 | 104 | } | |
| 10158 | 3309 | } | |
| 10159 | else | ||
| 10160 | { | ||
| 10161 |
10/10✓ Branch 0 taken 5 times.
✓ Branch 1 taken 5347 times.
✓ Branch 2 taken 4277 times.
✓ Branch 3 taken 1070 times.
✓ Branch 4 taken 64 times.
✓ Branch 5 taken 5283 times.
✓ Branch 6 taken 4245 times.
✓ Branch 7 taken 1038 times.
✓ Branch 8 taken 89 times.
✓ Branch 9 taken 5194 times.
|
5352 | if((abs(laddery-y.getInt())>8) || (ladderx-x.getInt()>=(16+(ladderstart==dir?ladderstart==right?1:0:0))) || (ladderx-x.getInt()<=(-16-(ladderstart==dir?ladderstart==left?1:0:0)))) |
| 10162 | { | ||
| 10163 | 158 | reset_ladder(); | |
| 10164 | 158 | } | |
| 10165 | } | ||
| 10166 | 8661 | } | |
| 10167 | 4404348 | } | |
| 10168 | else | ||
| 10169 | { | ||
| 10170 |
4/4✓ Branch 0 taken 334163 times.
✓ Branch 1 taken 9413303 times.
✓ Branch 2 taken 194300 times.
✓ Branch 3 taken 139863 times.
|
9747466 | if((abs(laddery-y.getInt())>=16) || (abs(ladderx-x.getInt())>=16)) |
| 10171 | { | ||
| 10172 | 9607603 | reset_ladder(); | |
| 10173 | 9607603 | } | |
| 10174 | } | ||
| 10175 | |||
| 10176 |
2/2✓ Branch 0 taken 13692542 times.
✓ Branch 1 taken 459272 times.
|
14151814 | if(!get_qr(qr_OLD_RESPAWN_POINTS)) //needs to happen after ladder removal so the respawn point is set when laddering over multiple 1 tile gaps. |
| 10177 | 459272 | set_respawn_point(false); //Keep the 'last safe location' updated! | |
| 10178 | |||
| 10179 |
2/2✓ Branch 0 taken 3156 times.
✓ Branch 1 taken 14148658 times.
|
14151814 | if(ilswim) |
| 10180 | 3156 | landswim++; | |
| 10181 | 14148658 | else landswim=0; | |
| 10182 | |||
| 10183 |
2/2✓ Branch 0 taken 172 times.
✓ Branch 1 taken 14151642 times.
|
14151814 | if(hopclk!=0xFF) ilswim=false; |
| 10184 | |||
| 10185 |
4/4✓ Branch 0 taken 35943 times.
✓ Branch 1 taken 14115871 times.
✓ Branch 2 taken 1757 times.
✓ Branch 3 taken 34186 times.
|
14151814 | if((!loaded_guys) && (frame - newscr_clk >= 1)) |
| 10186 | { | ||
| 10187 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 34169 times.
|
34186 | if(tmpscr->room==rGANON) |
| 10188 | { | ||
| 10189 | 17 | ganon_intro(); | |
| 10190 | 17 | } | |
| 10191 | else | ||
| 10192 | { | ||
| 10193 | 34169 | loadguys(); | |
| 10194 | } | ||
| 10195 | 34186 | } | |
| 10196 | |||
| 10197 |
2/2✓ Branch 0 taken 37929 times.
✓ Branch 1 taken 14113885 times.
|
14151814 | if(frame - newscr_clk >= 2) |
| 10198 | { | ||
| 10199 | 14113885 | loadenemies(); | |
| 10200 | 14113885 | } | |
| 10201 | |||
| 10202 | // check lots of other things | ||
| 10203 | 14151814 | checkscroll(); | |
| 10204 | |||
| 10205 |
7/8✓ Branch 0 taken 14135332 times.
✓ Branch 1 taken 16482 times.
✓ Branch 2 taken 14129536 times.
✓ Branch 3 taken 5796 times.
✓ Branch 4 taken 14129536 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 253 times.
✓ Branch 7 taken 14129283 times.
|
14151814 | if(action!=inwind && action!=drowning && action != sidedrowning && action!=lavadrowning) |
| 10206 | { | ||
| 10207 | 14129283 | checkspecial(); | |
| 10208 | 14129283 | checkitems(); | |
| 10209 | 14129283 | checklocked(); //This has issues if Hero's action is WALKING, in 8-way moveent. | |
| 10210 |
2/2✓ Branch 0 taken 548158 times.
✓ Branch 1 taken 13581125 times.
|
14129283 | if(get_qr(qr_OLD_LOCKBLOCK_COLLISION)) |
| 10211 | { | ||
| 10212 | 13581125 | oldchecklockblock(); | |
| 10213 | 13581125 | oldcheckbosslockblock(); | |
| 10214 | 13581125 | } | |
| 10215 |
2/2✓ Branch 0 taken 984843 times.
✓ Branch 1 taken 13144440 times.
|
14129283 | if(get_qr(qr_OLD_CHEST_COLLISION)) |
| 10216 | { | ||
| 10217 | 13144440 | oldcheckchest(cCHEST); | |
| 10218 | 13144440 | oldcheckchest(cLOCKEDCHEST); | |
| 10219 | 13144440 | oldcheckchest(cBOSSCHEST); | |
| 10220 | 13144440 | } | |
| 10221 | 14129283 | checkpushblock(); | |
| 10222 | 14129283 | checkswordtap(); | |
| 10223 | |||
| 10224 |
2/2✓ Branch 0 taken 14082008 times.
✓ Branch 1 taken 47275 times.
|
14129283 | if(hookshot_frozen==false) |
| 10225 | { | ||
| 10226 | 14082008 | checkspecial2(&lsave); | |
| 10227 | 14082008 | } | |
| 10228 | |||
| 10229 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 14129273 times.
|
14129283 | if(action==won) |
| 10230 | { | ||
| 10231 | 10 | return true; | |
| 10232 | } | ||
| 10233 | 14129273 | } | |
| 10234 | |||
| 10235 | // Somehow Hero was displaced from the fairy flag... | ||
| 10236 |
3/6✓ Branch 0 taken 23254 times.
✓ Branch 1 taken 14128550 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 23254 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
14151804 | if(fairyclk && action != freeze && action != sideswimfreeze) |
| 10237 | { | ||
| 10238 | ✗ | fairyclk = holdclk = refill_why = 0; | |
| 10239 | ✗ | } | |
| 10240 | |||
| 10241 |
4/4✓ Branch 0 taken 14151803 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 14069943 times.
✓ Branch 3 taken 81860 times.
|
14151804 | if((!activated_timed_warp) && (tmpscr->timedwarptics>0)) |
| 10242 | { | ||
| 10243 | 81860 | tmpscr->timedwarptics--; | |
| 10244 | |||
| 10245 |
2/2✓ Branch 0 taken 493 times.
✓ Branch 1 taken 81367 times.
|
81860 | if(tmpscr->timedwarptics==0) |
| 10246 | { | ||
| 10247 | 493 | activated_timed_warp=true; | |
| 10248 | |||
| 10249 |
2/2✓ Branch 0 taken 372 times.
✓ Branch 1 taken 121 times.
|
493 | if(tmpscr->flags4 & fTIMEDDIRECT) |
| 10250 | { | ||
| 10251 | 121 | didpit=true; | |
| 10252 | 121 | pitx=x; | |
| 10253 | 121 | pity=y; | |
| 10254 | 121 | } | |
| 10255 | |||
| 10256 | 493 | int32_t index2 = 0; | |
| 10257 | |||
| 10258 |
1/2✓ Branch 0 taken 493 times.
✗ Branch 1 not taken.
|
493 | if(tmpscr->flags5 & fRANDOMTIMEDWARP) index2=zc_oldrand()%4; |
| 10259 | |||
| 10260 | 493 | sdir = dir; | |
| 10261 | 493 | dowarp(1,index2); | |
| 10262 | 493 | } | |
| 10263 | 81860 | } | |
| 10264 | |||
| 10265 | 14151804 | bool awarp = false; | |
| 10266 | //!DIMI: Global Combo Effects (AUTO STUFF) | ||
| 10267 |
2/2✓ Branch 0 taken 14151649 times.
✓ Branch 1 taken 2490699733 times.
|
2504851382 | for(int32_t i=0; i<176; ++i) |
| 10268 | { | ||
| 10269 |
2/2✓ Branch 0 taken 80634224 times.
✓ Branch 1 taken 10204701139 times.
|
10285335363 | for(int32_t layer=0; layer<7; ++layer) |
| 10270 | { | ||
| 10271 |
2/2✓ Branch 0 taken 7714001406 times.
✓ Branch 1 taken 2490699733 times.
|
10204701139 | int32_t cid = ( layer ) ? MAPCOMBOL(layer,COMBOX(i),COMBOY(i)) : MAPCOMBO(COMBOX(i),COMBOY(i)); |
| 10272 | 10204701139 | newcombo const& cmb = combobuf[cid]; | |
| 10273 | |||
| 10274 |
2/2✓ Branch 0 taken 564439569 times.
✓ Branch 1 taken 9640261570 times.
|
10204701139 | if(!get_qr(qr_AUTOCOMBO_ANY_LAYER)) |
| 10275 | { | ||
| 10276 |
2/2✓ Branch 0 taken 7230196216 times.
✓ Branch 1 taken 2410065354 times.
|
9640261570 | if(layer > 2) break; |
| 10277 |
4/4✓ Branch 0 taken 2410065354 times.
✓ Branch 1 taken 4820130862 times.
✓ Branch 2 taken 46285008 times.
✓ Branch 3 taken 2363780346 times.
|
7230196216 | if (layer == 1 && !get_qr(qr_AUTOCOMBO_LAYER_1)) continue; |
| 10278 |
4/4✓ Branch 0 taken 2410065354 times.
✓ Branch 1 taken 2456350516 times.
✓ Branch 2 taken 46285008 times.
✓ Branch 3 taken 2363780346 times.
|
4866415870 | if (layer == 2 && !get_qr(qr_AUTOCOMBO_LAYER_2)) continue; |
| 10279 | 2502635524 | } | |
| 10280 | 3067075093 | int32_t ind=0; | |
| 10281 | |||
| 10282 | //AUTOMATIC TRIGGER CODE | ||
| 10283 |
2/2✓ Branch 0 taken 3066145313 times.
✓ Branch 1 taken 929780 times.
|
3067075093 | if (cmb.triggerflags[1]&combotriggerAUTOMATIC) |
| 10284 | { | ||
| 10285 | 929780 | do_trigger_combo(layer, i); | |
| 10286 | 929780 | } | |
| 10287 | |||
| 10288 | //AUTO WARP CODE | ||
| 10289 |
2/2✓ Branch 0 taken 19475 times.
✓ Branch 1 taken 3067055618 times.
|
3067075093 | if(!(cmb.triggerflags[0] & combotriggerONLYGENTRIG)) |
| 10290 | { | ||
| 10291 |
2/2✓ Branch 0 taken 89 times.
✓ Branch 1 taken 3067055529 times.
|
3067055618 | if(cmb.type==cAWARPA) |
| 10292 | { | ||
| 10293 | 89 | awarp=true; | |
| 10294 | 89 | ind=0; | |
| 10295 | 89 | } | |
| 10296 |
2/2✓ Branch 0 taken 63 times.
✓ Branch 1 taken 3067055466 times.
|
3067055529 | else if(cmb.type==cAWARPB) |
| 10297 | { | ||
| 10298 | 63 | awarp=true; | |
| 10299 | 63 | ind=1; | |
| 10300 | 63 | } | |
| 10301 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 3067055463 times.
|
3067055466 | else if(cmb.type==cAWARPC) |
| 10302 | { | ||
| 10303 | 3 | awarp=true; | |
| 10304 | 3 | ind=2; | |
| 10305 | 3 | } | |
| 10306 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3067055463 times.
|
3067055463 | else if(cmb.type==cAWARPD) |
| 10307 | { | ||
| 10308 | ✗ | awarp=true; | |
| 10309 | ✗ | ind=3; | |
| 10310 | ✗ | } | |
| 10311 |
1/2✓ Branch 0 taken 3067055463 times.
✗ Branch 1 not taken.
|
3067055463 | else if(cmb.type==cAWARPR) |
| 10312 | { | ||
| 10313 | ✗ | awarp=true; | |
| 10314 | ✗ | ind=zc_oldrand()%4; | |
| 10315 | ✗ | } | |
| 10316 | 3067055618 | } | |
| 10317 |
2/2✓ Branch 0 taken 155 times.
✓ Branch 1 taken 3067074938 times.
|
3067075093 | if(awarp) |
| 10318 | { | ||
| 10319 |
2/2✓ Branch 0 taken 88 times.
✓ Branch 1 taken 67 times.
|
155 | if(tmpscr->flags5&fDIRECTAWARP) |
| 10320 | { | ||
| 10321 | 67 | didpit=true; | |
| 10322 | 67 | pitx=x; | |
| 10323 | 67 | pity=y; | |
| 10324 | 67 | } | |
| 10325 | |||
| 10326 | 155 | sdir = dir; | |
| 10327 | 155 | dowarp(1,ind); | |
| 10328 | 155 | break; | |
| 10329 | } | ||
| 10330 | 3067074938 | } | |
| 10331 |
2/2✓ Branch 0 taken 2490699578 times.
✓ Branch 1 taken 155 times.
|
2490699733 | if(awarp) break; |
| 10332 | 2490699578 | } | |
| 10333 | |||
| 10334 | 14151804 | awarp=false; | |
| 10335 | |||
| 10336 | 14151804 | word c = tmpscr->numFFC(); | |
| 10337 |
2/2✓ Branch 0 taken 14151747 times.
✓ Branch 1 taken 423781431 times.
|
437933178 | for(word i=0; i<c; i++) |
| 10338 | { | ||
| 10339 | 423781431 | int32_t ind=0; | |
| 10340 | |||
| 10341 | 423781431 | newcombo const& cmb = combobuf[tmpscr->ffcs[i].data]; | |
| 10342 | |||
| 10343 |
2/2✓ Branch 0 taken 423770004 times.
✓ Branch 1 taken 11427 times.
|
423781431 | if (cmb.triggerflags[1]&combotriggerAUTOMATIC) |
| 10344 | { | ||
| 10345 | 11427 | do_trigger_combo_ffc(i); | |
| 10346 | 11427 | } | |
| 10347 | |||
| 10348 |
2/2✓ Branch 0 taken 3908 times.
✓ Branch 1 taken 423777523 times.
|
423781431 | if(!(cmb.triggerflags[0] & combotriggerONLYGENTRIG)) |
| 10349 | { | ||
| 10350 |
2/2✓ Branch 0 taken 19 times.
✓ Branch 1 taken 423777504 times.
|
423777523 | if(cmb.type==cAWARPA) |
| 10351 | { | ||
| 10352 | 19 | awarp=true; | |
| 10353 | 19 | ind=0; | |
| 10354 | 19 | } | |
| 10355 |
2/2✓ Branch 0 taken 33 times.
✓ Branch 1 taken 423777471 times.
|
423777504 | else if(cmb.type==cAWARPB) |
| 10356 | { | ||
| 10357 | 33 | awarp=true; | |
| 10358 | 33 | ind=1; | |
| 10359 | 33 | } | |
| 10360 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 423777469 times.
|
423777471 | else if(cmb.type==cAWARPC) |
| 10361 | { | ||
| 10362 | 2 | awarp=true; | |
| 10363 | 2 | ind=2; | |
| 10364 | 2 | } | |
| 10365 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 423777466 times.
|
423777469 | else if(cmb.type==cAWARPD) |
| 10366 | { | ||
| 10367 | 3 | awarp=true; | |
| 10368 | 3 | ind=3; | |
| 10369 | 3 | } | |
| 10370 |
1/2✓ Branch 0 taken 423777466 times.
✗ Branch 1 not taken.
|
423777466 | else if(cmb.type==cAWARPR) |
| 10371 | { | ||
| 10372 | ✗ | awarp=true; | |
| 10373 | ✗ | ind=zc_oldrand()%4; | |
| 10374 | ✗ | } | |
| 10375 | 423777523 | } | |
| 10376 | |||
| 10377 |
2/2✓ Branch 0 taken 423781374 times.
✓ Branch 1 taken 57 times.
|
423781431 | if(awarp) |
| 10378 | { | ||
| 10379 |
1/2✓ Branch 0 taken 57 times.
✗ Branch 1 not taken.
|
57 | if(tmpscr->flags5&fDIRECTAWARP) |
| 10380 | { | ||
| 10381 | ✗ | didpit=true; | |
| 10382 | ✗ | pitx=x; | |
| 10383 | ✗ | pity=y; | |
| 10384 | ✗ | } | |
| 10385 | |||
| 10386 | 57 | sdir = dir; | |
| 10387 | 57 | dowarp(1,ind); | |
| 10388 | 57 | break; | |
| 10389 | } | ||
| 10390 | 423781374 | } | |
| 10391 | 14151804 | zfix dx, dy; | |
| 10392 |
7/8✓ Branch 0 taken 253973 times.
✓ Branch 1 taken 13897831 times.
✓ Branch 2 taken 126905 times.
✓ Branch 3 taken 127068 times.
✓ Branch 4 taken 746 times.
✓ Branch 5 taken 126159 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 746 times.
|
14151804 | if (sideview_mode() && !on_sideview_solid_oldpos(this, false, 1) && on_sideview_solid_oldpos(this, false, 2) && !toogam) |
| 10393 | { | ||
| 10394 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 746 times.
|
746 | if (slide_slope(this, dx, dy, slopeid)) |
| 10395 | { | ||
| 10396 | 746 | onplatid = 1; | |
| 10397 |
2/4✓ Branch 0 taken 746 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 746 times.
|
746 | if (dx || dy) push_move(dx, dy); |
| 10398 | 746 | } | |
| 10399 | 746 | } | |
| 10400 |
2/2✓ Branch 0 taken 14150966 times.
✓ Branch 1 taken 838 times.
|
14151804 | if (onplatid <= 0) slopeid = 0; |
| 10401 | 838 | else --onplatid; | |
| 10402 |
2/2✓ Branch 0 taken 11245133 times.
✓ Branch 1 taken 2906671 times.
|
14151804 | bool onplatform = (on_sideview_solid_oldpos(this, false, 1) && !Up()); |
| 10403 |
5/6✓ Branch 0 taken 1964 times.
✓ Branch 1 taken 14151801 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1964 times.
✓ Branch 4 taken 1961 times.
✓ Branch 5 taken 14151804 times.
|
14153765 | for (auto q = 0; (check_slope(this, true) && !toogam) && q < 2; ++q) |
| 10404 | { | ||
| 10405 | 1961 | dx = 0; | |
| 10406 | 1961 | dy = 0; | |
| 10407 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 1961 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1961 times.
|
1961 | if (check_slope(this, true) && !toogam) |
| 10408 | { | ||
| 10409 | 1961 | slope_info const& s = get_slope(this, true).get_info(); | |
| 10410 | 1961 | bool staircheck = false; | |
| 10411 |
3/4✓ Branch 0 taken 1815 times.
✓ Branch 1 taken 146 times.
✓ Branch 2 taken 1815 times.
✗ Branch 3 not taken.
|
1961 | if (s.slope() != slopeid && slopeid) staircheck = true; |
| 10412 |
2/2✓ Branch 0 taken 1914 times.
✓ Branch 1 taken 47 times.
|
1961 | if (onplatform) staircheck = true; |
| 10413 | 1961 | slope_push_int(s, this, dx, dy, staircheck, platformfell2); | |
| 10414 | |||
| 10415 |
4/4✓ Branch 0 taken 181 times.
✓ Branch 1 taken 1780 times.
✓ Branch 2 taken 180 times.
✓ Branch 3 taken 1 times.
|
1961 | if (dx || dy) |
| 10416 | { | ||
| 10417 | 1960 | int32_t pushret = push_move(dx,dy); | |
| 10418 |
2/2✓ Branch 0 taken 1945 times.
✓ Branch 1 taken 15 times.
|
1960 | onplatform = (on_sideview_solid_oldpos(this, false, 1) && !Up()); |
| 10419 |
3/4✓ Branch 0 taken 1814 times.
✓ Branch 1 taken 146 times.
✓ Branch 2 taken 1814 times.
✗ Branch 3 not taken.
|
1960 | if (s.slope() != slopeid && slopeid) staircheck = true; |
| 10420 |
2/2✓ Branch 0 taken 1945 times.
✓ Branch 1 taken 15 times.
|
1960 | if (onplatform) staircheck = true; |
| 10421 |
4/4✓ Branch 0 taken 184 times.
✓ Branch 1 taken 1776 times.
✓ Branch 2 taken 38 times.
✓ Branch 3 taken 146 times.
|
1960 | if(sideview_mode() && slopeid) |
| 10422 | 146 | onplatid = 0; | |
| 10423 |
1/2✓ Branch 0 taken 1960 times.
✗ Branch 1 not taken.
|
1960 | if (pushret == 1) |
| 10424 | { | ||
| 10425 | ✗ | dx = -1; | |
| 10426 | ✗ | dy = 0; | |
| 10427 | ✗ | slope_push_int(s, this, dx, dy, staircheck); | |
| 10428 | ✗ | push_move(0,dy); | |
| 10429 | ✗ | } | |
| 10430 |
2/2✓ Branch 0 taken 1959 times.
✓ Branch 1 taken 1 times.
|
1960 | if (pushret == 2) |
| 10431 | { | ||
| 10432 | 1 | dx = 0; | |
| 10433 | 1 | dy = -1; | |
| 10434 | 1 | slope_push_int(s, this, dx, dy, staircheck); | |
| 10435 | 1 | push_move(dx,0); | |
| 10436 | 1 | } | |
| 10437 | 1960 | } | |
| 10438 | 1961 | } | |
| 10439 | 1961 | } | |
| 10440 | |||
| 10441 |
2/2✓ Branch 0 taken 14151598 times.
✓ Branch 1 taken 206 times.
|
14151804 | if(ffwarp) |
| 10442 | { | ||
| 10443 |
2/2✓ Branch 0 taken 79 times.
✓ Branch 1 taken 127 times.
|
206 | if(ffpit) |
| 10444 | { | ||
| 10445 | 127 | ffpit=false; | |
| 10446 | 127 | didpit=true; | |
| 10447 | 127 | pitx=x; | |
| 10448 | 127 | pity=y; | |
| 10449 | 127 | } | |
| 10450 | |||
| 10451 | 206 | ffwarp=false; | |
| 10452 | 206 | dowarp(1,0); | |
| 10453 | 206 | } | |
| 10454 | |||
| 10455 | //Hero->WarpEx | ||
| 10456 |
2/2✓ Branch 0 taken 14151700 times.
✓ Branch 1 taken 104 times.
|
14151804 | if ( FFCore.warpex[wexActive] ) |
| 10457 | { | ||
| 10458 | if(DEVLOGGING) zprint("Running warpex from hero.cpp\n"); | ||
| 10459 | 104 | FFCore.warpex[wexActive] = 0; | |
| 10460 | 104 | int32_t temp_warpex[wexActive] = {0}; //to hold the values as we clear the FFCore array. -Z | |
| 10461 |
2/2✓ Branch 0 taken 936 times.
✓ Branch 1 taken 104 times.
|
1040 | for ( int32_t q = 0; q < wexActive; q++ ) |
| 10462 | { | ||
| 10463 | 936 | temp_warpex[q] = FFCore.warpex[q]; | |
| 10464 | 936 | FFCore.warpex[q] = 0; | |
| 10465 | 936 | } | |
| 10466 | 208 | FFCore.warp_player( temp_warpex[wexType], temp_warpex[wexDMap], temp_warpex[wexScreen], temp_warpex[wexX], | |
| 10467 | 104 | temp_warpex[wexY], temp_warpex[wexEffect], temp_warpex[wexSound], temp_warpex[wexFlags], temp_warpex[wexDir]); | |
| 10468 | 104 | } | |
| 10469 | |||
| 10470 |
4/4✓ Branch 0 taken 17680 times.
✓ Branch 1 taken 14134124 times.
✓ Branch 2 taken 26989 times.
✓ Branch 3 taken 32753 times.
|
14151804 | if(z == 0 || !get_qr(qr_NO_SCROLL_WHILE_IN_AIR)) |
| 10471 | { | ||
| 10472 | // walk through bombed doors and fake walls | ||
| 10473 | 14166877 | bool walk=false; | |
| 10474 | 14166877 | int32_t dtype=dBOMBED; | |
| 10475 | |||
| 10476 |
2/2✓ Branch 0 taken 13809652 times.
✓ Branch 1 taken 291719 times.
|
14166877 | if(pushing>=24) dtype=dWALK; |
| 10477 | |||
| 10478 |
16/18✓ Branch 0 taken 6269928 times.
✓ Branch 1 taken 7831443 times.
✓ Branch 2 taken 6133322 times.
✓ Branch 3 taken 136606 times.
✓ Branch 4 taken 6133322 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 6121981 times.
✓ Branch 7 taken 11341 times.
✓ Branch 8 taken 6118560 times.
✓ Branch 9 taken 3421 times.
✓ Branch 10 taken 6111353 times.
✓ Branch 11 taken 7207 times.
✓ Branch 12 taken 6097641 times.
✓ Branch 13 taken 13712 times.
✓ Branch 14 taken 6097641 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 92948 times.
✓ Branch 17 taken 6190589 times.
|
14101371 | if(isdungeon() && action!=freeze && action != sideswimfreeze && loaded_guys && !inlikelike && !diveclk && action!=rafting && !lstunclock && !is_conveyor_stunned) |
| 10479 | { | ||
| 10480 |
12/14✓ Branch 0 taken 129000 times.
✓ Branch 1 taken 6061589 times.
✓ Branch 2 taken 1018716 times.
✓ Branch 3 taken 5042873 times.
✓ Branch 4 taken 1013612 times.
✓ Branch 5 taken 5104 times.
✓ Branch 6 taken 1013612 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1013612 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 946941 times.
✓ Branch 11 taken 941837 times.
✓ Branch 12 taken 66446 times.
✓ Branch 13 taken 225 times.
|
6190589 | if(((dtype==dBOMBED)?DrunkUp():dir==up) && ((diagonalMovement||NO_GRIDLOCK)?x.getInt()>112&&x.getInt()<128:x.getInt()==120) && y<=32 && tmpscr->door[0]==dtype) |
| 10481 | { | ||
| 10482 | 225 | walk=true; | |
| 10483 | 225 | dir=up; | |
| 10484 | 225 | } | |
| 10485 | |||
| 10486 |
12/14✓ Branch 0 taken 129000 times.
✓ Branch 1 taken 6051381 times.
✓ Branch 2 taken 733888 times.
✓ Branch 3 taken 5317493 times.
✓ Branch 4 taken 858719 times.
✓ Branch 5 taken 4169 times.
✓ Branch 6 taken 858719 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 858719 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 815398 times.
✓ Branch 11 taken 811229 times.
✓ Branch 12 taken 43105 times.
✓ Branch 13 taken 216 times.
|
6180381 | if(((dtype==dBOMBED)?DrunkDown():dir==down) && ((diagonalMovement||NO_GRIDLOCK)?x.getInt()>112&&x.getInt()<128:x.getInt()==120) && y>=128 && tmpscr->door[1]==dtype) |
| 10487 | { | ||
| 10488 | 216 | walk=true; | |
| 10489 | 216 | dir=down; | |
| 10490 | 216 | } | |
| 10491 | |||
| 10492 |
12/14✓ Branch 0 taken 129000 times.
✓ Branch 1 taken 6043043 times.
✓ Branch 2 taken 47175 times.
✓ Branch 3 taken 5995868 times.
✓ Branch 4 taken 101764 times.
✓ Branch 5 taken 215 times.
✓ Branch 6 taken 101764 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 101764 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 103 times.
✓ Branch 11 taken 112 times.
✓ Branch 12 taken 101589 times.
✓ Branch 13 taken 101486 times.
|
6172043 | if(((dtype==dBOMBED)?DrunkLeft():dir==left) && x<=32 && ((diagonalMovement||NO_GRIDLOCK)?y.getInt()>72&&y.getInt()<88:y.getInt()==80) && tmpscr->door[2]==dtype) |
| 10493 | { | ||
| 10494 | 175 | walk=true; | |
| 10495 | 175 | dir=left; | |
| 10496 | 175 | } | |
| 10497 | |||
| 10498 |
12/14✓ Branch 0 taken 5968641 times.
✓ Branch 1 taken 129000 times.
✓ Branch 2 taken 42211 times.
✓ Branch 3 taken 5926430 times.
✓ Branch 4 taken 122261 times.
✓ Branch 5 taken 90 times.
✓ Branch 6 taken 122261 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 122261 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 56 times.
✓ Branch 11 taken 34 times.
✓ Branch 12 taken 122066 times.
✓ Branch 13 taken 122010 times.
|
6097641 | if(((dtype==dBOMBED)?DrunkRight():dir==right) && x>=208 && ((diagonalMovement||NO_GRIDLOCK)?y.getInt()>72&&y.getInt()<88:y.getInt()==80) && tmpscr->door[3]==dtype) |
| 10499 | { | ||
| 10500 | 195 | walk=true; | |
| 10501 | 195 | dir=right; | |
| 10502 | 195 | } | |
| 10503 | 6048669 | } | |
| 10504 | |||
| 10505 |
2/2✓ Branch 0 taken 14144536 times.
✓ Branch 1 taken 811 times.
|
14145347 | if(walk) |
| 10506 | { | ||
| 10507 | 811 | hclk=0; | |
| 10508 | 811 | drawguys=false; | |
| 10509 | |||
| 10510 |
2/2✓ Branch 0 taken 616 times.
✓ Branch 1 taken 195 times.
|
811 | if(dtype==dWALK) |
| 10511 | { | ||
| 10512 | 195 | sfx(tmpscr->secretsfx); | |
| 10513 |
1/2✓ Branch 0 taken 195 times.
✗ Branch 1 not taken.
|
195 | if(!get_qr(qr_WALKTHROUGHWALL_NO_DOORSTATE)) |
| 10514 | ✗ | set_doorstate(dir); | |
| 10515 | 195 | } | |
| 10516 | |||
| 10517 | 811 | action=none; FFCore.setHeroAction(none); | |
| 10518 | 811 | attackclk = 0; | |
| 10519 | 811 | stepforward(29, true); | |
| 10520 | 811 | action=scrolling; FFCore.setHeroAction(scrolling); | |
| 10521 | 811 | pushing=false; | |
| 10522 | 811 | } | |
| 10523 | 14145347 | } | |
| 10524 | |||
| 10525 |
5/6✓ Branch 0 taken 337353 times.
✓ Branch 1 taken 13834983 times.
✓ Branch 2 taken 334860 times.
✓ Branch 3 taken 2493 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 334860 times.
|
14172336 | if( game->get_life() <= (game->get_hp_per_heart()) && !(game->get_maxlife() <= (game->get_hp_per_heart())) && (heart_beep_timer > -3)) |
| 10526 | { | ||
| 10527 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 334860 times.
|
334860 | if(heart_beep) |
| 10528 | { | ||
| 10529 | ✗ | cont_sfx(QMisc.miscsfx[sfxLOWHEART]); | |
| 10530 | ✗ | } | |
| 10531 | else | ||
| 10532 | { | ||
| 10533 |
2/2✓ Branch 0 taken 334334 times.
✓ Branch 1 taken 526 times.
|
334860 | if ( heart_beep_timer == -1 ) |
| 10534 | { | ||
| 10535 | 526 | heart_beep_timer = 70; | |
| 10536 | 526 | } | |
| 10537 | |||
| 10538 |
2/2✓ Branch 0 taken 29533 times.
✓ Branch 1 taken 305327 times.
|
334860 | if ( heart_beep_timer > 0 ) |
| 10539 | { | ||
| 10540 | 29533 | --heart_beep_timer; | |
| 10541 | 29533 | cont_sfx(QMisc.miscsfx[sfxLOWHEART]); | |
| 10542 | 29533 | } | |
| 10543 | else | ||
| 10544 | { | ||
| 10545 | 305327 | stop_sfx(QMisc.miscsfx[sfxLOWHEART]); | |
| 10546 | } | ||
| 10547 | } | ||
| 10548 | 334860 | } | |
| 10549 | else | ||
| 10550 | { | ||
| 10551 |
2/2✓ Branch 0 taken 26809 times.
✓ Branch 1 taken 13816943 times.
|
13837476 | if ( heart_beep_timer > -2 ) |
| 10552 | { | ||
| 10553 | 13816943 | heart_beep_timer = -1; | |
| 10554 | 13816943 | stop_sfx(QMisc.miscsfx[sfxLOWHEART]); | |
| 10555 | 13816943 | } | |
| 10556 | } | ||
| 10557 | |||
| 10558 |
2/2✓ Branch 0 taken 14177195 times.
✓ Branch 1 taken 1417 times.
|
14178612 | if(rSbtn()) |
| 10559 | { | ||
| 10560 | 1417 | int32_t tmp_subscr_clk = frame; | |
| 10561 | |||
| 10562 | 1417 | int32_t save_type = 0; | |
| 10563 |
3/4✓ Branch 0 taken 1 times.
✓ Branch 1 taken 7 times.
✓ Branch 2 taken 1409 times.
✗ Branch 3 not taken.
|
1417 | switch(lsave) |
| 10564 | { | ||
| 10565 | case 0: | ||
| 10566 | { | ||
| 10567 |
2/2✓ Branch 0 taken 41 times.
✓ Branch 1 taken 1368 times.
|
1409 | if( FFCore.runScriptedActiveSusbcreen() ) |
| 10568 | { | ||
| 10569 | 41 | break; | |
| 10570 | } | ||
| 10571 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1368 times.
|
1368 | else if ( !stopSubscreenFalling() ) |
| 10572 | { | ||
| 10573 | 1368 | conveyclk=3; | |
| 10574 | 1368 | dosubscr(); | |
| 10575 | 1368 | newscr_clk += frame - tmp_subscr_clk; | |
| 10576 | 1368 | } | |
| 10577 | 1368 | break; | |
| 10578 | } | ||
| 10579 | |||
| 10580 | |||
| 10581 | case 2: | ||
| 10582 | ✗ | save_type = 1; | |
| 10583 | [[fallthrough]]; | ||
| 10584 | case 1: | ||
| 10585 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | if(last_savepoint_id) |
| 10586 | 7 | trigger_save(combobuf[last_savepoint_id]); | |
| 10587 | ✗ | else save_game((tmpscr->flags4&fSAVEROOM) != 0, save_type); //sanity? | |
| 10588 | 7 | break; | |
| 10589 | } | ||
| 10590 | 1417 | } | |
| 10591 | |||
| 10592 |
2/2✓ Branch 0 taken 809162 times.
✓ Branch 1 taken 13369448 times.
|
14178610 | if (!checkstab() ) |
| 10593 | { | ||
| 10594 | /* | ||
| 10595 | for(int32_t q=0; q<176; q++) | ||
| 10596 | { | ||
| 10597 | set_bit(screengrid,q,0); | ||
| 10598 | } | ||
| 10599 | |||
| 10600 | for(int32_t q=0; q<MAXFFCS; q++) | ||
| 10601 | set_bit(ffcgrid, q, 0); | ||
| 10602 | */ | ||
| 10603 | 13369448 | } | |
| 10604 | |||
| 10605 | 14178610 | check_conveyor(); | |
| 10606 | 14178610 | PhantomsCleanup(); | |
| 10607 | //Try to time the hammer pound so that Hero can;t change direction while it occurs. | ||
| 10608 |
2/2✓ Branch 0 taken 13975281 times.
✓ Branch 1 taken 203329 times.
|
14178610 | if(attack==wHammer) |
| 10609 | { | ||
| 10610 |
6/8✓ Branch 0 taken 2170 times.
✓ Branch 1 taken 201159 times.
✓ Branch 2 taken 2170 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2170 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5 times.
✓ Branch 7 taken 2165 times.
|
203329 | if(attackclk==12 && z==0 && fakez==0 && sideviewhammerpound()) |
| 10611 | { | ||
| 10612 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 341 times.
✓ Branch 2 taken 508 times.
✓ Branch 3 taken 715 times.
✓ Branch 4 taken 601 times.
|
2165 | switch(dir) //Hero's dir |
| 10613 | { | ||
| 10614 | case up: | ||
| 10615 |
5/10✓ Branch 0 taken 341 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 341 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 341 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 341 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 341 times.
✗ Branch 9 not taken.
|
341 | decorations.add(new dHammerSmack(x-1, y-4, dHAMMERSMACK, 0)); |
| 10616 | 341 | break; | |
| 10617 | |||
| 10618 | case down: | ||
| 10619 |
5/10✓ Branch 0 taken 508 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 508 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 508 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 508 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 508 times.
✗ Branch 9 not taken.
|
508 | decorations.add(new dHammerSmack(x+8, y+28, dHAMMERSMACK, 0)); |
| 10620 | 508 | break; | |
| 10621 | |||
| 10622 | case left: | ||
| 10623 |
5/10✓ Branch 0 taken 715 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 715 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 715 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 715 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 715 times.
✗ Branch 9 not taken.
|
715 | decorations.add(new dHammerSmack(x-13, y+14, dHAMMERSMACK, 0)); |
| 10624 | 715 | break; | |
| 10625 | |||
| 10626 | case right: | ||
| 10627 |
5/10✓ Branch 0 taken 601 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 601 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 601 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 601 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 601 times.
✗ Branch 9 not taken.
|
601 | decorations.add(new dHammerSmack(x+21, y+14, dHAMMERSMACK, 0)); |
| 10628 | 601 | break; | |
| 10629 | } | ||
| 10630 | |||
| 10631 | 2165 | } | |
| 10632 | 203329 | } | |
| 10633 | |||
| 10634 | 14178610 | handleSpotlights(); | |
| 10635 | |||
| 10636 |
1/2✓ Branch 0 taken 14178610 times.
✗ Branch 1 not taken.
|
14178610 | if(getOnSideviewLadder()) |
| 10637 | { | ||
| 10638 | ✗ | if(!canSideviewLadder() || jumping<0 || fall!=0 || fakefall!=0) | |
| 10639 | { | ||
| 10640 | ✗ | setOnSideviewLadder(false); | |
| 10641 | ✗ | } | |
| 10642 | ✗ | else if(CANFORCEFACEUP) | |
| 10643 | { | ||
| 10644 | ✗ | setDir(up); | |
| 10645 | ✗ | } | |
| 10646 | ✗ | } | |
| 10647 |
2/2✓ Branch 0 taken 13921005 times.
✓ Branch 1 taken 257605 times.
|
14178610 | if (justmoved > 0) --justmoved; |
| 10648 | 14178610 | return false; | |
| 10649 | 14180235 | } | |
| 10650 | |||
| 10651 | 5284 | bool HeroClass::push_pixel(zfix dx, zfix dy) | |
| 10652 | { | ||
| 10653 | ASSERT(abs(dx) <= 1 && abs(dy) <= 1); | ||
| 10654 |
3/4✓ Branch 0 taken 2332 times.
✓ Branch 1 taken 2952 times.
✓ Branch 2 taken 2332 times.
✗ Branch 3 not taken.
|
5284 | if(dx && dy) |
| 10655 | { | ||
| 10656 | ✗ | bool r = push_pixel(0,dy); | |
| 10657 | ✗ | bool r2 = push_pixel(dx,0); | |
| 10658 | ✗ | return r && r2; | |
| 10659 | } | ||
| 10660 |
2/2✓ Branch 0 taken 1072 times.
✓ Branch 1 taken 4212 times.
|
5284 | if(dx < 0) |
| 10661 | { | ||
| 10662 |
1/2✓ Branch 0 taken 1072 times.
✗ Branch 1 not taken.
|
2144 | if(!(solpush_walkflag(x+dx,y+(bigHitbox?0:8),1,this) |
| 10663 |
1/2✓ Branch 0 taken 1072 times.
✗ Branch 1 not taken.
|
1072 | || solpush_walkflag(x+dx,y+8,1,this) |
| 10664 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 1072 times.
✓ Branch 2 taken 950 times.
✓ Branch 3 taken 122 times.
|
1072 | || (y.getInt()&7?solpush_walkflag(x+dx,y+16,1,this):0))) |
| 10665 | { | ||
| 10666 | 1072 | x += dx; | |
| 10667 | 1072 | return true; | |
| 10668 | } | ||
| 10669 | ✗ | return false; | |
| 10670 | } | ||
| 10671 |
2/2✓ Branch 0 taken 1260 times.
✓ Branch 1 taken 2952 times.
|
4212 | else if(dx > 0) |
| 10672 | { | ||
| 10673 |
2/2✓ Branch 0 taken 1224 times.
✓ Branch 1 taken 36 times.
|
2504 | if(!(solpush_walkflag(x+15+dx,y+(bigHitbox?0:8),1,this) |
| 10674 |
2/2✓ Branch 0 taken 1244 times.
✓ Branch 1 taken 16 times.
|
1260 | || solpush_walkflag(x+15+dx,y+8,1,this) |
| 10675 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 1244 times.
✓ Branch 2 taken 1037 times.
✓ Branch 3 taken 207 times.
|
1244 | || (y.getInt()&7?solpush_walkflag(x+15+dx,y+16,1,this):0))) |
| 10676 | { | ||
| 10677 | 1224 | x += dx; | |
| 10678 | 1224 | return true; | |
| 10679 | } | ||
| 10680 | 36 | return false; | |
| 10681 | } | ||
| 10682 |
2/2✓ Branch 0 taken 1378 times.
✓ Branch 1 taken 1574 times.
|
2952 | else if(dy < 0) |
| 10683 | { | ||
| 10684 |
2/2✓ Branch 0 taken 1377 times.
✓ Branch 1 taken 1 times.
|
2755 | if(!(solpush_walkflag(x,y+(bigHitbox?0:8)+dy,2,this) |
| 10685 |
4/4✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1377 times.
✓ Branch 2 taken 1169 times.
✓ Branch 3 taken 208 times.
|
1378 | || (x.getInt()&7?solpush_walkflag(x+16,y+(bigHitbox?0:8)+dy,1,this):0))) |
| 10686 | { | ||
| 10687 | 1377 | y += dy; | |
| 10688 | 1377 | return true; | |
| 10689 | } | ||
| 10690 | 1 | return false; | |
| 10691 | } | ||
| 10692 |
1/2✓ Branch 0 taken 1574 times.
✗ Branch 1 not taken.
|
1574 | else if(dy > 0) |
| 10693 | { | ||
| 10694 |
2/2✓ Branch 0 taken 1544 times.
✓ Branch 1 taken 30 times.
|
3118 | if(!(solpush_walkflag(x,y+15+dy,2,this) |
| 10695 |
4/4✓ Branch 0 taken 30 times.
✓ Branch 1 taken 1544 times.
✓ Branch 2 taken 190 times.
✓ Branch 3 taken 1354 times.
|
1574 | || (x.getInt()&7?solpush_walkflag(x+16,y+15+dy,1,this):0))) |
| 10696 | { | ||
| 10697 | 1544 | y += dy; | |
| 10698 | 1544 | return true; | |
| 10699 | } | ||
| 10700 | 30 | return false; | |
| 10701 | } | ||
| 10702 | ✗ | return false; | |
| 10703 | 5284 | } | |
| 10704 | 2509 | int32_t HeroClass::push_move(zfix dx, zfix dy) | |
| 10705 | { | ||
| 10706 | 2509 | int32_t ret = 0; | |
| 10707 |
4/4✓ Branch 0 taken 2332 times.
✓ Branch 1 taken 3579 times.
✓ Branch 2 taken 2509 times.
✓ Branch 3 taken 3402 times.
|
5911 | while(dx || dy) |
| 10708 | { | ||
| 10709 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3402 times.
|
3402 | if(check_pitslide() != -1) |
| 10710 | ✗ | break; | |
| 10711 |
2/2✓ Branch 0 taken 450 times.
✓ Branch 1 taken 2952 times.
|
3402 | if(dy) |
| 10712 | { | ||
| 10713 |
2/2✓ Branch 0 taken 724 times.
✓ Branch 1 taken 2228 times.
|
2952 | zfix cy = (abs(dy) >= 1) ? sign(dy) : dy; |
| 10714 | 2952 | dy -= cy; | |
| 10715 |
2/2✓ Branch 0 taken 2921 times.
✓ Branch 1 taken 31 times.
|
2952 | if(!push_pixel(0,cy)) |
| 10716 | { | ||
| 10717 | 31 | dy = 0; | |
| 10718 | 31 | ret |= 2; | |
| 10719 | 31 | } | |
| 10720 | 2952 | } | |
| 10721 |
2/2✓ Branch 0 taken 1070 times.
✓ Branch 1 taken 2332 times.
|
3402 | if(dx) |
| 10722 | { | ||
| 10723 |
2/2✓ Branch 0 taken 555 times.
✓ Branch 1 taken 1777 times.
|
2332 | zfix cx = (abs(dx) >= 1) ? sign(dx) : dx; |
| 10724 | 2332 | dx -= cx; | |
| 10725 |
2/2✓ Branch 0 taken 2296 times.
✓ Branch 1 taken 36 times.
|
2332 | if(!push_pixel(cx,0)) |
| 10726 | { | ||
| 10727 | 36 | dx = 0; | |
| 10728 | 36 | ret |= 1; | |
| 10729 | 36 | } | |
| 10730 | 2332 | } | |
| 10731 | } | ||
| 10732 | 2509 | return ret; | |
| 10733 | } | ||
| 10734 | |||
| 10735 | 14153143 | bool HeroClass::setSolid(bool set) | |
| 10736 | { | ||
| 10737 |
1/2✓ Branch 0 taken 14153143 times.
✗ Branch 1 not taken.
|
14153143 | bool actual = set && !toogam; //not solid when noclipping |
| 10738 | 14153143 | bool ret = solid_object::setSolid(actual); | |
| 10739 | 14153143 | solid = set; | |
| 10740 | 14153143 | return ret; | |
| 10741 | } | ||
| 10742 | |||
| 10743 | 18082 | void HeroClass::solid_push(solid_object* obj) | |
| 10744 | { | ||
| 10745 |
1/2✓ Branch 0 taken 18082 times.
✗ Branch 1 not taken.
|
18082 | if(obj == this) return; //can't push self |
| 10746 | |||
| 10747 | 18082 | zfix dx, dy; | |
| 10748 | 18082 | int32_t hdir = -1; | |
| 10749 | 18082 | solid_push_int(obj,dx,dy,hdir,!on_ffc_platform()); | |
| 10750 | |||
| 10751 |
4/4✓ Branch 0 taken 17992 times.
✓ Branch 1 taken 90 times.
✓ Branch 2 taken 17756 times.
✓ Branch 3 taken 236 times.
|
18082 | if(!dx && !dy) return; |
| 10752 | |||
| 10753 | 326 | obj->doContactDamage(hdir); | |
| 10754 | |||
| 10755 | 326 | bool t = obj->getTempNonsolid(); | |
| 10756 | 326 | obj->setTempNonsolid(true); | |
| 10757 | |||
| 10758 | 326 | push_move(dx,dy); | |
| 10759 | |||
| 10760 | 326 | obj->setTempNonsolid(t); | |
| 10761 | 18082 | } | |
| 10762 | |||
| 10763 | #define COND_AWPN (get_qr(qr_SELECTAWPN) ? game->awpn : 255) | ||
| 10764 | #define COND_BWPN (game->bwpn) | ||
| 10765 | #define COND_XWPN (get_qr(qr_SET_XBUTTON_ITEMS) ? game->xwpn : 255) | ||
| 10766 | #define COND_YWPN (get_qr(qr_SET_YBUTTON_ITEMS) ? game->ywpn : 255) | ||
| 10767 | //Helper function | ||
| 10768 | 1327 | static void deselectbombsWPN(word& wpos, int32_t& BTNwpn, int32_t& directItemBTN, | |
| 10769 | word f1 = 255, word f2 = 255, word f3 = 255) | ||
| 10770 | { | ||
| 10771 | 1327 | byte pgn = wpos&0xFF, pos = wpos>>8; | |
| 10772 | 1327 | bool empty = pgn==255; | |
| 10773 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1327 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1327 | if(empty && get_qr(qr_NO_BUTTON_VERIFY)) return; //intentional nothingness |
| 10774 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1327 times.
|
1327 | SubscrPage* pg = new_subscreen_active->get_page(pgn==255?new_subscreen_active->curpage:pgn); |
| 10775 |
1/2✓ Branch 0 taken 1327 times.
✗ Branch 1 not taken.
|
1327 | if(!pg) |
| 10776 | { | ||
| 10777 | ✗ | wpos = 255; //set to nothingness | |
| 10778 | ✗ | return; | |
| 10779 | } | ||
| 10780 | |||
| 10781 |
4/6✓ Branch 0 taken 1306 times.
✓ Branch 1 taken 21 times.
✓ Branch 2 taken 21 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 21 times.
✗ Branch 5 not taken.
|
1327 | auto fp1 = ((f1&0xFF)==255) ? 255 : ((empty || (f1&0xFF)==(wpos&0xFF)) ? f1 : 255); |
| 10782 |
1/6✓ Branch 0 taken 1327 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1327 | auto fp2 = ((f2&0xFF)==255) ? 255 : ((empty || (f2&0xFF)==(wpos&0xFF)) ? f2 : 255); |
| 10783 |
1/6✓ Branch 0 taken 1327 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1327 | auto fp3 = ((f3&0xFF)==255) ? 255 : ((empty || (f3&0xFF)==(wpos&0xFF)) ? f3 : 255); |
| 10784 | 1327 | auto temp = pg->movepos_legacy(SEL_VERIFY_LEFT, wpos, fp1, fp2, fp3); | |
| 10785 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1327 times.
|
1327 | if((temp&0xFF) == 0xFF) |
| 10786 | ✗ | BTNwpn = -1; | |
| 10787 | 1327 | else BTNwpn = pg->get_item_pos(temp>>8); | |
| 10788 |
2/2✓ Branch 0 taken 1325 times.
✓ Branch 1 taken 2 times.
|
1327 | directItemBTN = NEG_OR_MASK(BTNwpn,0xFFF); |
| 10789 | 1327 | wpos = temp; | |
| 10790 | 1327 | } | |
| 10791 | // A routine used exclusively by startwpn, | ||
| 10792 | // to switch Hero's weapon if his current weapon (bombs) was depleted. | ||
| 10793 | 1373 | void HeroClass::deselectbombs(int32_t super) | |
| 10794 | { | ||
| 10795 |
6/10✓ Branch 0 taken 1344 times.
✓ Branch 1 taken 29 times.
✓ Branch 2 taken 1344 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1344 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1344 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1344 times.
|
1373 | if ( get_qr(qr_NEVERDISABLEAMMOONSUBSCREEN) || itemsbuf[game->forced_awpn].family == itype_bomb || itemsbuf[game->forced_bwpn].family == itype_bomb || itemsbuf[game->forced_xwpn].family == itype_bomb || itemsbuf[game->forced_ywpn].family == itype_bomb) return; |
| 10796 |
4/6✓ Branch 0 taken 1327 times.
✓ Branch 1 taken 17 times.
✓ Branch 2 taken 1327 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1327 times.
✗ Branch 5 not taken.
|
1344 | if(getItemFamily(itemsbuf,Bwpn)==(super? itype_sbomb : itype_bomb) && (directWpn<0 || Bwpn==directWpn)) |
| 10797 | { | ||
| 10798 |
1/2✓ Branch 0 taken 1327 times.
✗ Branch 1 not taken.
|
1327 | if(!new_subscreen_active) |
| 10799 | ✗ | return; | |
| 10800 |
4/6✓ Branch 0 taken 21 times.
✓ Branch 1 taken 1306 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1327 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1327 times.
|
1327 | deselectbombsWPN(game->bwpn, Bwpn, directItemB, COND_AWPN, COND_XWPN, COND_YWPN); |
| 10801 | 1327 | } | |
| 10802 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
17 | else if (getItemFamily(itemsbuf,Xwpn)==(super? itype_sbomb : itype_bomb) && (directWpn<0 || Xwpn==directWpn)) |
| 10803 | { | ||
| 10804 | ✗ | if(!new_subscreen_active) | |
| 10805 | ✗ | return; | |
| 10806 | ✗ | deselectbombsWPN(game->xwpn, Xwpn, directItemX, COND_AWPN, COND_BWPN, COND_YWPN); | |
| 10807 | ✗ | } | |
| 10808 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
17 | else if (getItemFamily(itemsbuf,Ywpn)==(super? itype_sbomb : itype_bomb) && (directWpn<0 || Ywpn==directWpn)) |
| 10809 | { | ||
| 10810 | ✗ | if(!new_subscreen_active) | |
| 10811 | ✗ | return; | |
| 10812 | ✗ | deselectbombsWPN(game->ywpn, Ywpn, directItemY, COND_AWPN, COND_XWPN, COND_BWPN); | |
| 10813 | ✗ | } | |
| 10814 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
17 | else if (getItemFamily(itemsbuf,Awpn)==(super? itype_sbomb : itype_bomb) && (directWpn<0 || Awpn==directWpn)) |
| 10815 | { | ||
| 10816 | ✗ | if(!new_subscreen_active) | |
| 10817 | ✗ | return; | |
| 10818 | ✗ | deselectbombsWPN(game->awpn, Awpn, directItemA, COND_BWPN, COND_XWPN, COND_YWPN); | |
| 10819 | ✗ | } | |
| 10820 | 1373 | } | |
| 10821 | |||
| 10822 | int32_t potion_life=0; | ||
| 10823 | int32_t potion_magic=0; | ||
| 10824 | |||
| 10825 | 13547593 | bool HeroClass::onWater(bool drownonly) | |
| 10826 | { | ||
| 10827 | 13547593 | int32_t water = 0; | |
| 10828 | 13547593 | int32_t types[4] = {0}; | |
| 10829 | 13547593 | int32_t x1 = x+4, x2 = x+11, | |
| 10830 | 13547593 | y1 = y+9, y2 = y+15; | |
| 10831 |
2/2✓ Branch 0 taken 1044693 times.
✓ Branch 1 taken 12502900 times.
|
13547593 | if (get_qr(qr_SMARTER_WATER)) |
| 10832 | { | ||
| 10833 |
4/4✓ Branch 0 taken 10733 times.
✓ Branch 1 taken 1033960 times.
✓ Branch 2 taken 22 times.
✓ Branch 3 taken 8349 times.
|
1053064 | if (iswaterex(0, currmap, currscr, -1, x1, y1, true, false) && |
| 10834 |
2/2✓ Branch 0 taken 9619 times.
✓ Branch 1 taken 1114 times.
|
10733 | iswaterex(0, currmap, currscr, -1, x1, y2, true, false) && |
| 10835 |
2/2✓ Branch 0 taken 8371 times.
✓ Branch 1 taken 1248 times.
|
9619 | iswaterex(0, currmap, currscr, -1, x2, y1, true, false) && |
| 10836 | 8371 | iswaterex(0, currmap, currscr, -1, x2, y2, true, false)) water = iswaterex(0, currmap, currscr, -1, (x2+x1)/2,(y2+y1)/2, true, false); | |
| 10837 | 1044693 | } | |
| 10838 | else | ||
| 10839 | { | ||
| 10840 | 12502900 | types[0] = COMBOTYPE(x1,y1); | |
| 10841 | |||
| 10842 |
2/2✓ Branch 0 taken 12382318 times.
✓ Branch 1 taken 120582 times.
|
12502900 | if(MAPFFCOMBO(x1,y1)) |
| 10843 | 120582 | types[0] = FFCOMBOTYPE(x1,y1); | |
| 10844 | |||
| 10845 | 12502900 | types[1] = COMBOTYPE(x1,y2); | |
| 10846 | |||
| 10847 |
2/2✓ Branch 0 taken 12396880 times.
✓ Branch 1 taken 106020 times.
|
12502900 | if(MAPFFCOMBO(x1,y2)) |
| 10848 | 106020 | types[1] = FFCOMBOTYPE(x1,y2); | |
| 10849 | |||
| 10850 | 12502900 | types[2] = COMBOTYPE(x2,y1); | |
| 10851 | |||
| 10852 |
2/2✓ Branch 0 taken 12381277 times.
✓ Branch 1 taken 121623 times.
|
12502900 | if(MAPFFCOMBO(x2,y1)) |
| 10853 | 121623 | types[2] = FFCOMBOTYPE(x2,y1); | |
| 10854 | |||
| 10855 | 12502900 | types[3] = COMBOTYPE(x2,y2); | |
| 10856 | |||
| 10857 |
2/2✓ Branch 0 taken 12393950 times.
✓ Branch 1 taken 108950 times.
|
12502900 | if(MAPFFCOMBO(x2,y2)) |
| 10858 | 108950 | types[3] = FFCOMBOTYPE(x2,y2); | |
| 10859 | |||
| 10860 | 12502900 | int32_t typec = COMBOTYPE((x2+x1)/2,(y2+y1)/2); | |
| 10861 |
2/2✓ Branch 0 taken 12387762 times.
✓ Branch 1 taken 115138 times.
|
12502900 | if(MAPFFCOMBO((x2+x1)/2,(y2+y1)/2)) |
| 10862 | 115138 | typec = FFCOMBOTYPE((x2+x1)/2,(y2+y1)/2); | |
| 10863 | |||
| 10864 |
5/6✓ Branch 0 taken 223042 times.
✓ Branch 1 taken 12279858 times.
✓ Branch 2 taken 214266 times.
✓ Branch 3 taken 8776 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 205928 times.
|
12708828 | if(combo_class_buf[types[0]].water && combo_class_buf[types[1]].water && |
| 10865 |
4/4✓ Branch 0 taken 206169 times.
✓ Branch 1 taken 8097 times.
✓ Branch 2 taken 205928 times.
✓ Branch 3 taken 241 times.
|
214266 | combo_class_buf[types[2]].water && combo_class_buf[types[3]].water && combo_class_buf[typec].water) |
| 10866 | 205928 | water = typec; | |
| 10867 | } | ||
| 10868 |
2/2✓ Branch 0 taken 13333316 times.
✓ Branch 1 taken 214277 times.
|
13547593 | if(water > 0) |
| 10869 | { | ||
| 10870 |
1/2✓ Branch 0 taken 214277 times.
✗ Branch 1 not taken.
|
214277 | if(!drownonly) return true; |
| 10871 |
7/8✓ Branch 0 taken 139216 times.
✓ Branch 1 taken 75061 times.
✓ Branch 2 taken 139213 times.
✓ Branch 3 taken 3 times.
✓ Branch 4 taken 2249 times.
✓ Branch 5 taken 136964 times.
✓ Branch 6 taken 2249 times.
✗ Branch 7 not taken.
|
214277 | if(current_item(itype_flippers) <= 0 || current_item(itype_flippers) < combobuf[water].attribytes[0] || ((combobuf[water].usrflags&cflag1) && !(itemsbuf[current_item_id(itype_flippers)].flags & item_flag3))) |
| 10872 | { | ||
| 10873 | 75064 | return true; | |
| 10874 | } | ||
| 10875 | 139213 | } | |
| 10876 | 13472529 | return false; | |
| 10877 | 13547593 | } | |
| 10878 | |||
| 10879 | ✗ | bool HeroClass::mirrorBonk() | |
| 10880 | { | ||
| 10881 | ✗ | zfix tx = x, ty = y, tz = z; | |
| 10882 | ✗ | WalkflagInfo info = walkflag(x,y+(bigHitbox?0:8),2,up); | |
| 10883 | ✗ | info = info || walkflagMBlock(x+8,y+(bigHitbox?0:8)); | |
| 10884 | ✗ | execute(info); | |
| 10885 | ✗ | bool fail = info.isUnwalkable(); | |
| 10886 | |||
| 10887 | ✗ | if(!fail) //not solid, but check for water/pits... | |
| 10888 | { | ||
| 10889 | ✗ | if(onWater(true)) | |
| 10890 | ✗ | fail = true; | |
| 10891 | ✗ | if(pitslide() || fallclk) | |
| 10892 | ✗ | fail = true; | |
| 10893 | ✗ | fallclk = 0; | |
| 10894 | ✗ | } | |
| 10895 | ✗ | x = tx; y = ty; z = tz; | |
| 10896 | ✗ | return fail; | |
| 10897 | } | ||
| 10898 | |||
| 10899 | ✗ | void HeroClass::doMirror(int32_t mirrorid) | |
| 10900 | { | ||
| 10901 | ✗ | if(z > 0 || fakez > 0) return; //No mirror in air | |
| 10902 | ✗ | if(mirrorid < 0) | |
| 10903 | ✗ | mirrorid = current_item_id(itype_mirror); | |
| 10904 | ✗ | if(mirrorid < 0) return; | |
| 10905 | |||
| 10906 | ✗ | if((tmpscr->flags9&fDISABLE_MIRROR) || !(checkbunny(mirrorid) && checkmagiccost(mirrorid))) | |
| 10907 | { | ||
| 10908 | ✗ | item_error(); | |
| 10909 | ✗ | return; | |
| 10910 | } | ||
| 10911 | static const int32_t sens = 4; //sensitivity of 'No Mirror' combos (0 most, 8 least) | ||
| 10912 | ✗ | int32_t posarr[] = {COMBOPOS(x+sens,y+sens), COMBOPOS(x+sens,y+15-sens), | |
| 10913 | ✗ | COMBOPOS(x+15-sens,y+sens), COMBOPOS(x+15-sens,y+15-sens)}; | |
| 10914 | ✗ | for(auto pos : posarr) | |
| 10915 | { | ||
| 10916 | ✗ | if(HASFLAG_ANY(mfNOMIRROR, pos)) //"No Mirror" flag touching the player | |
| 10917 | { | ||
| 10918 | ✗ | item_error(); | |
| 10919 | ✗ | return; | |
| 10920 | } | ||
| 10921 | } | ||
| 10922 | |||
| 10923 | ✗ | itemdata const& mirror = itemsbuf[mirrorid]; | |
| 10924 | ✗ | if(DMaps[currdmap].flags & dmfMIRRORCONTINUE) | |
| 10925 | { | ||
| 10926 | ✗ | paymagiccost(mirrorid); | |
| 10927 | ✗ | if(mirror.usesound2) sfx(mirror.usesound2); | |
| 10928 | |||
| 10929 | ✗ | doWarpEffect(mirror.misc2, true); | |
| 10930 | ✗ | if(mirror.flags & item_flag2) //Act as F6->Continue | |
| 10931 | { | ||
| 10932 | ✗ | Quit = qCONT; | |
| 10933 | ✗ | skipcont = 1; | |
| 10934 | ✗ | } | |
| 10935 | else //Act as Divine Escape | ||
| 10936 | { | ||
| 10937 | ✗ | int32_t div_prot_temp=div_prot_item; | |
| 10938 | ✗ | restart_level(); | |
| 10939 | ✗ | div_prot_item=div_prot_temp; | |
| 10940 | ✗ | magicitem=-1; | |
| 10941 | ✗ | magiccastclk=0; | |
| 10942 | ✗ | if ( Hero.getDontDraw() < 2 ) { Hero.setDontDraw(0); } | |
| 10943 | } | ||
| 10944 | ✗ | } | |
| 10945 | else | ||
| 10946 | { | ||
| 10947 | ✗ | int32_t destdmap = DMaps[currdmap].mirrorDMap; | |
| 10948 | ✗ | int32_t offscr = currscr - DMaps[currdmap].xoff; | |
| 10949 | ✗ | if(destdmap < 0) | |
| 10950 | ✗ | return; | |
| 10951 | ✗ | int32_t destscr = DMaps[destdmap].xoff + offscr; | |
| 10952 | ✗ | if((offscr%16 != destscr%16) || unsigned(destscr) >= 0x80) | |
| 10953 | ✗ | return; | |
| 10954 | ✗ | paymagiccost(mirrorid); | |
| 10955 | |||
| 10956 | //Store some values to restore if 'warp fails' | ||
| 10957 | ✗ | int32_t tLastEntrance = lastentrance, | |
| 10958 | ✗ | tLastEntranceDMap = lastentrance_dmap, | |
| 10959 | ✗ | tContScr = game->get_continue_scrn(), | |
| 10960 | ✗ | tContDMap = game->get_continue_dmap(), | |
| 10961 | ✗ | tPortalDMap = game->saved_mirror_portal.srcdmap; | |
| 10962 | ✗ | int32_t sourcescr = currscr, sourcedmap = currdmap; | |
| 10963 | ✗ | zfix tx = x, ty = y, tz = z; | |
| 10964 | ✗ | game->saved_mirror_portal.srcdmap = -1; | |
| 10965 | ✗ | action = none; FFCore.setHeroAction(none); | |
| 10966 | |||
| 10967 | //Warp to new dmap | ||
| 10968 | ✗ | FFCore.warp_player(wtIWARP, destdmap, destscr, -1, -1, mirror.misc1, | |
| 10969 | ✗ | mirror.usesound, 0, -1); | |
| 10970 | |||
| 10971 | //Check for valid landing location | ||
| 10972 | ✗ | if(mirrorBonk()) //Invalid landing, warp back! | |
| 10973 | { | ||
| 10974 | ✗ | action = none; FFCore.setHeroAction(none); | |
| 10975 | ✗ | lastentrance = tLastEntrance; | |
| 10976 | ✗ | lastentrance_dmap = tLastEntranceDMap; | |
| 10977 | ✗ | game->set_continue_scrn(tContScr); | |
| 10978 | ✗ | game->set_continue_dmap(tContDMap); | |
| 10979 | ✗ | x = tx; | |
| 10980 | ✗ | y = ty; | |
| 10981 | ✗ | z = tz; | |
| 10982 | ✗ | game->saved_mirror_portal.srcdmap = tPortalDMap; | |
| 10983 | ✗ | FFCore.warp_player(wtIWARP, sourcedmap, sourcescr, -1, -1, mirror.misc1, | |
| 10984 | ✗ | mirror.usesound, 0, -1); | |
| 10985 | ✗ | } | |
| 10986 | ✗ | else if(mirror.flags & item_flag1) //Place portal! | |
| 10987 | { | ||
| 10988 | //Place the portal | ||
| 10989 | ✗ | game->set_portal(sourcedmap, destdmap, offscr, x.getZLong(), y.getZLong(), mirror.usesound, mirror.misc1, mirror.wpn); | |
| 10990 | //Since it was placed after loading this screen, load the portal object now | ||
| 10991 | ✗ | game->load_portal(); | |
| 10992 | //Don't immediately trigger the warp back | ||
| 10993 | ✗ | mirror_portal.prox_active = false; | |
| 10994 | |||
| 10995 | //Set continue point | ||
| 10996 | ✗ | if(currdmap != game->get_continue_dmap()) | |
| 10997 | { | ||
| 10998 | ✗ | game->set_continue_scrn(DMaps[currdmap].cont + DMaps[currdmap].xoff); | |
| 10999 | ✗ | } | |
| 11000 | ✗ | game->set_continue_dmap(currdmap); | |
| 11001 | ✗ | lastentrance_dmap = currdmap; | |
| 11002 | ✗ | lastentrance = game->get_continue_scrn(); | |
| 11003 | ✗ | } | |
| 11004 | } | ||
| 11005 | ✗ | } | |
| 11006 | |||
| 11007 | 14151814 | void HeroClass::handle_passive_buttons() | |
| 11008 | { | ||
| 11009 | 14151814 | do_liftglove(-1,true); | |
| 11010 | 14151814 | do_jump(-1,true); | |
| 11011 | 14151814 | } | |
| 11012 | |||
| 11013 | static bool did_passive_jump = false; | ||
| 11014 | 14152183 | bool HeroClass::do_jump(int32_t jumpid, bool passive) | |
| 11015 | { | ||
| 11016 |
2/2✓ Branch 0 taken 369 times.
✓ Branch 1 taken 14151814 times.
|
14152183 | if(passive) did_passive_jump = false; |
| 11017 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 369 times.
|
369 | else if(did_passive_jump) return false; //don't jump twice in the same frame |
| 11018 | |||
| 11019 |
2/2✓ Branch 0 taken 604590 times.
✓ Branch 1 taken 13547593 times.
|
14152183 | if(nomove_action(action)) return false; //can't jump while ex. drowning |
| 11020 |
2/2✓ Branch 0 taken 75064 times.
✓ Branch 1 taken 13472529 times.
|
13547593 | if(onWater(true)) return false; //Don't allow jumping off of water frame-perfectly... |
| 11021 | |||
| 11022 |
2/2✓ Branch 0 taken 367 times.
✓ Branch 1 taken 13472162 times.
|
13472529 | if(jumpid < 0) |
| 11023 | 13472162 | jumpid = current_item_id(itype_rocs,true,true); | |
| 11024 | |||
| 11025 |
2/2✓ Branch 0 taken 13133940 times.
✓ Branch 1 taken 338589 times.
|
13472529 | if(unsigned(jumpid) >= MAXITEMS) return false; |
| 11026 |
4/4✓ Branch 0 taken 337362 times.
✓ Branch 1 taken 1227 times.
✓ Branch 2 taken 1935 times.
✓ Branch 3 taken 335427 times.
|
338589 | if(inlikelike || charging) return false; |
| 11027 |
1/2✓ Branch 0 taken 335427 times.
✗ Branch 1 not taken.
|
335427 | if(!checkitem_jinx(jumpid)) return false; |
| 11028 | |||
| 11029 | 335427 | itemdata const& itm = itemsbuf[jumpid]; | |
| 11030 | |||
| 11031 | 335427 | bool standing = isStanding(true); | |
| 11032 |
3/4✓ Branch 0 taken 321504 times.
✓ Branch 1 taken 13923 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 13923 times.
|
335427 | bool coyotejump = !standing && coyotetime < (zc_min(65535,itm.misc5)); |
| 11033 |
4/6✓ Branch 0 taken 335427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13923 times.
✓ Branch 3 taken 321504 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 13923 times.
|
335427 | if(!(coyotejump || standing || extra_jump_count < itm.misc1)) return false; |
| 11034 |
2/4✓ Branch 0 taken 321504 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 321504 times.
|
321504 | if(!(checkbunny(jumpid) && checkmagiccost(jumpid))) |
| 11035 | { | ||
| 11036 | ✗ | item_error(); | |
| 11037 | ✗ | return false; | |
| 11038 | } | ||
| 11039 | |||
| 11040 | 321504 | byte intbtn = byte(itm.misc2&0xFF); | |
| 11041 |
2/2✓ Branch 0 taken 352 times.
✓ Branch 1 taken 321152 times.
|
321504 | if(passive) |
| 11042 | { | ||
| 11043 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 321152 times.
|
321152 | if(!getIntBtnInput(intbtn, true, true, false, false, true)) |
| 11044 | 321152 | return false; //not pressed | |
| 11045 | ✗ | } | |
| 11046 | |||
| 11047 | 352 | paymagiccost(jumpid); | |
| 11048 | |||
| 11049 |
1/2✓ Branch 0 taken 352 times.
✗ Branch 1 not taken.
|
352 | if(!standing) |
| 11050 | { | ||
| 11051 | ✗ | ++extra_jump_count; | |
| 11052 | ✗ | fall = 0; | |
| 11053 | ✗ | fakefall = 0; | |
| 11054 | ✗ | if(hoverclk > 0) | |
| 11055 | ✗ | hoverclk = -hoverclk; | |
| 11056 | ✗ | } | |
| 11057 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 352 times.
|
352 | if(itm.flags & item_flag1) |
| 11058 | ✗ | setFall(fall - itm.power); | |
| 11059 | 352 | else setFall(fall - (FEATHERJUMP*(itm.power+2))); | |
| 11060 | 352 | coyotetime = 65535; //jumped, so no coyotetime | |
| 11061 | 352 | setOnSideviewLadder(false); | |
| 11062 | |||
| 11063 | // Reset the ladder, unless on an unwalkable combo | ||
| 11064 |
6/10✓ Branch 0 taken 351 times.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 351 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 352 times.
✗ Branch 9 not taken.
|
352 | if((ladderx || laddery) && !(_walkflag(ladderx,laddery,0,SWITCHBLOCK_STATE))) |
| 11065 | ✗ | reset_ladder(); | |
| 11066 | |||
| 11067 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 352 times.
|
352 | if(itm.usesound) |
| 11068 | 352 | sfx(itm.usesound,pan(x.getInt())); | |
| 11069 | |||
| 11070 |
1/2✓ Branch 0 taken 352 times.
✗ Branch 1 not taken.
|
352 | if(passive) |
| 11071 | { | ||
| 11072 | ✗ | did_passive_jump = true; | |
| 11073 | ✗ | getIntBtnInput(intbtn, true, true, false, false, false); //eat buttons | |
| 11074 | ✗ | } | |
| 11075 | 352 | return true; | |
| 11076 | 14152183 | } | |
| 11077 | 11519 | void HeroClass::drop_liftwpn() | |
| 11078 | { | ||
| 11079 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 11518 times.
|
11519 | if(!lift_wpn) return; |
| 11080 | |||
| 11081 | 1 | handle_lift(false); //sets position properly, accounting for large weapons | |
| 11082 | 1 | auto liftid = current_item_id(itype_liftglove,true,true); | |
| 11083 | 1 | itemdata const& glove = itemsbuf[liftid]; | |
| 11084 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if(isSideViewGravity()) |
| 11085 | { | ||
| 11086 | ✗ | lift_wpn->moveflags |= move_no_fake_z; | |
| 11087 | ✗ | } | |
| 11088 | else | ||
| 11089 | { | ||
| 11090 | 1 | auto lheight = liftheight+z+fakez; | |
| 11091 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if(glove.flags & item_flag1) |
| 11092 | { | ||
| 11093 | ✗ | lift_wpn->z = 0; | |
| 11094 | ✗ | lift_wpn->fakez = lheight; | |
| 11095 | ✗ | lift_wpn->moveflags |= move_no_real_z; | |
| 11096 | ✗ | } | |
| 11097 | else | ||
| 11098 | { | ||
| 11099 | 1 | lift_wpn->z = lheight; | |
| 11100 | 1 | lift_wpn->moveflags |= move_no_fake_z; | |
| 11101 | } | ||
| 11102 | } | ||
| 11103 | 1 | lift_wpn->dir = dir; | |
| 11104 | 1 | lift_wpn->step = 0; | |
| 11105 | 1 | lift_wpn->fakefall = 0; | |
| 11106 | 1 | lift_wpn->fall = 0; | |
| 11107 | 1 | Lwpns.add(lift_wpn); | |
| 11108 | 1 | lift_wpn = nullptr; | |
| 11109 | 11519 | } | |
| 11110 | 14151814 | void HeroClass::do_liftglove(int32_t liftid, bool passive) | |
| 11111 | { | ||
| 11112 |
2/2✓ Branch 0 taken 10406 times.
✓ Branch 1 taken 14141408 times.
|
14151814 | if(!lift_wpn) |
| 11113 | 14141408 | last_lift_id.reset(); | |
| 11114 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14151814 times.
|
14151814 | if(liftid < 0) |
| 11115 | { | ||
| 11116 |
4/4✓ Branch 0 taken 9569 times.
✓ Branch 1 taken 14142245 times.
✓ Branch 2 taken 689 times.
✓ Branch 3 taken 8880 times.
|
14151814 | if(last_lift_id && can_lift(*last_lift_id)) |
| 11117 | 8880 | liftid = *last_lift_id; | |
| 11118 | 14142934 | else liftid = current_item_id(itype_liftglove,true,true); | |
| 11119 | 14151814 | } | |
| 11120 |
2/2✓ Branch 0 taken 362622 times.
✓ Branch 1 taken 13789192 times.
|
14151814 | if(!can_lift(liftid)) return; |
| 11121 | 362622 | itemdata const& glove = itemsbuf[liftid]; | |
| 11122 | 362622 | byte intbtn = byte(glove.misc1&0xFF); | |
| 11123 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 362622 times.
|
362622 | if(passive) |
| 11124 | { | ||
| 11125 |
2/2✓ Branch 0 taken 2248 times.
✓ Branch 1 taken 360374 times.
|
362622 | if(!getIntBtnInput(intbtn, true, true, false, false, true)) |
| 11126 | 360374 | return; //not pressed | |
| 11127 | 2248 | } | |
| 11128 | |||
| 11129 | 2248 | bool had_weapon = lift_wpn; | |
| 11130 | |||
| 11131 |
3/4✓ Branch 0 taken 2187 times.
✓ Branch 1 taken 61 times.
✓ Branch 2 taken 2187 times.
✗ Branch 3 not taken.
|
4435 | if(!(had_weapon || //Allow throwing while bunnied/don't charge magic for throwing |
| 11132 |
1/2✓ Branch 0 taken 2187 times.
✗ Branch 1 not taken.
|
2187 | (checkbunny(liftid) && checkmagiccost(liftid)))) |
| 11133 | { | ||
| 11134 | ✗ | item_error(); | |
| 11135 | ✗ | return; | |
| 11136 | } | ||
| 11137 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 2248 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
2248 | if(glove.script!=0 && (FFCore.doscript(ScriptType::Item, liftid) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING))) |
| 11138 | ✗ | return; | |
| 11139 | |||
| 11140 | 2248 | bool paidmagic = had_weapon; //don't pay to throw, only to lift | |
| 11141 |
1/2✓ Branch 0 taken 2248 times.
✗ Branch 1 not taken.
|
2248 | if(glove.script) |
| 11142 | { | ||
| 11143 | ✗ | if(!paidmagic) | |
| 11144 | { | ||
| 11145 | ✗ | paidmagic = true; | |
| 11146 | ✗ | paymagiccost(liftid); | |
| 11147 | ✗ | } | |
| 11148 | |||
| 11149 | ✗ | int i = liftid; | |
| 11150 | ✗ | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 11151 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, glove.script, i); | |
| 11152 | ✗ | FFCore.deallocateAllScriptOwned(ScriptType::Item,i); | |
| 11153 | |||
| 11154 | ✗ | bool has_weapon = lift_wpn; | |
| 11155 | ✗ | if(has_weapon != had_weapon) //Item action script changed the lift information | |
| 11156 | { | ||
| 11157 | ✗ | if(passive) | |
| 11158 | { | ||
| 11159 | ✗ | getIntBtnInput(intbtn, true, true, false, false, false); //eat buttons | |
| 11160 | ✗ | } | |
| 11161 | ✗ | return; | |
| 11162 | } | ||
| 11163 | ✗ | } | |
| 11164 | |||
| 11165 |
2/2✓ Branch 0 taken 61 times.
✓ Branch 1 taken 2187 times.
|
2248 | if(lift_wpn) |
| 11166 | { | ||
| 11167 |
1/2✓ Branch 0 taken 61 times.
✗ Branch 1 not taken.
|
61 | if(!paidmagic) |
| 11168 | { | ||
| 11169 | ✗ | paidmagic = true; | |
| 11170 | ✗ | paymagiccost(liftid); | |
| 11171 | ✗ | } | |
| 11172 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 61 times.
|
61 | if(!liftclk) |
| 11173 | { | ||
| 11174 | //Throw the weapon! | ||
| 11175 | //hero's direction and position | ||
| 11176 | 61 | handle_lift(false); //sets position properly, accounting for large weapons | |
| 11177 | |||
| 11178 | 61 | lift_wpn->dir = dir; | |
| 11179 | //Configured throw speed in both axes | ||
| 11180 | 61 | auto basestep = glove.misc2; | |
| 11181 | 61 | lift_wpn->step = zfix(basestep)/100; | |
| 11182 | |||
| 11183 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 61 times.
|
61 | if(isSideViewGravity()) |
| 11184 | { | ||
| 11185 | ✗ | lift_wpn->fall = -glove.misc3; | |
| 11186 | ✗ | switch(dir) | |
| 11187 | { | ||
| 11188 | case left: case right: | ||
| 11189 | ✗ | break; //nothing special for sideways | |
| 11190 | case up: //step converts to upwards fall | ||
| 11191 | ✗ | lift_wpn->fall -= basestep; | |
| 11192 | ✗ | lift_wpn->step = 0; | |
| 11193 | ✗ | break; | |
| 11194 | case down: //step converts into straight down fall | ||
| 11195 | ✗ | lift_wpn->fall = zc_min(basestep,zinit.terminalv); | |
| 11196 | ✗ | lift_wpn->step = 0; | |
| 11197 | ✗ | break; | |
| 11198 | } | ||
| 11199 | ✗ | lift_wpn->moveflags |= move_no_fake_z; | |
| 11200 | ✗ | } | |
| 11201 | else | ||
| 11202 | { | ||
| 11203 | 61 | auto lheight = liftheight+z+fakez; | |
| 11204 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 61 times.
|
61 | if(glove.flags & item_flag1) |
| 11205 | { | ||
| 11206 | ✗ | lift_wpn->z = 0; | |
| 11207 | ✗ | lift_wpn->fakez = lheight; | |
| 11208 | ✗ | lift_wpn->fakefall = -glove.misc3; | |
| 11209 | ✗ | lift_wpn->moveflags |= move_no_real_z; | |
| 11210 | ✗ | } | |
| 11211 | else | ||
| 11212 | { | ||
| 11213 | 61 | lift_wpn->z = lheight; | |
| 11214 | 61 | lift_wpn->fall = -glove.misc3; | |
| 11215 | 61 | lift_wpn->moveflags |= move_no_fake_z; | |
| 11216 | } | ||
| 11217 | } | ||
| 11218 | 61 | Lwpns.add(lift_wpn); | |
| 11219 | 61 | lift_wpn = nullptr; | |
| 11220 | 61 | last_lift_id.reset(); | |
| 11221 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 61 times.
|
61 | if(glove.usesound2) |
| 11222 | 61 | sfx(glove.usesound2,pan(int32_t(x))); | |
| 11223 | 61 | } | |
| 11224 | ✗ | else last_lift_id = liftid; | |
| 11225 | |||
| 11226 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 61 times.
|
61 | if(passive) |
| 11227 | { | ||
| 11228 | 61 | getIntBtnInput(intbtn, true, true, false, false, false); //eat buttons | |
| 11229 | 61 | } | |
| 11230 | 61 | return; | |
| 11231 | } | ||
| 11232 | |||
| 11233 | 2187 | bool lifted = false; | |
| 11234 | //Check for a liftable weapon | ||
| 11235 | //if(!lifted) | ||
| 11236 | { | ||
| 11237 | 2187 | zfix hx, hy, hw, hh; | |
| 11238 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 340 times.
✓ Branch 2 taken 580 times.
✓ Branch 3 taken 670 times.
✓ Branch 4 taken 597 times.
|
2187 | switch(dir) |
| 11239 | { | ||
| 11240 | case up: | ||
| 11241 | 340 | hx = x; | |
| 11242 | 340 | hy = y-8; | |
| 11243 | 340 | hw = 16; | |
| 11244 | 340 | hh = bigHitbox ? 8 : 16; | |
| 11245 | 340 | break; | |
| 11246 | case down: | ||
| 11247 | 580 | hx = x; | |
| 11248 | 580 | hy = y+16; | |
| 11249 | 580 | hw = 16; | |
| 11250 | 580 | hh = 8; | |
| 11251 | 580 | break; | |
| 11252 | case left: | ||
| 11253 | 670 | hx = x-8; | |
| 11254 | 670 | hy = y; | |
| 11255 | 670 | hw = 8; | |
| 11256 | 670 | hh = 16; | |
| 11257 | 670 | break; | |
| 11258 | case right: | ||
| 11259 | 597 | hx = x+16; | |
| 11260 | 597 | hy = y; | |
| 11261 | 597 | hw = 8; | |
| 11262 | 597 | hh = 16; | |
| 11263 | 597 | break; | |
| 11264 | } | ||
| 11265 |
2/2✓ Branch 0 taken 2185 times.
✓ Branch 1 taken 113 times.
|
2298 | for(int32_t q = 0; q < Lwpns.Count(); ++q) |
| 11266 | { | ||
| 11267 | 113 | weapon* w = (weapon*)Lwpns.spr(q); | |
| 11268 |
3/4✓ Branch 0 taken 10 times.
✓ Branch 1 taken 103 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 10 times.
|
113 | if((w->lift_level && w->lift_level <= glove.fam_type)) |
| 11269 | { | ||
| 11270 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 2 times.
|
10 | if(!w->hit(hx,hy,0,hw,hh,1)) |
| 11271 | 8 | continue; | |
| 11272 | 2 | lift(w, w->lift_time, w->lift_height); | |
| 11273 | 2 | Lwpns.remove(w); | |
| 11274 | 2 | lifted = true; | |
| 11275 | 2 | break; | |
| 11276 | } | ||
| 11277 | 103 | } | |
| 11278 | } | ||
| 11279 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2185 times.
|
2187 | if(!lifted) //Check for a liftable combo |
| 11280 | { | ||
| 11281 | 2185 | zfix bx, by; | |
| 11282 | 2185 | zfix bx2, by2; | |
| 11283 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 340 times.
✓ Branch 2 taken 580 times.
✓ Branch 3 taken 670 times.
✓ Branch 4 taken 595 times.
|
2185 | switch(dir) |
| 11284 | { | ||
| 11285 | case up: | ||
| 11286 | 340 | by = y + (bigHitbox ? -2 : 6); | |
| 11287 | 340 | by2 = by; | |
| 11288 | 340 | bx = x + 4; | |
| 11289 | 340 | bx2 = bx + 8; | |
| 11290 | 340 | break; | |
| 11291 | case down: | ||
| 11292 | 580 | by = y + 17; | |
| 11293 | 580 | by2 = by; | |
| 11294 | 580 | bx = x + 4; | |
| 11295 | 580 | bx2 = bx + 8; | |
| 11296 | 580 | break; | |
| 11297 | case left: | ||
| 11298 | 670 | by = y + (bigHitbox ? 0 : 8); | |
| 11299 | 670 | by2 = y + 8; | |
| 11300 | 670 | bx = x - 2; | |
| 11301 | 670 | bx2 = x - 2; | |
| 11302 | 670 | break; | |
| 11303 | case right: | ||
| 11304 | 595 | by = y + (bigHitbox ? 0 : 8); | |
| 11305 | 595 | by2 = y + 8; | |
| 11306 | 595 | bx = x + 17; | |
| 11307 | 595 | bx2 = x + 17; | |
| 11308 | 595 | break; | |
| 11309 | } | ||
| 11310 | 2185 | int32_t pos = COMBOPOS_B(bx,by); | |
| 11311 | 2185 | int32_t pos2 = COMBOPOS_B(bx2,by2); | |
| 11312 | 2185 | int32_t foundpos = -1; | |
| 11313 | |||
| 11314 |
2/2✓ Branch 0 taken 2142 times.
✓ Branch 1 taken 15271 times.
|
17413 | for(auto lyr = 6; lyr >= 0; --lyr) |
| 11315 | { | ||
| 11316 | 15271 | mapscr* scr = FFCore.tempScreens[lyr]; | |
| 11317 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15271 times.
|
15271 | if(pos > -1) |
| 11318 | { | ||
| 11319 | 15271 | newcombo const& cmb = combobuf[scr->data[pos]]; | |
| 11320 |
2/2✓ Branch 0 taken 15231 times.
✓ Branch 1 taken 40 times.
|
15271 | if(cmb.liftflags & LF_LIFTABLE) |
| 11321 | { | ||
| 11322 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
|
40 | if(do_lift_combo(lyr,pos,liftid)) |
| 11323 | { | ||
| 11324 | 40 | lifted = true; | |
| 11325 | 40 | break; | |
| 11326 | } | ||
| 11327 | ✗ | } | |
| 11328 | 15231 | } | |
| 11329 |
3/4✓ Branch 0 taken 2139 times.
✓ Branch 1 taken 13092 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2139 times.
|
15231 | if(pos != pos2 && pos2 > -1) |
| 11330 | { | ||
| 11331 | 2139 | newcombo const& cmb2 = combobuf[scr->data[pos2]]; | |
| 11332 |
2/2✓ Branch 0 taken 2136 times.
✓ Branch 1 taken 3 times.
|
2139 | if(cmb2.liftflags & LF_LIFTABLE) |
| 11333 | { | ||
| 11334 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | if(do_lift_combo(lyr,pos2,liftid)) |
| 11335 | { | ||
| 11336 | 3 | lifted = true; | |
| 11337 | 3 | break; | |
| 11338 | } | ||
| 11339 | ✗ | } | |
| 11340 | 2136 | } | |
| 11341 | 15228 | } | |
| 11342 | 2185 | } | |
| 11343 | |||
| 11344 |
2/2✓ Branch 0 taken 45 times.
✓ Branch 1 taken 2142 times.
|
2187 | if(!lifted) |
| 11345 | { | ||
| 11346 | 2142 | last_lift_id.reset(); | |
| 11347 | 2142 | return; | |
| 11348 | } | ||
| 11349 | 45 | last_lift_id = liftid; | |
| 11350 | |||
| 11351 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 45 times.
|
45 | if(!paidmagic) |
| 11352 | { | ||
| 11353 | 45 | paidmagic = true; | |
| 11354 | 45 | paymagiccost(liftid); | |
| 11355 | 45 | } | |
| 11356 | 45 | set_liftflags(liftid); | |
| 11357 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 45 times.
|
45 | if(passive) |
| 11358 | 45 | getIntBtnInput(intbtn, true, true, false, false, false); //eat buttons | |
| 11359 | 45 | return; | |
| 11360 | 14151814 | } | |
| 11361 | 21661 | void HeroClass::handle_lift(bool dec) | |
| 11362 | { | ||
| 11363 |
1/2✓ Branch 0 taken 21661 times.
✗ Branch 1 not taken.
|
21661 | if(lift_wpn) |
| 11364 | 21661 | lift_wpn->fakez = 0; | |
| 11365 | ✗ | else liftclk = 0; | |
| 11366 |
2/2✓ Branch 0 taken 19896 times.
✓ Branch 1 taken 1765 times.
|
21661 | if(liftclk <= (dec?1:0)) |
| 11367 | { | ||
| 11368 | 19896 | liftclk = 0; | |
| 11369 | 19896 | tliftclk = 0; | |
| 11370 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19896 times.
|
19896 | if(lift_wpn) |
| 11371 | { | ||
| 11372 |
2/4✓ Branch 0 taken 19896 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 19896 times.
|
19896 | if(lift_wpn->txsz > 1 || lift_wpn->tysz > 1) |
| 11373 | { | ||
| 11374 | ✗ | lift_wpn->x = x+8 - (lift_wpn->txsz*8); | |
| 11375 | ✗ | lift_wpn->y = y+8 - (lift_wpn->tysz*8); | |
| 11376 | ✗ | } | |
| 11377 | else | ||
| 11378 | { | ||
| 11379 | 19896 | lift_wpn->x = x; | |
| 11380 | 19896 | lift_wpn->y = y; | |
| 11381 | } | ||
| 11382 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19896 times.
|
19896 | if(isSideViewGravity()) |
| 11383 | ✗ | lift_wpn->y -= liftheight; | |
| 11384 | 19896 | else lift_wpn->z = liftheight; | |
| 11385 | 19896 | } | |
| 11386 |
2/2✓ Branch 0 taken 19834 times.
✓ Branch 1 taken 62 times.
|
19896 | if(action == lifting) |
| 11387 | { | ||
| 11388 | 62 | action = none; FFCore.setHeroAction(none); | |
| 11389 | 62 | } | |
| 11390 | 19896 | return; | |
| 11391 | } | ||
| 11392 |
2/2✓ Branch 0 taken 891 times.
✓ Branch 1 taken 874 times.
|
1765 | if(dec) --liftclk; |
| 11393 | double xdist, ydist; | ||
| 11394 | 1765 | double perc = (liftclk/double(tliftclk)); | |
| 11395 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 318 times.
✓ Branch 2 taken 255 times.
✓ Branch 3 taken 514 times.
✓ Branch 4 taken 678 times.
|
1765 | switch(dir) |
| 11396 | { | ||
| 11397 | case up: | ||
| 11398 | { | ||
| 11399 | 318 | xdist = 0; | |
| 11400 | 318 | ydist = -16; | |
| 11401 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 318 times.
|
318 | if(lift_wpn->txsz > 1) |
| 11402 | { | ||
| 11403 | ✗ | xdist = -((lift_wpn->txsz*8)-8); | |
| 11404 | ✗ | } | |
| 11405 | 318 | else xdist = 0; | |
| 11406 |
1/2✓ Branch 0 taken 318 times.
✗ Branch 1 not taken.
|
318 | if(lift_wpn->tysz > 1) |
| 11407 | { | ||
| 11408 | ✗ | ydist = -(lift_wpn->tysz*16); | |
| 11409 | ✗ | } | |
| 11410 | 318 | ydist *= perc; | |
| 11411 | 318 | break; | |
| 11412 | } | ||
| 11413 | case down: | ||
| 11414 | { | ||
| 11415 | 255 | xdist = 0; | |
| 11416 | 255 | ydist = 16; | |
| 11417 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 255 times.
|
255 | if(lift_wpn->txsz > 1) |
| 11418 | { | ||
| 11419 | ✗ | xdist = -((lift_wpn->txsz*8)-8); | |
| 11420 | ✗ | } | |
| 11421 | 255 | else xdist = 0; | |
| 11422 | 255 | ydist *= perc; | |
| 11423 | 255 | break; | |
| 11424 | } | ||
| 11425 | case left: | ||
| 11426 | { | ||
| 11427 | 514 | xdist = -16; | |
| 11428 | 514 | ydist = 0; | |
| 11429 |
1/2✓ Branch 0 taken 514 times.
✗ Branch 1 not taken.
|
514 | if(lift_wpn->txsz > 1) |
| 11430 | { | ||
| 11431 | ✗ | xdist = -(lift_wpn->txsz*16); | |
| 11432 | ✗ | } | |
| 11433 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 514 times.
|
514 | if(lift_wpn->tysz > 1) |
| 11434 | { | ||
| 11435 | ✗ | ydist = -((lift_wpn->tysz*8)-8); | |
| 11436 | ✗ | } | |
| 11437 | 514 | else ydist = 0; | |
| 11438 | 514 | xdist *= perc; | |
| 11439 | 514 | break; | |
| 11440 | } | ||
| 11441 | case right: | ||
| 11442 | { | ||
| 11443 | 678 | xdist = 16; | |
| 11444 | 678 | ydist = 0; | |
| 11445 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 678 times.
|
678 | if(lift_wpn->tysz > 1) |
| 11446 | { | ||
| 11447 | ✗ | ydist = -((lift_wpn->tysz*8)-8); | |
| 11448 | ✗ | } | |
| 11449 | 678 | else ydist = 0; | |
| 11450 | 678 | xdist *= perc; | |
| 11451 | 678 | break; | |
| 11452 | } | ||
| 11453 | } | ||
| 11454 | |||
| 11455 | 1765 | lift_wpn->x = x + xdist; | |
| 11456 | 1765 | lift_wpn->y = y + ydist; | |
| 11457 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1765 times.
|
1765 | if(isSideViewGravity()) |
| 11458 | ✗ | lift_wpn->y -= liftheight*(1.0-perc); | |
| 11459 | 1765 | else lift_wpn->z = liftheight*(1.0-perc); | |
| 11460 | 21661 | } | |
| 11461 | 14161426 | bool HeroClass::can_lift(int32_t gloveid) | |
| 11462 | { | ||
| 11463 |
2/2✓ Branch 0 taken 13725912 times.
✓ Branch 1 taken 435514 times.
|
14161426 | if(unsigned(gloveid) >= MAXITEMS) return false; |
| 11464 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 435514 times.
|
435514 | if(lstunclock) return false; |
| 11465 |
1/2✓ Branch 0 taken 435514 times.
✗ Branch 1 not taken.
|
435514 | if(!checkitem_jinx(gloveid)) return false; |
| 11466 | 435514 | itemdata const& glove = itemsbuf[gloveid]; | |
| 11467 |
3/3✓ Branch 0 taken 371545 times.
✓ Branch 1 taken 57216 times.
✓ Branch 2 taken 6753 times.
|
435514 | switch(action) |
| 11468 | { | ||
| 11469 | case none: case walking: | ||
| 11470 | 371545 | break; | |
| 11471 | |||
| 11472 | case swimming: | ||
| 11473 |
1/2✓ Branch 0 taken 6753 times.
✗ Branch 1 not taken.
|
6753 | if(glove.flags & item_flag2) |
| 11474 | ✗ | break; | |
| 11475 | 6753 | return false; | |
| 11476 | |||
| 11477 | default: | ||
| 11478 | 57216 | return false; | |
| 11479 | } | ||
| 11480 | 371545 | return true; | |
| 11481 | 14161426 | } | |
| 11482 | 62 | void HeroClass::lift(weapon* w, byte timer, zfix height) | |
| 11483 | { | ||
| 11484 | 62 | lift_wpn = w; | |
| 11485 | 62 | liftclk = timer; | |
| 11486 | 62 | tliftclk = timer; | |
| 11487 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 62 times.
|
62 | if(height < 0) |
| 11488 | ✗ | liftheight = 0; | |
| 11489 | 62 | else liftheight = height; | |
| 11490 | 62 | } | |
| 11491 | |||
| 11492 | 137 | void HeroClass::doSwitchHook(byte style) | |
| 11493 | { | ||
| 11494 | 137 | hs_switcher = true; | |
| 11495 | 137 | pull_hero = true; | |
| 11496 | //{ Load hook weapons, set them to obey special drawing | ||
| 11497 | 137 | weapon *w = (weapon*)Lwpns.spr(Lwpns.idFirst(wHookshot)), | |
| 11498 | 137 | *hw = (weapon*)Lwpns.spr(Lwpns.idFirst(wHSHandle)); | |
| 11499 | |||
| 11500 |
2/2✓ Branch 0 taken 136 times.
✓ Branch 1 taken 1 times.
|
137 | if(w) |
| 11501 | 1 | w->switch_hooked = true; | |
| 11502 |
2/2✓ Branch 0 taken 136 times.
✓ Branch 1 taken 1 times.
|
137 | if(hw) |
| 11503 | 1 | hw->switch_hooked = true; | |
| 11504 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 137 times.
|
142 | for(int32_t j=0; j<chainlinks.Count(); j++) |
| 11505 | { | ||
| 11506 | 5 | chainlinks.spr(j)->switch_hooked = true; | |
| 11507 | 5 | } | |
| 11508 | //} | ||
| 11509 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 132 times.
|
137 | if(hooked_combopos > -1) |
| 11510 | { | ||
| 11511 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | int32_t max_layer = get_qr(qr_HOOKSHOTALLLAYER) ? 6 : (get_qr(qr_HOOKSHOTLAYERFIX) ? 2 : 0); |
| 11512 | 132 | hooked_layerbits = 0; | |
| 11513 |
2/2✓ Branch 0 taken 924 times.
✓ Branch 1 taken 132 times.
|
1056 | for(auto q = 0; q < 7; ++q) |
| 11514 | 924 | hooked_undercombos[q] = -1; | |
| 11515 | 132 | uint16_t plpos = COMBOPOS(x+8,y+8); | |
| 11516 |
2/2✓ Branch 0 taken 924 times.
✓ Branch 1 taken 132 times.
|
1056 | for(auto q = max_layer; q > -1; --q) |
| 11517 | { | ||
| 11518 | 924 | newcombo const& cmb = combobuf[FFCore.tempScreens[q]->data[hooked_combopos]]; | |
| 11519 | 924 | newcombo const& comb2 = combobuf[FFCore.tempScreens[q]->data[plpos]]; | |
| 11520 | 924 | int32_t fl1 = FFCore.tempScreens[q]->sflag[hooked_combopos], | |
| 11521 | 924 | fl2 = FFCore.tempScreens[q]->sflag[plpos]; | |
| 11522 | 924 | bool isPush = false; | |
| 11523 |
2/2✓ Branch 0 taken 792 times.
✓ Branch 1 taken 132 times.
|
924 | if(isSwitchHookable(cmb)) |
| 11524 | { | ||
| 11525 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | if(cmb.type == cSWITCHHOOK) |
| 11526 | { | ||
| 11527 | 132 | uint16_t plpos = COMBOPOS(x+8,y+8); | |
| 11528 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
132 | if((cmb.usrflags&cflag1) && FFCore.tempScreens[q]->data[plpos]) |
| 11529 | ✗ | continue; //don't swap with non-zero combo | |
| 11530 |
3/12✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 132 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 132 times.
|
132 | if(zc_max(1,itemsbuf[(w && w->parentitem>-1) ? w->parentitem : current_item_id(itype_switchhook)].fam_type) < cmb.attribytes[0]) |
| 11531 | ✗ | continue; //too low a switchhook level | |
| 11532 | 132 | hooked_layerbits |= 1<<q; //Swapping | |
| 11533 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
|
132 | if(cmb.usrflags&cflag3) |
| 11534 | { | ||
| 11535 | ✗ | if(cmb.usrflags&cflag6) | |
| 11536 | { | ||
| 11537 | ✗ | hooked_undercombos[q] = FFCore.tempScreens[q]->data[hooked_combopos]+1; | |
| 11538 | ✗ | hooked_undercombos[q+7] = FFCore.tempScreens[q]->cset[hooked_combopos]; | |
| 11539 | ✗ | } | |
| 11540 | else | ||
| 11541 | { | ||
| 11542 | ✗ | hooked_undercombos[q] = FFCore.tempScreens[q]->undercombo; | |
| 11543 | ✗ | hooked_undercombos[q+7] = FFCore.tempScreens[q]->undercset; | |
| 11544 | } | ||
| 11545 | ✗ | } | |
| 11546 | else | ||
| 11547 | { | ||
| 11548 | 132 | hooked_layerbits |= 1<<(q+8); //Swapping BACK | |
| 11549 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | if(cmb.usrflags&cflag7) //counts as 'pushblock' |
| 11550 | ✗ | isPush = true; | |
| 11551 | } | ||
| 11552 | 132 | } | |
| 11553 | ✗ | else if(isCuttableType(cmb.type)) | |
| 11554 | { | ||
| 11555 | ✗ | if(isCuttableNextType(cmb.type)) | |
| 11556 | { | ||
| 11557 | ✗ | hooked_undercombos[q] = FFCore.tempScreens[q]->data[hooked_combopos]+1; | |
| 11558 | ✗ | hooked_undercombos[q+7] = FFCore.tempScreens[q]->cset[hooked_combopos]; | |
| 11559 | ✗ | } | |
| 11560 | else | ||
| 11561 | { | ||
| 11562 | ✗ | hooked_undercombos[q] = FFCore.tempScreens[q]->undercombo; | |
| 11563 | ✗ | hooked_undercombos[q+7] = FFCore.tempScreens[q]->undercset; | |
| 11564 | } | ||
| 11565 | ✗ | hooked_layerbits |= 1<<q; //Swapping | |
| 11566 | ✗ | } | |
| 11567 | else | ||
| 11568 | { | ||
| 11569 | ✗ | hooked_layerbits |= 1<<q; //Swapping | |
| 11570 | ✗ | hooked_layerbits |= 1<<(q+8); //Swapping BACK | |
| 11571 | } | ||
| 11572 | 132 | } | |
| 11573 |
2/2✓ Branch 0 taken 792 times.
✓ Branch 1 taken 132 times.
|
924 | if(hooked_layerbits & (1<<(q+8))) //2-way swap, check for pushblocks |
| 11574 | { | ||
| 11575 |
3/6✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 132 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 132 times.
✗ Branch 5 not taken.
|
132 | if((cmb.type==cPUSH_WAIT || cmb.type==cPUSH_HW || cmb.type==cPUSH_HW2) |
| 11576 | 132 | && hasMainGuy()) | |
| 11577 | { | ||
| 11578 | ✗ | hooked_layerbits &= ~(0x101<<q); //Can't swap yet | |
| 11579 | ✗ | continue; | |
| 11580 | } | ||
| 11581 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
|
132 | if(fl1 == mfPUSHED) |
| 11582 | { | ||
| 11583 | ✗ | hooked_layerbits &= ~(0x101<<q); //Can't swap at all, locked in place | |
| 11584 | ✗ | continue; | |
| 11585 | } | ||
| 11586 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 132 times.
|
132 | if(!isPush) switch(fl1) |
| 11587 | { | ||
| 11588 | case mfPUSHUD: case mfPUSHUDNS: case mfPUSHUDINS: | ||
| 11589 | case mfPUSHLR: case mfPUSHLRNS: case mfPUSHLRINS: | ||
| 11590 | case mfPUSHU: case mfPUSHUNS: case mfPUSHUINS: | ||
| 11591 | case mfPUSHD: case mfPUSHDNS: case mfPUSHDINS: | ||
| 11592 | case mfPUSHL: case mfPUSHLNS: case mfPUSHLINS: | ||
| 11593 | case mfPUSHR: case mfPUSHRNS: case mfPUSHRINS: | ||
| 11594 | case mfPUSH4: case mfPUSH4NS: case mfPUSH4INS: | ||
| 11595 | ✗ | isPush = true; | |
| 11596 | 132 | } | |
| 11597 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 132 times.
|
132 | if(!isPush) switch(cmb.flag) |
| 11598 | { | ||
| 11599 | case mfPUSHUD: case mfPUSHUDNS: case mfPUSHUDINS: | ||
| 11600 | case mfPUSHLR: case mfPUSHLRNS: case mfPUSHLRINS: | ||
| 11601 | case mfPUSHU: case mfPUSHUNS: case mfPUSHUINS: | ||
| 11602 | case mfPUSHD: case mfPUSHDNS: case mfPUSHDINS: | ||
| 11603 | case mfPUSHL: case mfPUSHLNS: case mfPUSHLINS: | ||
| 11604 | case mfPUSHR: case mfPUSHRNS: case mfPUSHRINS: | ||
| 11605 | case mfPUSH4: case mfPUSH4NS: case mfPUSH4INS: | ||
| 11606 | ✗ | isPush = true; | |
| 11607 | 132 | } | |
| 11608 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | if(isPush) //Check for block holes / triggers |
| 11609 | { | ||
| 11610 | ✗ | if(comb2.flag == mfBLOCKHOLE || fl2 == mfBLOCKHOLE | |
| 11611 | ✗ | || comb2.flag == mfBLOCKTRIGGER || fl2 == mfBLOCKTRIGGER) | |
| 11612 | { | ||
| 11613 | ✗ | hooked_layerbits &= ~(1<<(q+8)); //Don't swap the hole/trigger back | |
| 11614 | ✗ | } | |
| 11615 | ✗ | else if(!get_qr(qr_BLOCKHOLE_SAME_ONLY)) | |
| 11616 | { | ||
| 11617 | ✗ | auto maxLayer = get_qr(qr_PUSHBLOCK_LAYER_1_2) ? 2 : 0; | |
| 11618 | ✗ | for(auto lyr = 0; lyr < maxLayer; ++lyr) | |
| 11619 | { | ||
| 11620 | ✗ | if(lyr == q) continue; | |
| 11621 | ✗ | switch(FFCore.tempScreens[q]->sflag[plpos]) | |
| 11622 | { | ||
| 11623 | case mfBLOCKHOLE: case mfBLOCKTRIGGER: | ||
| 11624 | ✗ | hooked_layerbits &= ~(1<<(q+8)); //Don't swap the hole/trigger back | |
| 11625 | ✗ | lyr=7; | |
| 11626 | ✗ | break; | |
| 11627 | } | ||
| 11628 | ✗ | switch(combobuf[FFCore.tempScreens[q]->data[plpos]].flag) | |
| 11629 | { | ||
| 11630 | case mfBLOCKHOLE: case mfBLOCKTRIGGER: | ||
| 11631 | ✗ | hooked_layerbits &= ~(1<<(q+8)); //Don't swap the hole/trigger back | |
| 11632 | ✗ | lyr=7; | |
| 11633 | ✗ | break; | |
| 11634 | } | ||
| 11635 | ✗ | } | |
| 11636 | ✗ | } | |
| 11637 | ✗ | } | |
| 11638 | 132 | } | |
| 11639 | 924 | } | |
| 11640 | 132 | } | |
| 11641 | 137 | switch_hooked = true; | |
| 11642 | 137 | switchhookstyle = style; | |
| 11643 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 136 times.
✗ Branch 3 not taken.
|
137 | switch(style) |
| 11644 | ✗ | { | |
| 11645 | default: case swPOOF: | ||
| 11646 | { | ||
| 11647 | 1 | wpndata const& spr = wpnsbuf[QMisc.sprites[sprSWITCHPOOF]]; | |
| 11648 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | switchhookmaxtime = switchhookclk = zc_max(spr.frames,1) * zc_max(spr.speed,1); |
| 11649 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | decorations.add(new comboSprite(x, y, dCOMBOSPRITE, 0, QMisc.sprites[sprSWITCHPOOF])); |
| 11650 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if(hooked_combopos > -1) |
| 11651 | ✗ | decorations.add(new comboSprite((zfix)COMBOX(hooked_combopos), (zfix)COMBOY(hooked_combopos), dCOMBOSPRITE, 0, QMisc.sprites[sprSWITCHPOOF])); | |
| 11652 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | else if(switching_object) |
| 11653 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | decorations.add(new comboSprite(switching_object->x, switching_object->y, dCOMBOSPRITE, 0, QMisc.sprites[sprSWITCHPOOF])); |
| 11654 | 1 | break; | |
| 11655 | } | ||
| 11656 | case swFLICKER: | ||
| 11657 | { | ||
| 11658 | 136 | switchhookmaxtime = switchhookclk = 64; | |
| 11659 | 136 | break; | |
| 11660 | } | ||
| 11661 | case swRISE: | ||
| 11662 | { | ||
| 11663 | ✗ | switchhookmaxtime = switchhookclk = 64; | |
| 11664 | ✗ | break; | |
| 11665 | } | ||
| 11666 | } | ||
| 11667 | 137 | } | |
| 11668 | |||
| 11669 | 46360 | bool HeroClass::startwpn(int32_t itemid) | |
| 11670 | { | ||
| 11671 |
1/2✓ Branch 0 taken 46360 times.
✗ Branch 1 not taken.
|
46360 | if(itemid < 0) return false; |
| 11672 | 46360 | itemdata const& itm = itemsbuf[itemid]; | |
| 11673 |
6/6✓ Branch 0 taken 10746 times.
✓ Branch 1 taken 35614 times.
✓ Branch 2 taken 8645 times.
✓ Branch 3 taken 26969 times.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 116 times.
|
46477 | if(((dir==up && y<24) || (dir==down && y>128) || |
| 11674 |
6/6✓ Branch 0 taken 13101 times.
✓ Branch 1 taken 13868 times.
✓ Branch 2 taken 13862 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 117 times.
✓ Branch 5 taken 46237 times.
|
46360 | (dir==left && x<32) || (dir==right && x>208)) && !(get_qr(qr_ITEMSONEDGES) || inlikelike)) |
| 11675 | 116 | return false; | |
| 11676 | |||
| 11677 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 46244 times.
|
46244 | bool liftonly = lift_wpn && (liftflags & LIFTFL_DIS_ITEMS); |
| 11678 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 46244 times.
|
46244 | if(liftonly) |
| 11679 | { | ||
| 11680 | ✗ | dowpn = -1; | |
| 11681 | ✗ | switch(itm.family) | |
| 11682 | { | ||
| 11683 | case itype_bomb: | ||
| 11684 | case itype_sbomb: | ||
| 11685 | ✗ | if(itm.flags & item_flag4) | |
| 11686 | ✗ | do_liftglove(-1,false); | |
| 11687 | ✗ | break; | |
| 11688 | case itype_liftglove: | ||
| 11689 | ✗ | do_liftglove(-1,false); | |
| 11690 | ✗ | break; | |
| 11691 | } | ||
| 11692 | ✗ | return false; | |
| 11693 | } | ||
| 11694 | |||
| 11695 | 46244 | int32_t wx=x; | |
| 11696 | 46244 | int32_t wy=y-fakez; | |
| 11697 | 46244 | int32_t wz=z; | |
| 11698 | 46244 | bool ret = true; | |
| 11699 | |||
| 11700 |
5/5✓ Branch 0 taken 13828 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 10727 times.
✓ Branch 3 taken 8613 times.
✓ Branch 4 taken 13070 times.
|
46244 | switch(dir) |
| 11701 | { | ||
| 11702 | case up: | ||
| 11703 | 10727 | wy-=16; | |
| 11704 | 10727 | break; | |
| 11705 | |||
| 11706 | case down: | ||
| 11707 | 8613 | wy+=16; | |
| 11708 | 8613 | break; | |
| 11709 | |||
| 11710 | case left: | ||
| 11711 | 13070 | wx-=16; | |
| 11712 | 13070 | break; | |
| 11713 | |||
| 11714 | case right: | ||
| 11715 | 13828 | wx+=16; | |
| 11716 | 13828 | break; | |
| 11717 | } | ||
| 11718 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 46244 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
46244 | if (IsSideSwim() && (itm.flags & item_sideswim_disabled)) return false; |
| 11719 | |||
| 11720 |
17/27✗ Branch 0 not taken.
✓ Branch 1 taken 2484 times.
✓ Branch 2 taken 1749 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 35 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 369 times.
✓ Branch 9 taken 4 times.
✓ Branch 10 taken 351 times.
✓ Branch 11 taken 1338 times.
✓ Branch 12 taken 35 times.
✓ Branch 13 taken 1837 times.
✓ Branch 14 taken 19942 times.
✓ Branch 15 taken 1791 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 2335 times.
✓ Branch 18 taken 20 times.
✓ Branch 19 taken 13930 times.
✓ Branch 20 taken 12 times.
✓ Branch 21 taken 8 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 4 times.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
|
46244 | switch(itm.family) |
| 11721 | { | ||
| 11722 | case itype_liftglove: | ||
| 11723 | { | ||
| 11724 | ✗ | do_liftglove(itemid,false); | |
| 11725 | ✗ | dowpn = -1; | |
| 11726 | ✗ | ret = false; | |
| 11727 | ✗ | break; | |
| 11728 | } | ||
| 11729 | case itype_potion: | ||
| 11730 | { | ||
| 11731 |
2/4✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 35 times.
|
35 | if(!(checkbunny(itemid) && checkmagiccost(itemid))) |
| 11732 | { | ||
| 11733 | ✗ | return item_error(); | |
| 11734 | } | ||
| 11735 | |||
| 11736 | 35 | paymagiccost(itemid); | |
| 11737 | |||
| 11738 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 35 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
35 | if(itm.misc1 || itm.misc2) |
| 11739 | { | ||
| 11740 | 35 | refill_what=REFILL_ALL; | |
| 11741 | 35 | refill_why=itemid; | |
| 11742 | 35 | StartRefill(REFILL_ALL); | |
| 11743 | 35 | potion_life = game->get_life(); | |
| 11744 | 35 | potion_magic = game->get_magic(); | |
| 11745 | |||
| 11746 | //add a quest rule or an item option that lets you specify whether or not to pause music during refilling | ||
| 11747 | //music_pause(); | ||
| 11748 | 35 | stop_sfx(QMisc.miscsfx[sfxLOWHEART]); //stop heart beep! | |
| 11749 |
2/2✓ Branch 0 taken 6288 times.
✓ Branch 1 taken 35 times.
|
6323 | while(refill()) |
| 11750 | { | ||
| 11751 | 6288 | do_refill_waitframe(); | |
| 11752 | } | ||
| 11753 | |||
| 11754 | //add a quest rule or an item option that lets you specify whether or not to pause music during refilling | ||
| 11755 | //music_resume(); | ||
| 11756 | 35 | ret = false; | |
| 11757 | 35 | } | |
| 11758 | |||
| 11759 | 35 | break; | |
| 11760 | } | ||
| 11761 | case itype_bottle: | ||
| 11762 | { | ||
| 11763 | ✗ | if(!(checkbunny(itemid) && checkmagiccost(itemid))) | |
| 11764 | { | ||
| 11765 | ✗ | return item_error(); | |
| 11766 | } | ||
| 11767 | ✗ | if(itm.script!=0 && (FFCore.doscript(ScriptType::Item, itemid) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING))) | |
| 11768 | ✗ | return false; | |
| 11769 | |||
| 11770 | ✗ | size_t bind = game->get_bottle_slot(itm.misc1); | |
| 11771 | ✗ | bool paidmagic = false; | |
| 11772 | ✗ | if(itm.script) | |
| 11773 | { | ||
| 11774 | ✗ | paidmagic = true; | |
| 11775 | ✗ | paymagiccost(itemid); | |
| 11776 | |||
| 11777 | ✗ | int i = itemid; | |
| 11778 | ✗ | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 11779 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itm.script, i); | |
| 11780 | ✗ | bind = game->get_bottle_slot(itm.misc1); | |
| 11781 | ✗ | } | |
| 11782 | ✗ | bottletype const* bt = bind ? &(QMisc.bottle_types[bind-1]) : NULL; | |
| 11783 | ✗ | if(bt) | |
| 11784 | { | ||
| 11785 | ✗ | word toFill[3] = { 0 }; | |
| 11786 | ✗ | for(size_t q = 0; q < 3; ++q) | |
| 11787 | { | ||
| 11788 | ✗ | char c = bt->counter[q]; | |
| 11789 | ✗ | if(c > -1) | |
| 11790 | { | ||
| 11791 | ✗ | if(bt->flags & (1<<q)) | |
| 11792 | { | ||
| 11793 | ✗ | toFill[q] = (bt->amount[q]==100) | |
| 11794 | ✗ | ? game->get_maxcounter(c) | |
| 11795 | ✗ | : word((game->get_maxcounter(c)/100.0)*bt->amount[q]); | |
| 11796 | ✗ | } | |
| 11797 | ✗ | else toFill[q] = bt->amount[q]; | |
| 11798 | ✗ | if(toFill[q] + game->get_counter(c) > game->get_maxcounter(c)) | |
| 11799 | { | ||
| 11800 | ✗ | toFill[q] = game->get_maxcounter(c) - game->get_counter(c); | |
| 11801 | ✗ | } | |
| 11802 | ✗ | } | |
| 11803 | ✗ | } | |
| 11804 | ✗ | word max = std::max(toFill[0], std::max(toFill[1], toFill[2])); | |
| 11805 | ✗ | bool run = max > 0; | |
| 11806 | ✗ | if(get_qr(qr_NO_BOTTLE_IF_ANY_COUNTER_FULL)) | |
| 11807 | ✗ | run = ((bt->counter[0] > -1 && !toFill[0]) || (bt->counter[1] > -1 && !toFill[1]) || (bt->counter[2] > -1 && !toFill[2])); | |
| 11808 | else | ||
| 11809 | { | ||
| 11810 | ✗ | if((bt->flags & BTFLAG_CURESWJINX) && swordclk) | |
| 11811 | ✗ | run = true; | |
| 11812 | ✗ | else if((bt->flags & BTFLAG_CUREITJINX) && itemclk) | |
| 11813 | ✗ | run = true; | |
| 11814 | } | ||
| 11815 | ✗ | if(run || (bt->flags&BTFLAG_ALLOWIFFULL)) | |
| 11816 | { | ||
| 11817 | ✗ | if(bt->flags & BTFLAG_CURESWJINX) | |
| 11818 | { | ||
| 11819 | ✗ | swordclk = 0; | |
| 11820 | ✗ | verifyAWpn(); | |
| 11821 | ✗ | } | |
| 11822 | ✗ | if(bt->flags & BTFLAG_CUREITJINX) | |
| 11823 | ✗ | itemclk = 0; | |
| 11824 | ✗ | if(!paidmagic) | |
| 11825 | ✗ | paymagiccost(itemid); | |
| 11826 | ✗ | stop_sfx(QMisc.miscsfx[sfxLOWHEART]); //stop heart beep! | |
| 11827 | ✗ | sfx(itm.usesound,pan(x.getInt())); | |
| 11828 | ✗ | for(size_t q = 0; q < 20; ++q) | |
| 11829 | ✗ | do_refill_waitframe(); | |
| 11830 | ✗ | double inc = max/60.0; //1 second | |
| 11831 | ✗ | double xtra[3]{ 0 }; | |
| 11832 | ✗ | for(size_t q = 0; q < 60; ++q) | |
| 11833 | { | ||
| 11834 | ✗ | if(!(q%6) && (toFill[0]||toFill[1]||toFill[2])) | |
| 11835 | ✗ | sfx(QMisc.miscsfx[sfxREFILL]); | |
| 11836 | ✗ | for(size_t j = 0; j < 3; ++j) | |
| 11837 | { | ||
| 11838 | ✗ | xtra[j] += inc; | |
| 11839 | ✗ | word f = floor(xtra[j]); | |
| 11840 | ✗ | xtra[j] -= f; | |
| 11841 | ✗ | if(toFill[j] > f) | |
| 11842 | { | ||
| 11843 | ✗ | toFill[j] -= f; | |
| 11844 | ✗ | game->change_counter(f,bt->counter[j]); | |
| 11845 | ✗ | } | |
| 11846 | ✗ | else if(toFill[j]) | |
| 11847 | { | ||
| 11848 | ✗ | game->change_counter(toFill[j],bt->counter[j]); | |
| 11849 | ✗ | toFill[j] = 0; | |
| 11850 | ✗ | } | |
| 11851 | ✗ | } | |
| 11852 | ✗ | do_refill_waitframe(); | |
| 11853 | ✗ | } | |
| 11854 | ✗ | for(size_t j = 0; j < 3; ++j) | |
| 11855 | { | ||
| 11856 | ✗ | if(toFill[j]) | |
| 11857 | { | ||
| 11858 | ✗ | game->change_counter(toFill[j],bt->counter[j]); | |
| 11859 | ✗ | toFill[j] = 0; | |
| 11860 | ✗ | } | |
| 11861 | ✗ | } | |
| 11862 | ✗ | for(size_t q = 0; q < 20; ++q) | |
| 11863 | ✗ | do_refill_waitframe(); | |
| 11864 | ✗ | game->set_bottle_slot(itm.misc1, bt->next_type); | |
| 11865 | ✗ | } | |
| 11866 | ✗ | } | |
| 11867 | |||
| 11868 | ✗ | dowpn = -1; | |
| 11869 | ✗ | ret = false; | |
| 11870 | ✗ | break; | |
| 11871 | } | ||
| 11872 | |||
| 11873 | case itype_note: | ||
| 11874 | { | ||
| 11875 | ✗ | if(!(checkbunny(itemid) && checkmagiccost(itemid))) | |
| 11876 | { | ||
| 11877 | ✗ | return item_error(); | |
| 11878 | } | ||
| 11879 | ✗ | if(!msg_active) | |
| 11880 | { | ||
| 11881 | ✗ | if(play_combo_string(itm.misc1)) | |
| 11882 | { | ||
| 11883 | ✗ | sfx(itm.usesound); | |
| 11884 | ✗ | paymagiccost(itemid); | |
| 11885 | ✗ | } | |
| 11886 | ✗ | } | |
| 11887 | ✗ | dowpn = -1; | |
| 11888 | ✗ | ret = false; | |
| 11889 | ✗ | break; | |
| 11890 | } | ||
| 11891 | |||
| 11892 | case itype_mirror: | ||
| 11893 | ✗ | doMirror(itemid); | |
| 11894 | ✗ | if(Quit) | |
| 11895 | ✗ | return false; | |
| 11896 | ✗ | ret = false; | |
| 11897 | ✗ | break; | |
| 11898 | |||
| 11899 | case itype_rocs: | ||
| 11900 | { | ||
| 11901 |
2/2✓ Branch 0 taken 352 times.
✓ Branch 1 taken 17 times.
|
369 | if(!do_jump(itemid,false)) return false; |
| 11902 | 352 | ret = false; | |
| 11903 | } | ||
| 11904 | 352 | break; | |
| 11905 | |||
| 11906 | case itype_letter: | ||
| 11907 | { | ||
| 11908 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
8 | if(current_item(itype_letter)==i_letter && |
| 11909 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | tmpscr[currscr<128?0:1].room==rP_SHOP && |
| 11910 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | tmpscr[currscr<128?0:1].guy && |
| 11911 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | ((currscr<128&&!(DMaps[currdmap].flags&dmfGUYCAVES)) |
| 11912 |
1/4✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
|
4 | ||(currscr>=128&&DMaps[currdmap].flags&dmfGUYCAVES)) && |
| 11913 | 4 | checkbunny(itemid) | |
| 11914 | ) | ||
| 11915 | { | ||
| 11916 | 4 | int32_t usedid = getItemID(itemsbuf, itype_letter,i_letter+1); | |
| 11917 | |||
| 11918 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | if(usedid != -1) |
| 11919 | 4 | getitem(usedid, true, true); | |
| 11920 | |||
| 11921 | 4 | sfx(tmpscr[currscr<128?0:1].secretsfx); | |
| 11922 | 4 | setupscreen(); | |
| 11923 | 4 | action=none; FFCore.setHeroAction(none); | |
| 11924 | 4 | } | |
| 11925 | |||
| 11926 | 4 | ret = false; | |
| 11927 | } | ||
| 11928 | 4 | break; | |
| 11929 | |||
| 11930 | case itype_whistle: | ||
| 11931 | { | ||
| 11932 | bool whistleflag; | ||
| 11933 | |||
| 11934 |
4/4✓ Branch 0 taken 345 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 351 times.
|
351 | if(!(checkbunny(itemid) && checkmagiccost(itemid))) |
| 11935 | { | ||
| 11936 | 12 | return item_error(); | |
| 11937 | } | ||
| 11938 | |||
| 11939 | 351 | paymagiccost(itemid); | |
| 11940 | 351 | sfx(itm.usesound); | |
| 11941 | |||
| 11942 |
4/4✓ Branch 0 taken 276 times.
✓ Branch 1 taken 75 times.
✓ Branch 2 taken 141 times.
✓ Branch 3 taken 135 times.
|
351 | if(dir==up || dir==right) |
| 11943 | 216 | ++blowcnt; | |
| 11944 | else | ||
| 11945 | 135 | --blowcnt; | |
| 11946 | |||
| 11947 | 351 | uint32_t frames_to_wait = 0; | |
| 11948 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 345 times.
|
351 | if (replay_is_active()) |
| 11949 | { | ||
| 11950 | // How long an sfx takes to play (`sfx_allocated`) is not deterministic, | ||
| 11951 | // use a fixed number of frames in replay mode. | ||
| 11952 | // This has changed over time. | ||
| 11953 |
2/2✓ Branch 0 taken 217 times.
✓ Branch 1 taken 128 times.
|
345 | if (replay_version_check(0, 26)) |
| 11954 | { | ||
| 11955 | 217 | frames_to_wait = 180; | |
| 11956 | 217 | } | |
| 11957 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 46 times.
|
128 | else if (replay_version_check(27, 31)) |
| 11958 | { | ||
| 11959 | 82 | frames_to_wait = 0; | |
| 11960 | 82 | } | |
| 11961 | else | ||
| 11962 | { | ||
| 11963 | 46 | SAMPLE* sample = sfx_get_sample(itm.usesound); | |
| 11964 | ASSERT(sample); | ||
| 11965 |
2/4✓ Branch 0 taken 46 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 46 times.
|
46 | if (sample && sample->freq) |
| 11966 | 46 | frames_to_wait = 60 * sample->len / sample->freq; | |
| 11967 | } | ||
| 11968 | 345 | } | |
| 11969 | |||
| 11970 | 351 | int sfx_count = 0; | |
| 11971 |
6/8✗ Branch 0 not taken.
✓ Branch 1 taken 47481 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 6 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 47487 times.
✓ Branch 6 taken 47142 times.
✓ Branch 7 taken 351 times.
|
47493 | while ((!replay_is_active() && sfx_allocated(itm.usesound)) || (replay_is_active() && sfx_count < frames_to_wait)) |
| 11972 | { | ||
| 11973 | 47142 | sfx_count += 1; | |
| 11974 | 47142 | advanceframe(true); | |
| 11975 | |||
| 11976 |
1/2✓ Branch 0 taken 47142 times.
✗ Branch 1 not taken.
|
47142 | if(Quit) |
| 11977 | ✗ | return false; | |
| 11978 | } | ||
| 11979 | |||
| 11980 |
9/14✓ Branch 0 taken 345 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 345 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 345 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 345 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 345 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 345 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 351 times.
✓ Branch 13 taken 6 times.
|
351 | Lwpns.add(new weapon(x,y-fakez,z,wWhistle,0,0,dir,itemid,getUID(),false,0,1,0)); |
| 11981 | |||
| 11982 |
2/2✓ Branch 0 taken 249 times.
✓ Branch 1 taken 102 times.
|
351 | if((whistleflag=findentrance(x,y,mfWHISTLE,get_qr(qr_PERMANENT_WHISTLE_SECRETS)))) |
| 11983 | 102 | didstuff |= did_whistle; | |
| 11984 | |||
| 11985 |
3/4✓ Branch 0 taken 106 times.
✓ Branch 1 taken 245 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 245 times.
|
351 | if((didstuff&did_whistle && itm.flags&item_flag1) || currscr>=128) |
| 11986 | 106 | return false; | |
| 11987 | |||
| 11988 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 239 times.
|
245 | if(itm.flags&item_flag1) didstuff |= did_whistle; |
| 11989 | |||
| 11990 |
4/4✓ Branch 0 taken 206 times.
✓ Branch 1 taken 27 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 212 times.
|
245 | if((tmpscr->flags&fWHISTLE) || (tmpscr->flags7 & fWHISTLEWATER) |
| 11991 |
1/2✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
|
206 | || (tmpscr->flags7&fWHISTLEPAL)) |
| 11992 | { | ||
| 11993 | 33 | whistleclk=0; // signal to start drying lake or doing other stuff | |
| 11994 | 33 | } | |
| 11995 | else | ||
| 11996 | { | ||
| 11997 | 212 | int32_t where = itm.misc1; | |
| 11998 | |||
| 11999 |
1/2✓ Branch 0 taken 212 times.
✗ Branch 1 not taken.
|
212 | if(where>right) where=dir^1; |
| 12000 | |||
| 12001 |
5/6✓ Branch 0 taken 141 times.
✓ Branch 1 taken 71 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 68 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 138 times.
|
350 | if(((DMaps[currdmap].flags&dmfWHIRLWIND && TriforceCount()) || DMaps[currdmap].flags&dmfWHIRLWINDRET) && |
| 12002 |
1/2✓ Branch 0 taken 138 times.
✗ Branch 1 not taken.
|
144 | itm.misc2 >= 0 && itm.misc2 <= 8 && !whistleflag) |
| 12003 |
4/12✗ Branch 0 not taken.
✓ Branch 1 taken 138 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 138 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 138 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 138 times.
✗ Branch 11 not taken.
|
276 | Lwpns.add(new weapon((zfix)(where==left?240_zf:where==right?0_zf:x), |
| 12004 |
3/10✗ Branch 0 not taken.
✓ Branch 1 taken 138 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 138 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 138 times.
✗ Branch 9 not taken.
|
138 | (zfix)(where==down?0_zf:where==up?160_zf:y), |
| 12005 |
1/2✓ Branch 0 taken 138 times.
✗ Branch 1 not taken.
|
138 | (zfix)0, |
| 12006 | wWind, | ||
| 12007 | 0, //type | ||
| 12008 | 0, | ||
| 12009 | 138 | where, | |
| 12010 |
1/2✓ Branch 0 taken 138 times.
✗ Branch 1 not taken.
|
138 | itemid,getUID(),false,false,true,0)); //last arg is byte special, used to override type for wWind for now. -Z 18JULY2020 |
| 12011 | |||
| 12012 | 206 | whistleitem=itemid; | |
| 12013 | } | ||
| 12014 | |||
| 12015 | 239 | ret = false; | |
| 12016 | } | ||
| 12017 | 239 | break; | |
| 12018 | |||
| 12019 | case itype_bomb: | ||
| 12020 | { | ||
| 12021 | //Remote detonation | ||
| 12022 |
3/4✓ Branch 0 taken 1338 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 1334 times.
|
1338 | if(Lwpns.idCount(wLitBomb) >= zc_max(itm.misc2,1)) |
| 12023 | { | ||
| 12024 | 4 | weapon *ew = (weapon*)(Lwpns.spr(Lwpns.idFirst(wLitBomb))); | |
| 12025 | |||
| 12026 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
|
4 | while(Lwpns.idCount(wLitBomb) && ew->misc == 0) |
| 12027 | { | ||
| 12028 | //If this ever needs a version check, in the future. -z | ||
| 12029 | ✗ | if ( FFCore.getQuestHeaderInfo(vZelda) > 0x250 || ( FFCore.getQuestHeaderInfo(vZelda) == 0x250 && FFCore.getQuestHeaderInfo(vBuild) > 31 ) ) | |
| 12030 | { | ||
| 12031 | ✗ | if ( ew->power > 1 ) //Don't reduce 1 to 0. -Z | |
| 12032 | ✗ | ew->power *= 0.5; //Remote bombs were dealing double damage. -Z | |
| 12033 | ✗ | } | |
| 12034 | ✗ | ew->misc=50; | |
| 12035 | ✗ | ew->clk=ew->misc-3; | |
| 12036 | ✗ | ew->id=wBomb; | |
| 12037 | ✗ | ew = (weapon*)(Lwpns.spr(Lwpns.idFirst(wLitBomb))); | |
| 12038 | } | ||
| 12039 | |||
| 12040 | 4 | deselectbombs(false); | |
| 12041 | 4 | return false; | |
| 12042 | } | ||
| 12043 | |||
| 12044 |
3/4✓ Branch 0 taken 17 times.
✓ Branch 1 taken 1317 times.
✓ Branch 2 taken 17 times.
✗ Branch 3 not taken.
|
1334 | if((itm.flags & item_flag4) && lift_wpn) |
| 12045 | { | ||
| 12046 | ✗ | do_liftglove(-1,false); //Throw the already-held weapon | |
| 12047 | ✗ | return false; | |
| 12048 | } | ||
| 12049 |
2/4✓ Branch 0 taken 1334 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1334 times.
|
1334 | if(!(checkbunny(itemid) && checkmagiccost(itemid))) |
| 12050 | { | ||
| 12051 | ✗ | return item_error(); | |
| 12052 | } | ||
| 12053 | |||
| 12054 | 1334 | paymagiccost(itemid); | |
| 12055 | |||
| 12056 |
1/2✓ Branch 0 taken 1334 times.
✗ Branch 1 not taken.
|
1334 | if(itm.misc1>0) // If not remote bombs |
| 12057 | 1334 | deselectbombs(false); | |
| 12058 | |||
| 12059 |
2/2✓ Branch 0 taken 380 times.
✓ Branch 1 taken 954 times.
|
1334 | if(isdungeon()) |
| 12060 | { | ||
| 12061 |
2/2✓ Branch 0 taken 36 times.
✓ Branch 1 taken 918 times.
|
954 | wy=zc_max(wy,16); |
| 12062 | 954 | } | |
| 12063 | |||
| 12064 |
4/8✓ Branch 0 taken 1334 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1334 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1334 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1334 times.
✗ Branch 7 not taken.
|
2668 | weapon* wpn = new weapon((zfix)wx,(zfix)wy,(zfix)wz,wLitBomb,itm.fam_type, |
| 12065 |
2/4✓ Branch 0 taken 1334 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1334 times.
✗ Branch 3 not taken.
|
1334 | itm.power*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true); |
| 12066 | 1334 | bool lifted = false; | |
| 12067 |
2/2✓ Branch 0 taken 1317 times.
✓ Branch 1 taken 17 times.
|
1334 | if(itm.flags & item_flag4) |
| 12068 | { | ||
| 12069 | 17 | auto liftid = current_item_id(itype_liftglove); | |
| 12070 | 17 | itemdata const& glove = itemsbuf[liftid]; | |
| 12071 |
3/6✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 17 times.
✗ Branch 5 not taken.
|
17 | if(liftid > -1 && (!itm.misc4 || itm.misc4 <= glove.fam_type)) |
| 12072 | { | ||
| 12073 | 17 | lift(wpn,itm.misc5,itm.misc6); | |
| 12074 | 17 | set_liftflags(liftid); | |
| 12075 | 17 | lifted = true; | |
| 12076 | 17 | } | |
| 12077 | 17 | } | |
| 12078 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 1317 times.
|
1334 | if(!lifted) |
| 12079 | { | ||
| 12080 | 1317 | Lwpns.add(wpn); | |
| 12081 | 1317 | sfx(WAV_PLACE,pan(wx)); | |
| 12082 | 1317 | } | |
| 12083 | } | ||
| 12084 | 1334 | break; | |
| 12085 | |||
| 12086 | case itype_sbomb: | ||
| 12087 | { | ||
| 12088 | //Remote detonation | ||
| 12089 |
2/4✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 35 times.
|
35 | if(Lwpns.idCount(wLitSBomb) >= zc_max(itm.misc2,1)) |
| 12090 | { | ||
| 12091 | ✗ | weapon *ew = (weapon*)(Lwpns.spr(Lwpns.idFirst(wLitSBomb))); | |
| 12092 | |||
| 12093 | ✗ | while(Lwpns.idCount(wLitSBomb) && ew->misc == 0) | |
| 12094 | { | ||
| 12095 | ✗ | ew->misc=50; | |
| 12096 | ✗ | ew->clk=ew->misc-3; | |
| 12097 | ✗ | ew->id=wSBomb; | |
| 12098 | ✗ | ew = (weapon*)(Lwpns.spr(Lwpns.idFirst(wLitSBomb))); | |
| 12099 | } | ||
| 12100 | |||
| 12101 | ✗ | deselectbombs(true); | |
| 12102 | ✗ | return false; | |
| 12103 | } | ||
| 12104 | |||
| 12105 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 35 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
35 | if((itm.flags & item_flag4) && lift_wpn) |
| 12106 | { | ||
| 12107 | ✗ | do_liftglove(-1,false); //Throw the already-held weapon | |
| 12108 | ✗ | return false; | |
| 12109 | } | ||
| 12110 |
2/4✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 35 times.
|
35 | if(!(checkbunny(itemid) && checkmagiccost(itemid))) |
| 12111 | { | ||
| 12112 | ✗ | return item_error(); | |
| 12113 | } | ||
| 12114 | |||
| 12115 | 35 | paymagiccost(itemid); | |
| 12116 | |||
| 12117 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 35 times.
|
35 | if(itm.misc1>0) // If not remote bombs |
| 12118 | 35 | deselectbombs(true); | |
| 12119 | |||
| 12120 |
6/12✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 35 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 35 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 35 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 35 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 35 times.
✗ Branch 11 not taken.
|
35 | weapon* wpn = new weapon((zfix)wx,(zfix)wy,(zfix)wz,wLitSBomb,itm.fam_type,itm.power*game->get_hero_dmgmult(),dir, itemid,getUID(),false,false,true); |
| 12121 | 35 | bool lifted = false; | |
| 12122 |
1/2✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
|
35 | if(itm.flags & item_flag4) |
| 12123 | { | ||
| 12124 | ✗ | auto liftid = current_item_id(itype_liftglove); | |
| 12125 | ✗ | itemdata const& glove = itemsbuf[liftid]; | |
| 12126 | ✗ | if(liftid > -1 && (!itm.misc4 || itm.misc4 <= glove.fam_type)) | |
| 12127 | { | ||
| 12128 | ✗ | lift(wpn,itm.misc5,itm.misc6); | |
| 12129 | ✗ | set_liftflags(liftid); | |
| 12130 | ✗ | lifted = true; | |
| 12131 | ✗ | } | |
| 12132 | ✗ | } | |
| 12133 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 35 times.
|
35 | if(!lifted) |
| 12134 | { | ||
| 12135 | 35 | Lwpns.add(wpn); | |
| 12136 | 35 | sfx(WAV_PLACE,pan(wx)); | |
| 12137 | 35 | } | |
| 12138 | } | ||
| 12139 | 35 | break; | |
| 12140 | |||
| 12141 | case itype_wand: | ||
| 12142 | { | ||
| 12143 |
2/2✓ Branch 0 taken 440 times.
✓ Branch 1 taken 1397 times.
|
1837 | if(Lwpns.idCount(wMagic)) |
| 12144 | { | ||
| 12145 | 440 | misc_internal_hero_flags &= ~LF_PAID_WAND_COST; | |
| 12146 | 440 | return false; | |
| 12147 | } | ||
| 12148 | |||
| 12149 | 1397 | int32_t bookid = current_item_id(itype_book); | |
| 12150 |
3/4✓ Branch 0 taken 716 times.
✓ Branch 1 taken 681 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 716 times.
|
1397 | bool paybook = (bookid>-1 && checkbunny(bookid) && checkmagiccost(bookid)); |
| 12151 | |||
| 12152 |
4/4✓ Branch 0 taken 173 times.
✓ Branch 1 taken 1224 times.
✓ Branch 2 taken 34 times.
✓ Branch 3 taken 139 times.
|
1397 | if(!(itm.flags&item_flag1) && !paybook) //Can the wand shoot without the book? |
| 12153 | { | ||
| 12154 | 139 | misc_internal_hero_flags &= ~LF_PAID_WAND_COST; | |
| 12155 | 139 | return false; | |
| 12156 | } | ||
| 12157 | |||
| 12158 |
4/6✓ Branch 0 taken 1258 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1258 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1255 times.
✓ Branch 5 taken 3 times.
|
1258 | if(!checkbunny(itemid) || !(misc_internal_hero_flags & LF_PAID_WAND_COST || checkmagiccost(itemid))) |
| 12159 | { | ||
| 12160 | 3 | return item_error(); | |
| 12161 | } | ||
| 12162 | |||
| 12163 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1251 times.
|
1255 | if(Lwpns.idCount(wBeam)) |
| 12164 | 4 | Lwpns.del(Lwpns.idFirst(wBeam)); | |
| 12165 | |||
| 12166 | int32_t type, pow; | ||
| 12167 |
2/2✓ Branch 0 taken 533 times.
✓ Branch 1 taken 722 times.
|
1255 | if ( get_qr(qr_BROKENBOOKCOST) ) |
| 12168 | { | ||
| 12169 |
2/2✓ Branch 0 taken 120 times.
✓ Branch 1 taken 413 times.
|
533 | type = bookid != -1 ? current_item(itype_book) : itm.fam_type; |
| 12170 |
2/2✓ Branch 0 taken 120 times.
✓ Branch 1 taken 413 times.
|
533 | pow = (bookid != -1 ? current_item_power(itype_book) : itm.power)*game->get_hero_dmgmult(); |
| 12171 | 533 | } | |
| 12172 | else | ||
| 12173 | { | ||
| 12174 |
3/4✓ Branch 0 taken 303 times.
✓ Branch 1 taken 419 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 303 times.
|
722 | type = (bookid != -1 && paybook) ? current_item(itype_book) : itm.fam_type; |
| 12175 |
3/4✓ Branch 0 taken 303 times.
✓ Branch 1 taken 419 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 303 times.
|
722 | pow = ((bookid != -1 && paybook) ? current_item_power(itype_book) : itm.power)*game->get_hero_dmgmult(); |
| 12176 | } | ||
| 12177 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 1255 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2510 times.
✓ Branch 4 taken 1255 times.
✓ Branch 5 taken 1255 times.
|
2510 | for(int32_t i=(spins==1?up:dir); i<=(spins==1 ? right:dir); i++) |
| 12178 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1255 times.
|
2510 | if(dir!=(i^1)) |
| 12179 | { | ||
| 12180 |
5/10✓ Branch 0 taken 1255 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1255 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1255 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1255 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1255 times.
✗ Branch 9 not taken.
|
1255 | weapon *magic = new weapon((zfix)wx,(zfix)wy,(zfix)wz,wMagic,type,pow,i, itemid,getUID(),false,false,true); |
| 12181 |
2/2✓ Branch 0 taken 539 times.
✓ Branch 1 taken 716 times.
|
1255 | if(paybook) |
| 12182 | 716 | magic->linkedItem = bookid; | |
| 12183 | //magic->dir = this->dir; //Save player dir for special weapons. | ||
| 12184 | 1255 | Lwpns.add(magic); | |
| 12185 | 1255 | } | |
| 12186 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1255 times.
|
1255 | if(!(misc_internal_hero_flags & LF_PAID_WAND_COST)) |
| 12187 | 1255 | paymagiccost(itemid); | |
| 12188 | ✗ | else misc_internal_hero_flags &= ~LF_PAID_WAND_COST; | |
| 12189 | |||
| 12190 |
2/2✓ Branch 0 taken 539 times.
✓ Branch 1 taken 716 times.
|
1255 | if(paybook) |
| 12191 | 716 | paymagiccost(current_item_id(itype_book)); | |
| 12192 | |||
| 12193 |
2/2✓ Branch 0 taken 716 times.
✓ Branch 1 taken 539 times.
|
1255 | if(bookid != -1) |
| 12194 | { | ||
| 12195 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 716 times.
|
716 | if (( itemsbuf[bookid].flags & item_flag4 )) |
| 12196 | { | ||
| 12197 | ✗ | sfx(itemsbuf[bookid].misc2,pan(wx)); | |
| 12198 | ✗ | } | |
| 12199 | else | ||
| 12200 | { | ||
| 12201 | 716 | sfx(itm.usesound,pan(wx)); | |
| 12202 | } | ||
| 12203 | 716 | } | |
| 12204 | else | ||
| 12205 | 539 | sfx(itm.usesound,pan(wx)); | |
| 12206 | } | ||
| 12207 | /* | ||
| 12208 | // Fireball Wand | ||
| 12209 | Lwpns.add(new weapon((zfix)wx,(zfix)wy,(zfix)wz,wRefFireball,0,2*game->get_hero_dmgmult(),dir)); | ||
| 12210 | switch (dir) | ||
| 12211 | { | ||
| 12212 | case up: | ||
| 12213 | Lwpns.spr(Lwpns.Count()-1)->angle=-PI/2; | ||
| 12214 | Lwpns.spr(Lwpns.Count()-1)->dir=up; | ||
| 12215 | break; | ||
| 12216 | case down: | ||
| 12217 | Lwpns.spr(Lwpns.Count()-1)->angle=PI/2; | ||
| 12218 | Lwpns.spr(Lwpns.Count()-1)->dir=down; | ||
| 12219 | break; | ||
| 12220 | case left: | ||
| 12221 | Lwpns.spr(Lwpns.Count()-1)->angle=PI; | ||
| 12222 | Lwpns.spr(Lwpns.Count()-1)->dir=left; | ||
| 12223 | break; | ||
| 12224 | case right: | ||
| 12225 | Lwpns.spr(Lwpns.Count()-1)->angle=0; | ||
| 12226 | Lwpns.spr(Lwpns.Count()-1)->dir=right; | ||
| 12227 | break; | ||
| 12228 | } | ||
| 12229 | Lwpns.spr(Lwpns.Count()-1)->clk=16; | ||
| 12230 | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->step=3.5; | ||
| 12231 | Lwpns.spr(Lwpns.Count()-1)->dummy_bool[0]=true; //homing | ||
| 12232 | */ | ||
| 12233 | 1255 | break; | |
| 12234 | |||
| 12235 | case itype_sword: | ||
| 12236 | { | ||
| 12237 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 19942 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
19942 | if(!(checkbunny(itemid) || !(misc_internal_hero_flags & LF_PAID_SWORD_COST || checkmagiccost(itemid)))) |
| 12238 | { | ||
| 12239 | ✗ | return item_error(); | |
| 12240 | } | ||
| 12241 | |||
| 12242 |
4/4✓ Branch 0 taken 4249 times.
✓ Branch 1 taken 15693 times.
✓ Branch 2 taken 4249 times.
✓ Branch 3 taken 15693 times.
|
19942 | if((Lwpns.idCount(wBeam) && spins==0)||Lwpns.idCount(wMagic)) |
| 12243 | { | ||
| 12244 | 4249 | misc_internal_hero_flags &= ~LF_PAID_SWORD_COST; | |
| 12245 | 4249 | return false; | |
| 12246 | } | ||
| 12247 | |||
| 12248 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15693 times.
|
15693 | if(!(misc_internal_hero_flags & LF_PAID_SWORD_COST))//If already paid to use sword melee, don't charge again |
| 12249 | 15693 | paymagiccost(itemid); | |
| 12250 | ✗ | else misc_internal_hero_flags &= ~LF_PAID_SWORD_COST; | |
| 12251 | float temppower; | ||
| 12252 | |||
| 12253 |
1/2✓ Branch 0 taken 15693 times.
✗ Branch 1 not taken.
|
15693 | if(itm.flags & item_flag2) |
| 12254 | { | ||
| 12255 | 15693 | temppower=game->get_hero_dmgmult()*itm.power; | |
| 12256 | 15693 | temppower=temppower*itm.misc2; | |
| 12257 | 15693 | temppower=temppower/100; | |
| 12258 | 15693 | } | |
| 12259 | else | ||
| 12260 | { | ||
| 12261 | ✗ | temppower = game->get_hero_dmgmult()*itm.misc2; | |
| 12262 | } | ||
| 12263 | |||
| 12264 | //Lwpns.add(new weapon((zfix)wx,(zfix)wy,(zfix)wz,wBeam,itm.fam_type,int32_t(temppower),dir,itemid,getUID())); | ||
| 12265 | //Add weapon script to sword beams. | ||
| 12266 |
5/10✓ Branch 0 taken 15693 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15693 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 15693 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 15693 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 15693 times.
✗ Branch 9 not taken.
|
15693 | Lwpns.add(new weapon((zfix)wx,(zfix)wy,(zfix)wz,wBeam,itm.fam_type,int32_t(temppower),dir,itemid,getUID(),false,false,true)); |
| 12267 | //weapon *w = (weapon*)Lwpns.spr(Lwpns.Count()-1); //the pointer to this beam | ||
| 12268 | //w->weaponscript = itm.weaponscript; | ||
| 12269 | //w->canrunscript = 0; | ||
| 12270 | 15693 | sfx(WAV_BEAM,pan(wx)); | |
| 12271 | } | ||
| 12272 | 15693 | break; | |
| 12273 | |||
| 12274 | case itype_candle: | ||
| 12275 | { | ||
| 12276 | 1791 | int32_t countid = itemid; | |
| 12277 |
2/2✓ Branch 0 taken 75 times.
✓ Branch 1 taken 1716 times.
|
1791 | if(get_qr(qr_CANDLES_SHARED_LIMIT)) |
| 12278 | 1716 | countid = -itype_candle; | |
| 12279 |
5/6✓ Branch 0 taken 1395 times.
✓ Branch 1 taken 396 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 396 times.
✓ Branch 4 taken 19 times.
✓ Branch 5 taken 1772 times.
|
1791 | if(itm.flags&item_flag1 && usecounts[countid] >= zc_max(1, itm.misc3)) |
| 12280 | { | ||
| 12281 | 19 | return false; | |
| 12282 | } | ||
| 12283 | |||
| 12284 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 1772 times.
✓ Branch 2 taken 96 times.
✓ Branch 3 taken 1676 times.
|
1772 | if(Lwpns.idCount(wFire) >= (itm.misc2 < 1 ? 2 : itm.misc2)) |
| 12285 | { | ||
| 12286 | 96 | return false; | |
| 12287 | } | ||
| 12288 | |||
| 12289 |
3/4✓ Branch 0 taken 1676 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✓ Branch 3 taken 1667 times.
|
1676 | if(!(checkbunny(itemid) && checkmagiccost(itemid))) |
| 12290 | { | ||
| 12291 | 9 | return item_error(); | |
| 12292 | } | ||
| 12293 | |||
| 12294 | 1667 | paymagiccost(itemid); | |
| 12295 | |||
| 12296 |
2/2✓ Branch 0 taken 369 times.
✓ Branch 1 taken 1298 times.
|
1667 | if(itm.flags&item_flag1) ++usecounts[countid]; |
| 12297 | |||
| 12298 |
4/8✓ Branch 0 taken 1667 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1667 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1667 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1667 times.
✗ Branch 7 not taken.
|
3334 | Lwpns.add(new weapon((zfix)wx,(zfix)wy,(zfix)wz,wFire, |
| 12299 | //(itm.fam_type > 1), //To do with combo flags ... Needs to be changed to fix ->Level for wFire | ||
| 12300 | 1667 | (itm.fam_type), //To do with combo flags ... Needs to be changed to fix ->Level for wFire | |
| 12301 |
2/4✓ Branch 0 taken 1667 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1667 times.
✗ Branch 3 not taken.
|
1667 | itm.power*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); |
| 12302 | 1667 | sfx(itm.usesound,pan(wx)); | |
| 12303 | 1667 | attack=wFire; | |
| 12304 | } | ||
| 12305 | 1667 | break; | |
| 12306 | |||
| 12307 | case itype_script1: case itype_script2: case itype_script3: case itype_script4: case itype_script5: | ||
| 12308 | case itype_script6: case itype_script7: case itype_script8: case itype_script9: case itype_script10: | ||
| 12309 | { | ||
| 12310 | ✗ | int32_t wtype = wScript1 + (itm.family-itype_script1); | |
| 12311 | ✗ | if(Lwpns.idCount(wtype)) | |
| 12312 | ✗ | return false; | |
| 12313 | |||
| 12314 | ✗ | if(!(checkbunny(itemid) && checkmagiccost(itemid))) | |
| 12315 | { | ||
| 12316 | ✗ | return item_error(); | |
| 12317 | } | ||
| 12318 | |||
| 12319 | ✗ | if(!get_qr(qr_CUSTOMWEAPON_IGNORE_COST)) | |
| 12320 | ✗ | paymagiccost(itemid); | |
| 12321 | |||
| 12322 | ✗ | zfix wpnstep = zfix(itm.misc1)/100; | |
| 12323 | ✗ | if(replay_version_check(0,30)) | |
| 12324 | ✗ | wpnstep = itm.misc1/100; | |
| 12325 | |||
| 12326 | ✗ | Lwpns.add(new weapon((zfix)wx,(zfix)wy,(zfix)wz,wtype,itm.fam_type,game->get_hero_dmgmult()*itm.power,dir,itemid,getUID(),false,false,true)); | |
| 12327 | ✗ | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->step = wpnstep; | |
| 12328 | ✗ | sfx(itm.usesound,pan(wx)); | |
| 12329 | } | ||
| 12330 | ✗ | break; | |
| 12331 | |||
| 12332 | case itype_icerod: | ||
| 12333 | { | ||
| 12334 | ✗ | if(Lwpns.idCount(wIce)) | |
| 12335 | ✗ | return false; | |
| 12336 | |||
| 12337 | ✗ | if(!(checkbunny(itemid) && checkmagiccost(itemid))) | |
| 12338 | { | ||
| 12339 | ✗ | return item_error(); | |
| 12340 | } | ||
| 12341 | |||
| 12342 | ✗ | if(!get_qr(qr_CUSTOMWEAPON_IGNORE_COST)) | |
| 12343 | ✗ | paymagiccost(itemid); | |
| 12344 | |||
| 12345 | ✗ | zfix wpnstep = zfix(itm.misc1)/100; | |
| 12346 | ✗ | if(replay_version_check(0,30)) | |
| 12347 | ✗ | wpnstep = itm.misc1/100; | |
| 12348 | |||
| 12349 | ✗ | Lwpns.add(new weapon((zfix)wx,(zfix)wy,(zfix)wz,wIce,itm.fam_type,game->get_hero_dmgmult()*itm.power,dir,itemid,getUID(),false,false,true)); | |
| 12350 | ✗ | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->step = wpnstep; | |
| 12351 | ✗ | sfx(itm.usesound,pan(wx)); | |
| 12352 | } | ||
| 12353 | ✗ | break; | |
| 12354 | |||
| 12355 | case itype_arrow: | ||
| 12356 | { | ||
| 12357 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 2335 times.
✓ Branch 2 taken 89 times.
✓ Branch 3 taken 2246 times.
|
2335 | if(Lwpns.idCount(wArrow) >= (itm.misc2 < 1 ? 1 : itm.misc2)) |
| 12358 | 89 | return false; | |
| 12359 | |||
| 12360 |
3/4✓ Branch 0 taken 2246 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14 times.
✓ Branch 3 taken 2232 times.
|
2246 | if(!(checkbunny(itemid) && checkmagiccost(itemid))) |
| 12361 | { | ||
| 12362 | 14 | return item_error(); | |
| 12363 | } | ||
| 12364 | |||
| 12365 | 2232 | paymagiccost(itemid); | |
| 12366 | |||
| 12367 |
6/12✓ Branch 0 taken 2232 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2232 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2232 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2232 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2232 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 2232 times.
✗ Branch 11 not taken.
|
2232 | Lwpns.add(new weapon((zfix)wx,(zfix)wy,(zfix)wz,wArrow,itm.fam_type,game->get_hero_dmgmult()*itm.power,dir,itemid,getUID(),false,false,true)); |
| 12368 | 2232 | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->step*=(current_item_power(itype_bow)+1)/2; | |
| 12369 | 2232 | sfx(itm.usesound,pan(wx)); | |
| 12370 | } | ||
| 12371 | 2232 | break; | |
| 12372 | |||
| 12373 | case itype_bait: | ||
| 12374 | { | ||
| 12375 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
|
20 | if(Lwpns.idCount(wBait)) //TODO: More than one Bait per screen? |
| 12376 | ✗ | return false; | |
| 12377 | |||
| 12378 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 3 times.
|
20 | if(!checkbunny(itemid)) |
| 12379 | 3 | return item_error(); | |
| 12380 | |||
| 12381 |
4/6✓ Branch 0 taken 1 times.
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 16 times.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
|
33 | bool grumble = (tmpscr->room==rGRUMBLE && (!getmapflag((currscr < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM) || (tmpscr->flags9&fBELOWRETURN))); |
| 12382 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 1 times.
|
17 | bool checkcost = grumble || !(itm.flags & item_flag4); |
| 12383 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 1 times.
|
17 | bool paycost = grumble || !(itm.flags & (item_flag4|item_flag5)); |
| 12384 | |||
| 12385 |
3/4✓ Branch 0 taken 1 times.
✓ Branch 1 taken 16 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
17 | if(!grumble && (itm.flags & item_flag2)) |
| 12386 | ✗ | return item_error(); //Only usable for grumble rooms | |
| 12387 | |||
| 12388 |
2/4✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
✗ Branch 3 not taken.
|
17 | if(checkcost && !checkmagiccost(itemid)) |
| 12389 | ✗ | return item_error(); | |
| 12390 | |||
| 12391 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
|
17 | if(paycost) |
| 12392 | 17 | paymagiccost(itemid); | |
| 12393 | 17 | sfx(itm.usesound,pan(wx)); | |
| 12394 | |||
| 12395 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 1 times.
|
17 | if(grumble) |
| 12396 | { | ||
| 12397 |
4/8✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 16 times.
✗ Branch 7 not taken.
|
16 | items.add(new item((zfix)wx,(zfix)wy,(zfix)0,itemid,ipDUMMY+ipFADE,0)); |
| 12398 | 16 | fadeclk=66; | |
| 12399 | 16 | dismissmsg(); | |
| 12400 | 16 | clear_bitmap(pricesdisplaybuf); | |
| 12401 | 16 | set_clip_state(pricesdisplaybuf, 1); | |
| 12402 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | setmapflag((currscr < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM); |
| 12403 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | if(!(itm.flags & item_flag3)) //"Don't remove when feeding" flag |
| 12404 | { | ||
| 12405 | 16 | removeItemsOfFamily(game,itemsbuf,itype_bait); | |
| 12406 | 16 | verifyBothWeapons(); | |
| 12407 | 16 | } | |
| 12408 | 16 | sfx(tmpscr->secretsfx); | |
| 12409 | 16 | return false; | |
| 12410 | } | ||
| 12411 | |||
| 12412 |
5/10✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
|
1 | Lwpns.add(new weapon((zfix)wx,(zfix)wy,(zfix)wz,wBait,0,0,dir,itemid,getUID(),false,false,true)); |
| 12413 | 1 | break; | |
| 12414 | } | ||
| 12415 | |||
| 12416 | case itype_brang: | ||
| 12417 | { | ||
| 12418 |
2/2✓ Branch 0 taken 327 times.
✓ Branch 1 taken 13603 times.
|
13930 | if(Lwpns.idCount(wBrang) > itm.misc2) |
| 12419 | 327 | return false; | |
| 12420 | |||
| 12421 |
2/4✓ Branch 0 taken 13603 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 13603 times.
|
13603 | if(!(checkbunny(itemid) && checkmagiccost(itemid))) |
| 12422 | { | ||
| 12423 | ✗ | return item_error(); | |
| 12424 | } | ||
| 12425 | |||
| 12426 | 13603 | paymagiccost(itemid); | |
| 12427 | 13603 | current_item_power(itype_brang); | |
| 12428 |
6/12✓ Branch 0 taken 13603 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13603 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 13603 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 13603 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 13603 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 13603 times.
✗ Branch 11 not taken.
|
13603 | Lwpns.add(new weapon((zfix)wx,(zfix)wy,(zfix)wz,wBrang,itm.fam_type,(itm.power*game->get_hero_dmgmult()),dir,itemid,getUID(),false,false,true)); |
| 12429 | } | ||
| 12430 | 13603 | break; | |
| 12431 | |||
| 12432 | case itype_hookshot: | ||
| 12433 | case itype_switchhook: | ||
| 12434 | { | ||
| 12435 |
3/4✓ Branch 0 taken 2483 times.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2483 times.
|
2484 | if(inlikelike || Lwpns.idCount(wHookshot)) |
| 12436 | 1 | return false; | |
| 12437 | |||
| 12438 |
2/4✓ Branch 0 taken 2483 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2483 times.
|
2483 | if(!(checkbunny(itemid) && checkmagiccost(itemid))) |
| 12439 | { | ||
| 12440 | ✗ | return item_error(); | |
| 12441 | } | ||
| 12442 | 2483 | bool sw = itm.family == itype_switchhook; | |
| 12443 | |||
| 12444 |
3/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2481 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2483 | if(sw && (itm.flags&item_flag8)) |
| 12445 | ✗ | switchhook_cost_item = itemid; | |
| 12446 | 2483 | else paymagiccost(itemid); | |
| 12447 | |||
| 12448 | 2483 | bool use_hookshot=true; | |
| 12449 | 2483 | bool hit_hs = false, hit_solid = false, insta_switch = false; | |
| 12450 |
2/2✓ Branch 0 taken 99 times.
✓ Branch 1 taken 2384 times.
|
2483 | int32_t max_layer = get_qr(qr_HOOKSHOTALLLAYER) ? 6 : (get_qr(qr_HOOKSHOTLAYERFIX) ? 2 : 0); |
| 12451 | 2483 | int32_t cpos = -1, ffcpos = -1; | |
| 12452 |
4/4✓ Branch 0 taken 2449 times.
✓ Branch 1 taken 5758 times.
✓ Branch 2 taken 5724 times.
✓ Branch 3 taken 2483 times.
|
8207 | for(int32_t i=0; i<=max_layer && !hit_hs; ++i) |
| 12453 | { | ||
| 12454 |
2/2✓ Branch 0 taken 1005 times.
✓ Branch 1 taken 4719 times.
|
5724 | if(dir==up) |
| 12455 | { | ||
| 12456 |
2/2✓ Branch 0 taken 981 times.
✓ Branch 1 taken 24 times.
|
1005 | if(check_hshot(i,x+2,y-7,sw, &cpos, &ffcpos)) |
| 12457 | 24 | hit_hs = true; | |
| 12458 | 1005 | } | |
| 12459 |
2/2✓ Branch 0 taken 1046 times.
✓ Branch 1 taken 3673 times.
|
4719 | else if(dir==down) |
| 12460 | { | ||
| 12461 |
1/2✓ Branch 0 taken 1046 times.
✗ Branch 1 not taken.
|
1046 | if(check_hshot(i,x+12,y+23,sw, &cpos, &ffcpos)) |
| 12462 | ✗ | hit_hs = true; | |
| 12463 | 1046 | } | |
| 12464 |
2/2✓ Branch 0 taken 1822 times.
✓ Branch 1 taken 1851 times.
|
3673 | else if(dir==left) |
| 12465 | { | ||
| 12466 |
2/2✓ Branch 0 taken 1813 times.
✓ Branch 1 taken 9 times.
|
1822 | if(check_hshot(i,x-7,y+12,sw, &cpos, &ffcpos)) |
| 12467 | 9 | hit_hs = true; | |
| 12468 | 1822 | } | |
| 12469 |
1/2✓ Branch 0 taken 1851 times.
✗ Branch 1 not taken.
|
1851 | else if(dir==right) |
| 12470 | { | ||
| 12471 |
2/2✓ Branch 0 taken 1848 times.
✓ Branch 1 taken 3 times.
|
1851 | if(check_hshot(i,x+23,y+12,sw, &cpos, &ffcpos)) |
| 12472 | 3 | hit_hs = true; | |
| 12473 | 1851 | } | |
| 12474 | //Diagonal Hookshot (6) | ||
| 12475 | ✗ | else if(dir==r_down) | |
| 12476 | { | ||
| 12477 | ✗ | if(check_hshot(i,x+9,y+13,sw, &cpos, &ffcpos)) | |
| 12478 | ✗ | hit_hs = true; | |
| 12479 | ✗ | } | |
| 12480 | ✗ | else if(dir==l_down) | |
| 12481 | { | ||
| 12482 | ✗ | if(check_hshot(i,x+6,y+13,sw, &cpos, &ffcpos)) | |
| 12483 | ✗ | hit_hs = true; | |
| 12484 | ✗ | } | |
| 12485 | ✗ | else if(dir==r_up) | |
| 12486 | { | ||
| 12487 | ✗ | if(check_hshot(i,x+9,y+13,sw, &cpos, &ffcpos)) | |
| 12488 | ✗ | hit_hs = true; | |
| 12489 | ✗ | } | |
| 12490 | ✗ | else if(dir==l_up) | |
| 12491 | { | ||
| 12492 | ✗ | if(check_hshot(i,x+6,y+13,sw, &cpos, &ffcpos)) | |
| 12493 | ✗ | hit_hs = true; | |
| 12494 | ✗ | } | |
| 12495 | 5724 | } | |
| 12496 |
8/10✓ Branch 0 taken 2067 times.
✓ Branch 1 taken 416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 416 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 416 times.
✓ Branch 6 taken 362 times.
✓ Branch 7 taken 54 times.
✓ Branch 8 taken 2454 times.
✓ Branch 9 taken 29 times.
|
2483 | if(dir==up && _walkflag(x+2,y+4,1,SWITCHBLOCK_STATE) && !ishookshottable(x.getInt(),int32_t(y+4))) |
| 12497 | 29 | hit_solid = true; | |
| 12498 |
2/2✓ Branch 0 taken 2447 times.
✓ Branch 1 taken 36 times.
|
2483 | if(hit_hs) |
| 12499 | { | ||
| 12500 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36 times.
|
36 | if(sw) |
| 12501 | ✗ | insta_switch = true; //switch immediately | |
| 12502 | 36 | else use_hookshot = false; //No hooking against grabbable | |
| 12503 | 36 | } | |
| 12504 |
3/4✓ Branch 0 taken 29 times.
✓ Branch 1 taken 2454 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 29 times.
|
2483 | if(hit_solid && !insta_switch) |
| 12505 | 29 | use_hookshot = false; | |
| 12506 |
2/2✓ Branch 0 taken 50 times.
✓ Branch 1 taken 2433 times.
|
2483 | if(use_hookshot) |
| 12507 | { | ||
| 12508 | 2433 | int32_t hookitem = itm.fam_type; | |
| 12509 | 2433 | int32_t hookpower = itm.power; | |
| 12510 | 2433 | byte allow_diagonal = (itm.flags & item_flag2) ? 1 : 0; | |
| 12511 | |||
| 12512 |
1/2✓ Branch 0 taken 2433 times.
✗ Branch 1 not taken.
|
2433 | if(!Lwpns.has_space()) |
| 12513 | { | ||
| 12514 | ✗ | Lwpns.del(0); | |
| 12515 | ✗ | } | |
| 12516 | |||
| 12517 |
1/2✓ Branch 0 taken 2433 times.
✗ Branch 1 not taken.
|
2433 | if(!Lwpns.has_space(2)) |
| 12518 | { | ||
| 12519 | ✗ | Lwpns.del(0); | |
| 12520 | ✗ | } | |
| 12521 | |||
| 12522 |
4/9✗ Branch 0 not taken.
✓ Branch 1 taken 378 times.
✓ Branch 2 taken 440 times.
✓ Branch 3 taken 783 times.
✓ Branch 4 taken 832 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
2433 | switch(dir) |
| 12523 | { | ||
| 12524 | case up: | ||
| 12525 | { | ||
| 12526 | 378 | hookshot_used=true; | |
| 12527 | 378 | hs_switcher = sw; | |
| 12528 |
4/8✓ Branch 0 taken 378 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 378 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 378 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 378 times.
✗ Branch 7 not taken.
|
756 | Lwpns.add(new weapon((zfix)wx,(zfix)wy,(zfix)wz,wHSHandle,hookitem, |
| 12529 |
2/4✓ Branch 0 taken 378 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 378 times.
✗ Branch 3 not taken.
|
378 | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); |
| 12530 | 378 | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.family; | |
| 12531 |
5/10✓ Branch 0 taken 378 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 378 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 378 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 378 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 378 times.
✗ Branch 9 not taken.
|
756 | Lwpns.add(new weapon((zfix)wx,(zfix)wy-4,(zfix)wz,wHookshot,hookitem, |
| 12532 |
2/4✓ Branch 0 taken 378 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 378 times.
✗ Branch 3 not taken.
|
378 | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); |
| 12533 | 378 | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.family; | |
| 12534 | 378 | hs_startx=wx; | |
| 12535 | 378 | hs_starty=wy-4; | |
| 12536 | } | ||
| 12537 | 378 | break; | |
| 12538 | |||
| 12539 | case down: | ||
| 12540 | { | ||
| 12541 | 440 | int32_t offset=get_qr(qr_HOOKSHOTDOWNBUG)?4:0; | |
| 12542 | 440 | hookshot_used=true; | |
| 12543 | 440 | hs_switcher = sw; | |
| 12544 |
5/10✓ Branch 0 taken 440 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 440 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 440 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 440 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 440 times.
✗ Branch 9 not taken.
|
880 | Lwpns.add(new weapon((zfix)wx,(zfix)wy+offset,(zfix)wz,wHSHandle,hookitem, |
| 12545 |
2/4✓ Branch 0 taken 440 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 440 times.
✗ Branch 3 not taken.
|
440 | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); |
| 12546 | 440 | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.family; | |
| 12547 |
5/10✓ Branch 0 taken 440 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 440 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 440 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 440 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 440 times.
✗ Branch 9 not taken.
|
880 | Lwpns.add(new weapon((zfix)wx,(zfix)wy+offset,(zfix)wz,wHookshot,hookitem, |
| 12548 |
2/4✓ Branch 0 taken 440 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 440 times.
✗ Branch 3 not taken.
|
440 | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); |
| 12549 | 440 | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.family; | |
| 12550 | 440 | hs_startx=wx; | |
| 12551 | 440 | hs_starty=wy; | |
| 12552 | } | ||
| 12553 | 440 | break; | |
| 12554 | |||
| 12555 | case left: | ||
| 12556 | { | ||
| 12557 | 783 | hookshot_used=true; | |
| 12558 | 783 | hs_switcher = sw; | |
| 12559 |
4/8✓ Branch 0 taken 783 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 783 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 783 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 783 times.
✗ Branch 7 not taken.
|
1566 | Lwpns.add(new weapon((zfix)wx,(zfix)wy,(zfix)wz,wHSHandle,hookitem, |
| 12560 |
2/4✓ Branch 0 taken 783 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 783 times.
✗ Branch 3 not taken.
|
783 | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); |
| 12561 | 783 | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.family; | |
| 12562 |
4/8✓ Branch 0 taken 783 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 783 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 783 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 783 times.
✗ Branch 7 not taken.
|
1566 | Lwpns.add(new weapon((zfix)(wx-4),(zfix)wy,(zfix)wz,wHookshot,hookitem, |
| 12563 |
2/4✓ Branch 0 taken 783 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 783 times.
✗ Branch 3 not taken.
|
783 | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); |
| 12564 | 783 | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.family; | |
| 12565 | 783 | hs_startx=wx-4; | |
| 12566 | 783 | hs_starty=wy; | |
| 12567 | } | ||
| 12568 | 783 | break; | |
| 12569 | |||
| 12570 | case right: | ||
| 12571 | { | ||
| 12572 | 832 | hookshot_used=true; | |
| 12573 | 832 | hs_switcher = sw; | |
| 12574 |
4/8✓ Branch 0 taken 832 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 832 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 832 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 832 times.
✗ Branch 7 not taken.
|
1664 | Lwpns.add(new weapon((zfix)wx,(zfix)wy,(zfix)wz,wHSHandle,hookitem, |
| 12575 |
2/4✓ Branch 0 taken 832 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 832 times.
✗ Branch 3 not taken.
|
832 | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); |
| 12576 | 832 | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.family; | |
| 12577 |
4/8✓ Branch 0 taken 832 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 832 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 832 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 832 times.
✗ Branch 7 not taken.
|
1664 | Lwpns.add(new weapon((zfix)(wx+4),(zfix)wy,(zfix)wz,wHookshot,hookitem, |
| 12578 |
2/4✓ Branch 0 taken 832 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 832 times.
✗ Branch 3 not taken.
|
832 | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); |
| 12579 | 832 | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.family; | |
| 12580 | 832 | hs_startx=wx+4; | |
| 12581 | 832 | hs_starty=wy; | |
| 12582 | } | ||
| 12583 | 832 | break; | |
| 12584 | //Diagonal Hookshot (7) | ||
| 12585 | case r_down: | ||
| 12586 | { | ||
| 12587 | ✗ | hookshot_used=true; | |
| 12588 | ✗ | hs_switcher = sw; | |
| 12589 | ✗ | int32_t offset=get_qr(qr_HOOKSHOTDOWNBUG)?4:0; | |
| 12590 | ✗ | Lwpns.add(new weapon((zfix)wx,(zfix)wy+offset,(zfix)wz,wHSHandle,hookitem, | |
| 12591 | ✗ | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); | |
| 12592 | ✗ | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.family; | |
| 12593 | ✗ | Lwpns.add(new weapon((zfix)(wx+4),(zfix)wy+offset,(zfix)wz,wHookshot,hookitem, | |
| 12594 | ✗ | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); | |
| 12595 | ✗ | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.family; | |
| 12596 | ✗ | hs_startx=wx+4; | |
| 12597 | ✗ | hs_starty=wy; | |
| 12598 | } | ||
| 12599 | ✗ | break; | |
| 12600 | |||
| 12601 | case r_up: | ||
| 12602 | { | ||
| 12603 | ✗ | hookshot_used=true; | |
| 12604 | ✗ | hs_switcher = sw; | |
| 12605 | ✗ | Lwpns.add(new weapon((zfix)wx,(zfix)wy,(zfix)wz,wHSHandle,hookitem, | |
| 12606 | ✗ | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); | |
| 12607 | ✗ | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.family; | |
| 12608 | ✗ | Lwpns.add(new weapon((zfix)(wx+4),(zfix)wy,(zfix)wz,wHookshot,hookitem, | |
| 12609 | ✗ | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); | |
| 12610 | ✗ | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.family; | |
| 12611 | ✗ | hs_startx=wx+4; | |
| 12612 | ✗ | hs_starty=wy; | |
| 12613 | } | ||
| 12614 | ✗ | break; | |
| 12615 | |||
| 12616 | case l_down: | ||
| 12617 | { | ||
| 12618 | ✗ | hookshot_used=true; | |
| 12619 | ✗ | hs_switcher = sw; | |
| 12620 | ✗ | int32_t offset=get_qr(qr_HOOKSHOTDOWNBUG)?4:0; | |
| 12621 | ✗ | Lwpns.add(new weapon((zfix)wx,(zfix)wy+offset,(zfix)wz,wHSHandle,hookitem, | |
| 12622 | ✗ | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); | |
| 12623 | ✗ | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.family; | |
| 12624 | ✗ | Lwpns.add(new weapon((zfix)(wx-4),(zfix)wy+offset,(zfix)wz,wHookshot,hookitem, | |
| 12625 | ✗ | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); | |
| 12626 | ✗ | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.family; | |
| 12627 | ✗ | hs_startx=wx+4; | |
| 12628 | ✗ | hs_starty=wy; | |
| 12629 | } | ||
| 12630 | ✗ | break; | |
| 12631 | |||
| 12632 | case l_up: | ||
| 12633 | { | ||
| 12634 | ✗ | hookshot_used=true; | |
| 12635 | ✗ | hs_switcher = sw; | |
| 12636 | ✗ | Lwpns.add(new weapon((zfix)wx,(zfix)wy,(zfix)wz,wHSHandle,hookitem, | |
| 12637 | ✗ | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); | |
| 12638 | ✗ | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.family; | |
| 12639 | ✗ | Lwpns.add(new weapon((zfix)(wx-4),(zfix)wy,(zfix)wz,wHookshot,hookitem, | |
| 12640 | ✗ | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); | |
| 12641 | ✗ | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.family; | |
| 12642 | ✗ | hs_startx=wx+4; | |
| 12643 | ✗ | hs_starty=wy; | |
| 12644 | } | ||
| 12645 | ✗ | break; | |
| 12646 | } | ||
| 12647 | 2433 | hookshot_frozen=true; | |
| 12648 | 2433 | } | |
| 12649 |
1/2✓ Branch 0 taken 2483 times.
✗ Branch 1 not taken.
|
2483 | if(insta_switch) |
| 12650 | { | ||
| 12651 | ✗ | weapon* w = (weapon*)Lwpns.spr(Lwpns.idFirst(wHookshot)); | |
| 12652 | ✗ | if (cpos > -1) hooked_combopos = cpos; | |
| 12653 | ✗ | if (ffcpos > -1) | |
| 12654 | { | ||
| 12655 | ✗ | switching_object = &(tmpscr->ffcs[ffcpos]); | |
| 12656 | ✗ | switching_object->switch_hooked = true; | |
| 12657 | ✗ | } | |
| 12658 | ✗ | w->misc=2; | |
| 12659 | ✗ | w->step=0; | |
| 12660 | ✗ | doSwitchHook(itm.misc5); | |
| 12661 | ✗ | if(itm.usesound2) | |
| 12662 | ✗ | sfx(itm.usesound2,pan(int32_t(x))); | |
| 12663 | ✗ | else if(QMisc.miscsfx[sfxSWITCHED]) | |
| 12664 | ✗ | sfx(QMisc.miscsfx[sfxSWITCHED],int32_t(x)); | |
| 12665 | ✗ | stop_sfx(itm.usesound); | |
| 12666 | ✗ | } | |
| 12667 | } | ||
| 12668 | 2483 | break; | |
| 12669 | |||
| 12670 | case itype_divinefire: | ||
| 12671 |
3/12✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 12 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
12 | if(z!=0 || fakez!=0 || (isSideViewHero() && !(on_sideview_solid_oldpos(this) || getOnSideviewLadder() || IsSideSwim()))) |
| 12672 | ✗ | return false; | |
| 12673 | |||
| 12674 |
2/4✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 12 times.
|
12 | if(!(checkbunny(itemid) && checkmagiccost(itemid))) |
| 12675 | { | ||
| 12676 | ✗ | return item_error(); | |
| 12677 | } | ||
| 12678 | |||
| 12679 | 12 | paymagiccost(itemid); | |
| 12680 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
12 | if (IsSideSwim()) {action=sideswimcasting; FFCore.setHeroAction(sideswimcasting);} |
| 12681 | 12 | else {action=casting; FFCore.setHeroAction(casting);} | |
| 12682 | 12 | magicitem=itemid; | |
| 12683 | 12 | break; | |
| 12684 | |||
| 12685 | case itype_divineescape: | ||
| 12686 |
3/12✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
8 | if(z!=0 || fakez!=0 || (isSideViewHero() && !(on_sideview_solid_oldpos(this) || getOnSideviewLadder() || IsSideSwim()))) |
| 12687 | ✗ | return false; | |
| 12688 | |||
| 12689 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 8 times.
|
8 | if(!(checkbunny(itemid) && checkmagiccost(itemid))) |
| 12690 | { | ||
| 12691 | ✗ | return item_error(); | |
| 12692 | } | ||
| 12693 | |||
| 12694 | 8 | paymagiccost(itemid); | |
| 12695 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | if (IsSideSwim()) {action=sideswimcasting; FFCore.setHeroAction(sideswimcasting);} |
| 12696 | 8 | else {action=casting; FFCore.setHeroAction(casting);} | |
| 12697 | 8 | magicitem=itemid; | |
| 12698 | 8 | break; | |
| 12699 | |||
| 12700 | case itype_divineprotection: | ||
| 12701 | ✗ | if(z!=0 || fakez!=0 || (isSideViewHero() && !(on_sideview_solid_oldpos(this) || getOnSideviewLadder() || IsSideSwim()))) | |
| 12702 | ✗ | return false; | |
| 12703 | |||
| 12704 | ✗ | if(!(checkbunny(itemid) && checkmagiccost(itemid))) | |
| 12705 | { | ||
| 12706 | ✗ | return item_error(); | |
| 12707 | } | ||
| 12708 | |||
| 12709 | ✗ | paymagiccost(itemid); | |
| 12710 | ✗ | if (IsSideSwim()) {action=sideswimcasting; FFCore.setHeroAction(sideswimcasting);} | |
| 12711 | ✗ | else {action=casting; FFCore.setHeroAction(casting);} | |
| 12712 | ✗ | magicitem=itemid; | |
| 12713 | ✗ | break; | |
| 12714 | |||
| 12715 | case itype_cbyrna: | ||
| 12716 | { | ||
| 12717 | //Beams already deployed | ||
| 12718 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
|
4 | if(Lwpns.idCount(wCByrna)) |
| 12719 | { | ||
| 12720 | 2 | stopCaneOfByrna(); | |
| 12721 | 2 | return false; | |
| 12722 | } | ||
| 12723 | |||
| 12724 |
2/4✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
|
2 | if(!(checkbunny(itemid) && checkmagiccost(itemid))) |
| 12725 | { | ||
| 12726 | ✗ | stop_sfx(itm.usesound); //if we can't pay the cost, kill the sound. | |
| 12727 | //last_cane_of_byrna_item_id = -1; //no, we'd do this in a byrna cleanup function. | ||
| 12728 | ✗ | return false; | |
| 12729 | } | ||
| 12730 | |||
| 12731 | 2 | paymagiccost(itemid); | |
| 12732 | 2 | last_cane_of_byrna_item_id = itemid; | |
| 12733 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
|
4 | for(int32_t i=0; i<itm.misc3; i++) |
| 12734 | { | ||
| 12735 | //byrna weapons are added here | ||
| 12736 | //space them apart | ||
| 12737 | //the iterator isn passed to 'type'. weapons.cpp converts thisd to | ||
| 12738 | //'quantity_iterator' pn construction; and this is used for orbit initial spacing. | ||
| 12739 |
6/12✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
|
2 | Lwpns.add(new weapon((zfix)wx,(zfix)wy,(zfix)wz,wCByrna,i,itm.power*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); |
| 12740 | 2 | } | |
| 12741 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if(!(Lwpns.idCount(wCByrna))) |
| 12742 | ✗ | stop_sfx(itm.usesound); //If we can't create the beams, kill the sound. | |
| 12743 | } | ||
| 12744 | 2 | break; | |
| 12745 | |||
| 12746 | case itype_clock: | ||
| 12747 | { | ||
| 12748 | ✗ | ret = false; | |
| 12749 | ✗ | if(!(itm.flags & item_flag1)) | |
| 12750 | ✗ | break; //Passive clock, don't use | |
| 12751 | ✗ | if((itm.flags & item_flag2) && watch) //"Can't activate while clock active" | |
| 12752 | ✗ | break; | |
| 12753 | ✗ | if(!(checkbunny(itemid) && checkmagiccost(itemid))) //cost/bunny check | |
| 12754 | { | ||
| 12755 | ✗ | return item_error(); | |
| 12756 | } | ||
| 12757 | |||
| 12758 | ✗ | paymagiccost(itemid); | |
| 12759 | |||
| 12760 | ✗ | setClock(watch=true); | |
| 12761 | |||
| 12762 | ✗ | for(int32_t i=0; i<eMAXGUYS; i++) | |
| 12763 | ✗ | clock_zoras[i]=0; | |
| 12764 | |||
| 12765 | ✗ | clockclk=itm.misc1; | |
| 12766 | ✗ | sfx(itm.usesound); | |
| 12767 | ✗ | break; | |
| 12768 | } | ||
| 12769 | case itype_killem: | ||
| 12770 | { | ||
| 12771 | ✗ | ret = false; | |
| 12772 | ✗ | if(!(itm.flags & item_flag1)) | |
| 12773 | ✗ | break; //Passive killemall, don't use | |
| 12774 | |||
| 12775 | ✗ | if(!(checkbunny(itemid) && checkmagiccost(itemid)) | |
| 12776 | ✗ | || !can_kill_em_all()) //No enemies onscreen | |
| 12777 | { | ||
| 12778 | ✗ | return item_error(); | |
| 12779 | } | ||
| 12780 | |||
| 12781 | ✗ | paymagiccost(itemid); | |
| 12782 | |||
| 12783 | ✗ | kill_em_all(); | |
| 12784 | ✗ | sfx(itm.usesound); | |
| 12785 | ✗ | break; | |
| 12786 | } | ||
| 12787 | case itype_refill: | ||
| 12788 | { | ||
| 12789 | ✗ | if(!(checkbunny(itemid) && checkmagiccost(itemid))) | |
| 12790 | { | ||
| 12791 | ✗ | return item_error(); | |
| 12792 | } | ||
| 12793 | |||
| 12794 | ✗ | bool did_something = false; | |
| 12795 | |||
| 12796 | ✗ | if(itm.flags & item_flag1) //Cure sword jinx | |
| 12797 | { | ||
| 12798 | ✗ | if(swordclk) | |
| 12799 | ✗ | did_something = true; | |
| 12800 | ✗ | swordclk = 0; | |
| 12801 | ✗ | verifyAWpn(); | |
| 12802 | ✗ | } | |
| 12803 | ✗ | for(auto q = 0; q < 5; ++q) | |
| 12804 | { | ||
| 12805 | ✗ | auto ctr = itm.misc(q); | |
| 12806 | ✗ | if(unsigned(ctr) >= MAX_COUNTERS) | |
| 12807 | ✗ | continue; | |
| 12808 | ✗ | int16_t amnt = vbound(itm.misc(q+5),-32768,32767); | |
| 12809 | ✗ | if(!amnt) continue; | |
| 12810 | ✗ | bool gradual = itm.flags & item_flag2; | |
| 12811 | ✗ | if(amnt > 0) | |
| 12812 | { | ||
| 12813 | ✗ | if(game->get_counter(ctr) + game->get_dcounter(ctr) >= game->get_maxcounter(ctr)) | |
| 12814 | { | ||
| 12815 | //Can't *do* anything... skip | ||
| 12816 | ✗ | continue; | |
| 12817 | } | ||
| 12818 | ✗ | if(game->get_counter(ctr) >= game->get_maxcounter(ctr)) | |
| 12819 | { | ||
| 12820 | //Can't do anything unless affecting dcounter | ||
| 12821 | ✗ | gradual = true; | |
| 12822 | ✗ | } | |
| 12823 | ✗ | } | |
| 12824 | else //Negative | ||
| 12825 | { | ||
| 12826 | ✗ | if(game->get_counter(ctr) + game->get_dcounter(ctr) <= 0) | |
| 12827 | { | ||
| 12828 | //Can't *do* anything... skip | ||
| 12829 | ✗ | continue; | |
| 12830 | } | ||
| 12831 | ✗ | if(game->get_counter(ctr) <= 0) | |
| 12832 | { | ||
| 12833 | //Can't do anything unless affecting dcounter | ||
| 12834 | ✗ | gradual = true; | |
| 12835 | ✗ | } | |
| 12836 | } | ||
| 12837 | ✗ | did_something = true; | |
| 12838 | ✗ | if(gradual) //Gradual | |
| 12839 | { | ||
| 12840 | ✗ | game->change_dcounter(amnt, ctr); | |
| 12841 | ✗ | } | |
| 12842 | else | ||
| 12843 | { | ||
| 12844 | ✗ | game->change_counter(amnt, ctr); | |
| 12845 | } | ||
| 12846 | ✗ | } | |
| 12847 | ✗ | if(!did_something) | |
| 12848 | { | ||
| 12849 | ✗ | return item_error(); | |
| 12850 | } | ||
| 12851 | ✗ | paymagiccost(itemid); | |
| 12852 | ✗ | sfx(itm.usesound); | |
| 12853 | ✗ | ret = false; | |
| 12854 | ✗ | break; | |
| 12855 | } | ||
| 12856 | |||
| 12857 | default: | ||
| 12858 | 1749 | ret = false; | |
| 12859 | 1749 | } | |
| 12860 | |||
| 12861 |
2/2✓ Branch 0 taken 35 times.
✓ Branch 1 taken 40669 times.
|
40704 | if(itm.flags & item_downgrade) |
| 12862 | { | ||
| 12863 | 35 | game->set_item(itemid,false); | |
| 12864 | |||
| 12865 | // Maybe Item Override has allowed the same item in both slots? | ||
| 12866 |
1/2✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
|
35 | if(Bwpn == itemid) |
| 12867 | { | ||
| 12868 | ✗ | Bwpn = -1; | |
| 12869 | ✗ | game->forced_bwpn = -1; | |
| 12870 | ✗ | verifyBWpn(); | |
| 12871 | ✗ | } | |
| 12872 | |||
| 12873 |
1/2✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
|
35 | if(Awpn == itemid) |
| 12874 | { | ||
| 12875 | ✗ | Awpn = -1; | |
| 12876 | ✗ | game->forced_awpn = -1; | |
| 12877 | ✗ | verifyAWpn(); | |
| 12878 | ✗ | } | |
| 12879 | |||
| 12880 |
1/2✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
|
35 | if(Xwpn == itemid) |
| 12881 | { | ||
| 12882 | ✗ | Xwpn = -1; | |
| 12883 | ✗ | game->forced_xwpn = -1; | |
| 12884 | ✗ | verifyXWpn(); | |
| 12885 | ✗ | } | |
| 12886 | |||
| 12887 |
1/2✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
|
35 | if(Ywpn == itemid) |
| 12888 | { | ||
| 12889 | ✗ | Ywpn = -1; | |
| 12890 | ✗ | game->forced_ywpn = -1; | |
| 12891 | ✗ | verifyYWpn(); | |
| 12892 | ✗ | } | |
| 12893 | 35 | } | |
| 12894 | |||
| 12895 | 40704 | return ret; | |
| 12896 | 46366 | } | |
| 12897 | |||
| 12898 | |||
| 12899 | 1857345 | bool HeroClass::doattack() | |
| 12900 | { | ||
| 12901 |
3/4✓ Branch 0 taken 17 times.
✓ Branch 1 taken 1857328 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 17 times.
|
1857345 | if(lift_wpn && (liftflags & LIFTFL_DIS_ITEMS)) |
| 12902 | 17 | return false; | |
| 12903 | //int32_t s = BSZ ? 0 : 11; | ||
| 12904 | 1857328 | int32_t s = (zinit.heroAnimationStyle==las_bszelda) ? 0 : 11; | |
| 12905 | |||
| 12906 |
4/4✓ Branch 0 taken 469054 times.
✓ Branch 1 taken 1388274 times.
✓ Branch 2 taken 468910 times.
✓ Branch 3 taken 144 times.
|
1857328 | int32_t bugnetid = (directWpn>-1 && itemsbuf[directWpn].family==itype_bugnet) ? directWpn : current_item_id(itype_bugnet); |
| 12907 |
3/4✓ Branch 0 taken 144 times.
✓ Branch 1 taken 1857184 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 144 times.
|
1857328 | if(attack==wBugNet && bugnetid!=-1) |
| 12908 | { | ||
| 12909 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 138 times.
|
144 | if(++attackclk >= NET_CLK_TOTAL) |
| 12910 | 6 | return false; | |
| 12911 | |||
| 12912 | 138 | return true; | |
| 12913 | } | ||
| 12914 | |||
| 12915 | // Abort attack if attackclk has run out and: | ||
| 12916 | // * the attack is not Hammer, Sword with Spin Scroll, Candle, or Wand, OR | ||
| 12917 | // * you aren't holding down the A button, you're not charging, and/or you're still spinning | ||
| 12918 | |||
| 12919 |
6/6✓ Branch 0 taken 182800 times.
✓ Branch 1 taken 1674384 times.
✓ Branch 2 taken 147316 times.
✓ Branch 3 taken 35484 times.
✓ Branch 4 taken 51479 times.
✓ Branch 5 taken 17731 times.
|
1926394 | if(attackclk>=(spins>0?8:14) && attack!=wHammer && |
| 12920 |
12/12✓ Branch 0 taken 134895 times.
✓ Branch 1 taken 12421 times.
✓ Branch 2 taken 66153 times.
✓ Branch 3 taken 68742 times.
✓ Branch 4 taken 79367 times.
✓ Branch 5 taken 67949 times.
✓ Branch 6 taken 78106 times.
✓ Branch 7 taken 1261 times.
✓ Branch 8 taken 66113 times.
✓ Branch 9 taken 3097 times.
✓ Branch 10 taken 50945 times.
✓ Branch 11 taken 15168 times.
|
147316 | (((attack!=wSword || !current_item(itype_spinscroll) || inlikelike) && attack!=wWand && attack!=wFire && attack!=wCByrna) || !((attack==wSword && isWpnPressed(itype_sword) && spins==0) || charging>0))) |
| 12921 | { | ||
| 12922 | 95837 | tapping=false; | |
| 12923 | 95837 | return false; | |
| 12924 | } | ||
| 12925 | |||
| 12926 |
2/2✓ Branch 0 taken 2295 times.
✓ Branch 1 taken 1759052 times.
|
1761347 | if(attackclk>29) |
| 12927 | { | ||
| 12928 | 2295 | tapping=false; | |
| 12929 | 2295 | return false; | |
| 12930 | } | ||
| 12931 | |||
| 12932 |
4/4✓ Branch 0 taken 451509 times.
✓ Branch 1 taken 1307543 times.
✓ Branch 2 taken 428579 times.
✓ Branch 3 taken 22930 times.
|
1759052 | int32_t candleid = (directWpn>-1 && itemsbuf[directWpn].family==itype_candle) ? directWpn : current_item_id(itype_candle); |
| 12933 |
4/4✓ Branch 0 taken 451509 times.
✓ Branch 1 taken 1307543 times.
✓ Branch 2 taken 451479 times.
✓ Branch 3 taken 30 times.
|
1759052 | int32_t byrnaid = (directWpn>-1 && itemsbuf[directWpn].family==itype_cbyrna) ? directWpn : current_item_id(itype_cbyrna); |
| 12934 | // An attack can be "walked out-of" after 8 frames, unless it's: | ||
| 12935 | // * a sword stab | ||
| 12936 | // * a hammer pound | ||
| 12937 | // * a wand thrust | ||
| 12938 | // * a candle thrust | ||
| 12939 | // * a cane thrust | ||
| 12940 | // In which case it should continue. | ||
| 12941 |
8/8✓ Branch 0 taken 68861 times.
✓ Branch 1 taken 1690191 times.
✓ Branch 2 taken 197187 times.
✓ Branch 3 taken 128326 times.
✓ Branch 4 taken 1615288 times.
✓ Branch 5 taken 203229 times.
✓ Branch 6 taken 360429 times.
✓ Branch 7 taken 1254859 times.
|
2054431 | if((attack==wCatching && attackclk>4)||(attack!=wWand && attack!=wSword && attack!=wHammer |
| 12942 |
5/6✓ Branch 0 taken 296067 times.
✓ Branch 1 taken 64362 times.
✓ Branch 2 taken 21949 times.
✓ Branch 3 taken 274118 times.
✓ Branch 4 taken 21949 times.
✗ Branch 5 not taken.
|
360429 | && (attack!=wFire || (candleid!=-1 && !(itemsbuf[candleid].wpn))) |
| 12943 |
3/4✓ Branch 0 taken 30 times.
✓ Branch 1 taken 274088 times.
✓ Branch 2 taken 30 times.
✗ Branch 3 not taken.
|
296067 | && (attack!=wCByrna || (byrnaid!=-1 && !(itemsbuf[byrnaid].wpn))) |
| 12944 |
2/2✓ Branch 0 taken 295379 times.
✓ Branch 1 taken 21291 times.
|
274118 | && (attack != wBugNet) && attackclk>7)) |
| 12945 | { | ||
| 12946 |
8/8✓ Branch 0 taken 93453 times.
✓ Branch 1 taken 4739 times.
✓ Branch 2 taken 88910 times.
✓ Branch 3 taken 4543 times.
✓ Branch 4 taken 83726 times.
✓ Branch 5 taken 5184 times.
✓ Branch 6 taken 5622 times.
✓ Branch 7 taken 78104 times.
|
492566 | if(DrunkUp()||DrunkDown()||DrunkLeft()||DrunkRight()) |
| 12947 | { | ||
| 12948 | 20088 | lstep = s; | |
| 12949 | 20088 | return false; | |
| 12950 | } | ||
| 12951 | 78104 | } | |
| 12952 | |||
| 12953 |
2/2✓ Branch 0 taken 40923 times.
✓ Branch 1 taken 1602901 times.
|
1643824 | if(charging==0) |
| 12954 | { | ||
| 12955 | 1602901 | lstep=0; | |
| 12956 | 1602901 | } | |
| 12957 | |||
| 12958 | // Work out the sword charge-up delay | ||
| 12959 | 1643824 | int32_t magiccharge = 192, normalcharge = 64; | |
| 12960 | 1643824 | int32_t itemid = current_item_id(itype_chargering); | |
| 12961 | |||
| 12962 |
2/2✓ Branch 0 taken 1594160 times.
✓ Branch 1 taken 49664 times.
|
1643824 | if(itemid>=0) |
| 12963 | { | ||
| 12964 | 49664 | normalcharge = itemsbuf[itemid].misc1; | |
| 12965 | 49664 | magiccharge = itemsbuf[itemid].misc2; | |
| 12966 | 49664 | } | |
| 12967 | |||
| 12968 | 1643824 | int scrollid = current_item_id(attack==wHammer ? itype_quakescroll : itype_spinscroll); | |
| 12969 | 1643824 | int scroll2id = current_item_id(attack==wHammer ? itype_quakescroll2 : itype_spinscroll2); | |
| 12970 | |||
| 12971 | 1643824 | bool doCharge=true; | |
| 12972 |
3/4✓ Branch 0 taken 150 times.
✓ Branch 1 taken 1643674 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 150 times.
|
1643824 | if(z!=0 && fakez != 0) |
| 12973 | ✗ | doCharge=false; | |
| 12974 |
2/2✓ Branch 0 taken 1254859 times.
✓ Branch 1 taken 388965 times.
|
1643824 | if(attack==wSword) |
| 12975 | { | ||
| 12976 |
4/4✓ Branch 0 taken 34916 times.
✓ Branch 1 taken 1219943 times.
✓ Branch 2 taken 613 times.
✓ Branch 3 taken 34303 times.
|
1254859 | if(!(attackclk==SWORDCHARGEFRAME && isWpnPressed(itype_sword))) |
| 12977 | 1220556 | doCharge=false; | |
| 12978 |
2/2✓ Branch 0 taken 10820 times.
✓ Branch 1 taken 23483 times.
|
34303 | else if(charging<=normalcharge) |
| 12979 | { | ||
| 12980 |
3/6✓ Branch 0 taken 23483 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 23483 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 23483 times.
✗ Branch 5 not taken.
|
23483 | if(scrollid<0 || !(checkbunny(scrollid) && checkmagiccost(scrollid))) |
| 12981 | ✗ | doCharge=false; | |
| 12982 | 23483 | } | |
| 12983 | 1254859 | } | |
| 12984 |
2/2✓ Branch 0 taken 64362 times.
✓ Branch 1 taken 324603 times.
|
388965 | else if(attack==wHammer) |
| 12985 | { | ||
| 12986 |
4/4✓ Branch 0 taken 2186 times.
✓ Branch 1 taken 62176 times.
✓ Branch 2 taken 1943 times.
✓ Branch 3 taken 243 times.
|
64362 | if(!(attackclk==HAMMERCHARGEFRAME && isWpnPressed(itype_hammer))) |
| 12987 | 64119 | doCharge=false; | |
| 12988 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 243 times.
|
243 | else if(charging<=normalcharge) |
| 12989 | { | ||
| 12990 |
4/6✓ Branch 0 taken 16 times.
✓ Branch 1 taken 227 times.
✓ Branch 2 taken 16 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
|
243 | if(scrollid<0 || !(checkbunny(scrollid) && checkmagiccost(scrollid))) |
| 12991 | 227 | doCharge=false; | |
| 12992 | 243 | } | |
| 12993 | 64362 | } | |
| 12994 | else | ||
| 12995 | 324603 | doCharge=false; | |
| 12996 | |||
| 12997 | // charging up weapon... | ||
| 12998 |
2/2✓ Branch 0 taken 34319 times.
✓ Branch 1 taken 1609505 times.
|
1643824 | if(doCharge) |
| 12999 | { | ||
| 13000 | // Increase charging while holding down button. | ||
| 13001 |
3/4✓ Branch 0 taken 34319 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2543 times.
✓ Branch 3 taken 31776 times.
|
34319 | if(spins==0 && charging<magiccharge) |
| 13002 | 31776 | charging++; | |
| 13003 | |||
| 13004 | // Once a charging threshold is reached, play the sound. | ||
| 13005 |
2/2✓ Branch 0 taken 174 times.
✓ Branch 1 taken 34145 times.
|
34319 | if(charging==normalcharge) |
| 13006 | { | ||
| 13007 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 174 times.
|
174 | if(!(itemsbuf[scrollid].flags&item_flag1)) |
| 13008 | 174 | paymagiccost(scrollid); | |
| 13009 | 174 | sfx(itemsbuf[scrollid].usesound2,pan(x.getInt())); | |
| 13010 | 174 | } | |
| 13011 |
2/2✓ Branch 0 taken 31708 times.
✓ Branch 1 taken 2437 times.
|
34145 | else if(charging==magiccharge) |
| 13012 | { | ||
| 13013 |
4/6✓ Branch 0 taken 3 times.
✓ Branch 1 taken 2434 times.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 3 times.
|
2437 | if(scroll2id>-1 && checkbunny(scroll2id) && checkmagiccost(scroll2id)) |
| 13014 | { | ||
| 13015 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | if(!(itemsbuf[scroll2id].flags&item_flag1)) |
| 13016 | 3 | paymagiccost(scroll2id); | |
| 13017 | 3 | charging++; // charging>magiccharge signifies a successful supercharge. | |
| 13018 | 3 | sfx(itemsbuf[scroll2id].usesound2,pan(x.getInt())); | |
| 13019 | 3 | } | |
| 13020 | 2437 | } | |
| 13021 | 34319 | } | |
| 13022 |
3/4✓ Branch 0 taken 30 times.
✓ Branch 1 taken 1609475 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 30 times.
|
1609505 | else if(attack==wCByrna && byrnaid!=-1) |
| 13023 | { | ||
| 13024 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if(!(itemsbuf[byrnaid].wpn)) |
| 13025 | { | ||
| 13026 | ✗ | attack = wNone; | |
| 13027 | ✗ | return startwpn(attackid); // Beam if the Byrna stab animation WASN'T used. | |
| 13028 | } | ||
| 13029 | |||
| 13030 | 30 | bool beamcount = false; | |
| 13031 | |||
| 13032 |
2/2✓ Branch 0 taken 26 times.
✓ Branch 1 taken 55 times.
|
81 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 13033 | { | ||
| 13034 | 55 | weapon *w = ((weapon*)Lwpns.spr(i)); | |
| 13035 | |||
| 13036 |
2/2✓ Branch 0 taken 51 times.
✓ Branch 1 taken 4 times.
|
55 | if(w->id==wCByrna) |
| 13037 | { | ||
| 13038 | 4 | beamcount = true; | |
| 13039 | 4 | break; | |
| 13040 | } | ||
| 13041 | 51 | } | |
| 13042 | |||
| 13043 | // If beams already deployed, remove them | ||
| 13044 |
4/4✓ Branch 0 taken 4 times.
✓ Branch 1 taken 26 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 2 times.
|
30 | if(!attackclk && beamcount) |
| 13045 | { | ||
| 13046 | 2 | return startwpn(attackid); // Remove beams instantly | |
| 13047 | } | ||
| 13048 | |||
| 13049 | // Otherwise, continue | ||
| 13050 | 28 | ++attackclk; | |
| 13051 | 28 | } | |
| 13052 | else | ||
| 13053 | { | ||
| 13054 | 1609475 | ++attackclk; | |
| 13055 | |||
| 13056 |
6/6✓ Branch 0 taken 4046 times.
✓ Branch 1 taken 1605429 times.
✓ Branch 2 taken 785 times.
✓ Branch 3 taken 3261 times.
✓ Branch 4 taken 485 times.
✓ Branch 5 taken 300 times.
|
1609475 | if(attackclk==SWORDCHARGEFRAME && charging>0 && !tapping) //Signifies a tapped enemy |
| 13057 | { | ||
| 13058 | 300 | ++attackclk; // Won't continue charging | |
| 13059 | 300 | charging=0; | |
| 13060 | 300 | } | |
| 13061 | |||
| 13062 | // Faster if spinning. | ||
| 13063 |
2/2✓ Branch 0 taken 1606797 times.
✓ Branch 1 taken 2678 times.
|
1609475 | if(spins>0) |
| 13064 | 2678 | ++attackclk; | |
| 13065 | |||
| 13066 | // Even faster if hurricane spinning. | ||
| 13067 |
2/2✓ Branch 0 taken 1609043 times.
✓ Branch 1 taken 432 times.
|
1609475 | if(spins>5) |
| 13068 | 432 | attackclk+=2; | |
| 13069 | |||
| 13070 | // If at a charging threshold, do a charged attack. | ||
| 13071 |
5/6✓ Branch 0 taken 2332 times.
✓ Branch 1 taken 1607143 times.
✓ Branch 2 taken 2332 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2217 times.
✓ Branch 5 taken 115 times.
|
1609475 | if(charging>=normalcharge && (attack!=wSword || attackclk>=SWORDCHARGEFRAME) && !tapping) |
| 13072 | { | ||
| 13073 |
1/2✓ Branch 0 taken 115 times.
✗ Branch 1 not taken.
|
115 | if(attack==wSword) |
| 13074 | { | ||
| 13075 |
2/2✓ Branch 0 taken 112 times.
✓ Branch 1 taken 3 times.
|
115 | bool super = charging>magiccharge && scroll2id > -1; |
| 13076 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 112 times.
|
115 | int id = super ? scroll2id : scrollid; |
| 13077 | 115 | itemdata const& spinscroll = itemsbuf[id]; | |
| 13078 | 115 | bool paid = !(spinscroll.flags&item_flag1); | |
| 13079 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 115 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
115 | if(!paid && checkbunny(id) && checkmagiccost(id)) |
| 13080 | { | ||
| 13081 | ✗ | paid = true; | |
| 13082 | ✗ | paymagiccost(id); | |
| 13083 | ✗ | } | |
| 13084 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 115 times.
|
115 | if(paid) |
| 13085 | { | ||
| 13086 | 115 | currentscroll = id; | |
| 13087 | 115 | spins=(spinscroll.misc1*4) + (super ? -3 : 1); | |
| 13088 | 115 | attackclk=1; | |
| 13089 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 114 times.
|
115 | if(!get_qr(qr_BROKEN_SWORD_SPIN_TRIGGERS)) |
| 13090 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
2 | if(weapon* w = find_first_wtype(wSword)) |
| 13091 | 1 | w->reset_wgrids(); | |
| 13092 | 115 | sfx(spinscroll.usesound,pan(x.getInt())); | |
| 13093 |
1/2✓ Branch 0 taken 115 times.
✗ Branch 1 not taken.
|
115 | if(spinscroll.flags&item_flag1) |
| 13094 | ✗ | paymagiccost(id); | |
| 13095 | 115 | } | |
| 13096 | 115 | } | |
| 13097 | ✗ | else if(attack==wHammer && sideviewhammerpound()) | |
| 13098 | { | ||
| 13099 | ✗ | bool super = charging>magiccharge && scroll2id > -1; | |
| 13100 | ✗ | int id = super ? scroll2id : scrollid; | |
| 13101 | ✗ | itemdata const& quakescroll = itemsbuf[id]; | |
| 13102 | ✗ | bool paid = !(quakescroll.flags&item_flag1); | |
| 13103 | ✗ | if(!paid && checkbunny(id) && checkmagiccost(id)) | |
| 13104 | { | ||
| 13105 | ✗ | paid = true; | |
| 13106 | ✗ | paymagiccost(id); | |
| 13107 | ✗ | } | |
| 13108 | ✗ | if(paid) | |
| 13109 | { | ||
| 13110 | ✗ | currentscroll = id; | |
| 13111 | ✗ | spins = super ? 2 : 1; | |
| 13112 | ✗ | sfx(quakescroll.usesound,pan(x.getInt())); | |
| 13113 | ✗ | quakeclk=quakescroll.misc1; | |
| 13114 | |||
| 13115 | // general area stun | ||
| 13116 | ✗ | for(int32_t i=0; i<GuyCount(); i++) | |
| 13117 | { | ||
| 13118 | ✗ | if(!isflier(GuyID(i))) | |
| 13119 | { | ||
| 13120 | ✗ | StunGuy(i,quakescroll.misc2-distance(x,y,GuyX(i),GuyY(i))); | |
| 13121 | ✗ | } | |
| 13122 | ✗ | } | |
| 13123 | |||
| 13124 | ✗ | int hmrid = (directWpn>-1 && itemsbuf[directWpn].family==itype_hammer) ? directWpn : current_item_id(itype_hammer); | |
| 13125 | ✗ | int hmrlvl = hmrid < 0 ? 1 : itemsbuf[hmrid].fam_type; | |
| 13126 | ✗ | if(hmrlvl < 1) hmrlvl = 1; | |
| 13127 | ✗ | int rad = quakescroll.misc2; | |
| 13128 | ✗ | for(int pos = 0; pos < 176; ++pos) | |
| 13129 | { | ||
| 13130 | ✗ | if(distance(x,y,COMBOX(pos),COMBOY(pos)) > rad) continue; | |
| 13131 | ✗ | for(int lyr = 0; lyr < 7; ++lyr) | |
| 13132 | { | ||
| 13133 | ✗ | int cid = FFCore.tempScreens[lyr]->data[pos]; | |
| 13134 | ✗ | newcombo const& cmb = combobuf[cid]; | |
| 13135 | ✗ | if(cmb.triggerflags[2] & ((super?combotriggerSQUAKESTUN:0)|combotriggerQUAKESTUN)) | |
| 13136 | { | ||
| 13137 | ✗ | if((cmb.triggerflags[0]&combotriggerINVERTMINMAX) | |
| 13138 | ✗ | ? hmrlvl <= cmb.triggerlevel | |
| 13139 | ✗ | : hmrlvl >= cmb.triggerlevel) | |
| 13140 | ✗ | do_trigger_combo(lyr,pos); | |
| 13141 | ✗ | } | |
| 13142 | ✗ | } | |
| 13143 | ✗ | } | |
| 13144 | ✗ | word c = tmpscr->numFFC(); | |
| 13145 | ✗ | for(int ff = 0; ff < c; ++ff) | |
| 13146 | { | ||
| 13147 | ✗ | ffcdata& ffc = tmpscr->ffcs[ff]; | |
| 13148 | ✗ | newcombo const& cmb = combobuf[ffc.data]; | |
| 13149 | ✗ | if(distance(x,y,ffc.x,ffc.y) > rad) continue; | |
| 13150 | ✗ | if(cmb.triggerflags[2] & ((super?combotriggerSQUAKESTUN:0)|combotriggerQUAKESTUN)) | |
| 13151 | { | ||
| 13152 | ✗ | if((cmb.triggerflags[0]&combotriggerINVERTMINMAX) | |
| 13153 | ✗ | ? hmrlvl <= cmb.triggerlevel | |
| 13154 | ✗ | : hmrlvl >= cmb.triggerlevel) | |
| 13155 | ✗ | do_trigger_combo_ffc(ff); | |
| 13156 | ✗ | } | |
| 13157 | ✗ | } | |
| 13158 | ✗ | } | |
| 13159 | ✗ | } | |
| 13160 | 115 | } | |
| 13161 |
6/6✓ Branch 0 taken 4071 times.
✓ Branch 1 taken 1605289 times.
✓ Branch 2 taken 3586 times.
✓ Branch 3 taken 485 times.
✓ Branch 4 taken 347 times.
✓ Branch 5 taken 3239 times.
|
1609360 | else if(tapping && attackclk<SWORDCHARGEFRAME && charging<magiccharge) |
| 13162 | 3239 | charging++; | |
| 13163 | |||
| 13164 |
7/8✓ Branch 0 taken 21550 times.
✓ Branch 1 taken 1587925 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1587925 times.
✓ Branch 4 taken 25736 times.
✓ Branch 5 taken 1562189 times.
✓ Branch 6 taken 901362 times.
✓ Branch 7 taken 708113 times.
|
1609475 | if(!isWpnPressed(attack==wFire ? itype_candle : attack==wCByrna ? itype_cbyrna : attack==wWand ? itype_wand : attack==wHammer ? itype_hammer : itype_sword)) |
| 13165 | 708113 | charging=0; | |
| 13166 | |||
| 13167 |
2/2✓ Branch 0 taken 1581709 times.
✓ Branch 1 taken 27766 times.
|
1609475 | if(attackclk>=SWORDCHARGEFRAME) |
| 13168 | 27766 | tapping = false; | |
| 13169 | } | ||
| 13170 | |||
| 13171 |
7/8✓ Branch 0 taken 125316 times.
✓ Branch 1 taken 1518506 times.
✓ Branch 2 taken 1801 times.
✓ Branch 3 taken 123515 times.
✓ Branch 4 taken 1801 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 47 times.
✓ Branch 7 taken 1754 times.
|
1643822 | if(attackclk==1 && attack==wFire && candleid!=-1 && !(itemsbuf[candleid].wpn)) |
| 13172 | { | ||
| 13173 | 1754 | return startwpn(attackid); // Flame if the Candle stab animation WASN'T used. | |
| 13174 | } | ||
| 13175 | |||
| 13176 | 1642068 | int32_t crossid = current_item_id(itype_crossscroll); //has Cross Beams scroll | |
| 13177 | |||
| 13178 |
11/14✓ Branch 0 taken 1542300 times.
✓ Branch 1 taken 99768 times.
✓ Branch 2 taken 113923 times.
✓ Branch 3 taken 1428377 times.
✓ Branch 4 taken 450 times.
✓ Branch 5 taken 113473 times.
✓ Branch 6 taken 450 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 12 times.
✓ Branch 9 taken 438 times.
✓ Branch 10 taken 12 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 12 times.
✗ Branch 13 not taken.
|
1642068 | if(attackclk==13 || (attackclk==7 && spins>1 && attack != wHammer && crossid >=0 && checkbunny(crossid) && checkmagiccost(crossid))) |
| 13179 | { | ||
| 13180 | |||
| 13181 |
4/4✓ Branch 0 taken 18073 times.
✓ Branch 1 taken 81707 times.
✓ Branch 2 taken 14934 times.
✓ Branch 3 taken 3139 times.
|
99780 | int32_t wpnid = (directWpn>-1 && itemsbuf[directWpn].family==itype_sword) ? directWpn : current_item_id(itype_sword); |
| 13182 |
2/2✓ Branch 0 taken 99383 times.
✓ Branch 1 taken 397 times.
|
99780 | int64_t templife = wpnid>=0? itemsbuf[wpnid].misc1 : 0; |
| 13183 | |||
| 13184 |
4/4✓ Branch 0 taken 99383 times.
✓ Branch 1 taken 397 times.
✓ Branch 2 taken 26727 times.
✓ Branch 3 taken 72656 times.
|
99780 | if(wpnid>=0 && itemsbuf[wpnid].flags & item_flag1) |
| 13185 | { | ||
| 13186 | 72656 | templife=templife*game->get_maxlife(); | |
| 13187 | 72656 | templife=templife/100; | |
| 13188 | 72656 | } | |
| 13189 | else | ||
| 13190 | { | ||
| 13191 | 27124 | templife*=game->get_hp_per_heart(); | |
| 13192 | } | ||
| 13193 | |||
| 13194 |
2/2✓ Branch 0 taken 37050 times.
✓ Branch 1 taken 62730 times.
|
99780 | bool normalbeam = (int64_t(game->get_life())+(get_qr(qr_QUARTERHEART)?((game->get_hp_per_heart()/4)-1):((game->get_hp_per_heart()/2)-1))>=templife); |
| 13195 | 99780 | int32_t perilid = current_item_id(itype_perilscroll); | |
| 13196 |
3/4✓ Branch 0 taken 7415 times.
✓ Branch 1 taken 92365 times.
✓ Branch 2 taken 7415 times.
✗ Branch 3 not taken.
|
99851 | bool perilbeam = (perilid>=0 && wpnid>=0 && game->get_life()<=itemsbuf[perilid].misc1*game->get_hp_per_heart() |
| 13197 |
3/4✓ Branch 0 taken 71 times.
✓ Branch 1 taken 7344 times.
✓ Branch 2 taken 71 times.
✗ Branch 3 not taken.
|
7415 | && checkbunny(perilid) && checkmagiccost(perilid) |
| 13198 | // Must actually be able to shoot sword beams | ||
| 13199 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 71 times.
|
71 | && ((itemsbuf[wpnid].flags & item_flag1) |
| 13200 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 70 times.
|
71 | || itemsbuf[wpnid].misc1 <= game->get_maxlife()/game->get_hp_per_heart())); |
| 13201 | |||
| 13202 |
4/4✓ Branch 0 taken 84669 times.
✓ Branch 1 taken 15111 times.
✓ Branch 2 taken 531 times.
✓ Branch 3 taken 84138 times.
|
99780 | if(attack==wSword && !tapping) |
| 13203 | { | ||
| 13204 |
4/4✓ Branch 0 taken 84069 times.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 19928 times.
✓ Branch 3 taken 64141 times.
|
84138 | if(perilbeam || normalbeam) |
| 13205 | { | ||
| 13206 |
1/2✓ Branch 0 taken 19997 times.
✗ Branch 1 not taken.
|
19997 | if(attackclk==7) |
| 13207 | ✗ | paymagiccost(crossid); // Pay the Cross Beams magic cost. | |
| 13208 | |||
| 13209 |
3/4✓ Branch 0 taken 69 times.
✓ Branch 1 taken 19928 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 69 times.
|
19997 | if(perilbeam && !normalbeam) |
| 13210 | 69 | paymagiccost(perilid); // Pay the Peril Beam magic cost. | |
| 13211 | |||
| 13212 | // TODO: Something that would be cheap but disgraceful to hack in at this point is | ||
| 13213 | // a way to make the peril/cross beam item's power stat influence the strength | ||
| 13214 | // of the peril/cross beam... | ||
| 13215 | 19997 | startwpn(attackid); | |
| 13216 | 19997 | } | |
| 13217 | 64141 | else misc_internal_hero_flags &= ~LF_PAID_SWORD_COST; | |
| 13218 | 84138 | } | |
| 13219 | |||
| 13220 |
2/2✓ Branch 0 taken 97943 times.
✓ Branch 1 taken 1837 times.
|
99780 | if(attack==wWand) |
| 13221 | 1837 | startwpn(attackid); // Flame if the Wand stab animation WAS used (it always is). | |
| 13222 | |||
| 13223 |
5/6✓ Branch 0 taken 1303 times.
✓ Branch 1 taken 98477 times.
✓ Branch 2 taken 1303 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1256 times.
✓ Branch 5 taken 47 times.
|
99780 | if(attack==wFire && candleid!=-1 && itemsbuf[candleid].wpn) // Flame if the Candle stab animation WAS used. |
| 13224 | 47 | startwpn(attackid); | |
| 13225 | |||
| 13226 |
4/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 99778 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
99780 | if(attack==wCByrna && byrnaid!=-1 && itemsbuf[byrnaid].wpn) // Beam if the Byrna stab animation WAS used. |
| 13227 | 2 | startwpn(attackid); | |
| 13228 | 99780 | } | |
| 13229 | |||
| 13230 |
2/2✓ Branch 0 taken 1543182 times.
✓ Branch 1 taken 98886 times.
|
1642068 | if(attackclk==14) |
| 13231 | 98886 | lstep = s; | |
| 13232 | |||
| 13233 | 1642068 | return true; | |
| 13234 | 1762205 | } | |
| 13235 | |||
| 13236 | 26857412 | bool HeroClass::can_attack() | |
| 13237 | { | ||
| 13238 |
4/4✓ Branch 0 taken 18760 times.
✓ Branch 1 taken 26838652 times.
✓ Branch 2 taken 2880 times.
✓ Branch 3 taken 15880 times.
|
26857412 | if(lift_wpn && (liftflags & LIFTFL_DIS_ITEMS)) |
| 13239 | 15880 | return false; | |
| 13240 |
4/4✓ Branch 0 taken 26517154 times.
✓ Branch 1 taken 324378 times.
✓ Branch 2 taken 17901896 times.
✓ Branch 3 taken 8615258 times.
|
26841532 | int32_t currentSwordOrWand = (itemsbuf[dowpn].family == itype_wand || itemsbuf[dowpn].family == itype_sword)?dowpn:-1; |
| 13241 |
4/6✓ Branch 0 taken 26841532 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 26574438 times.
✓ Branch 3 taken 267094 times.
✓ Branch 4 taken 26574438 times.
✗ Branch 5 not taken.
|
28245104 | if(action==hopping || action==swimming || action==freeze || action==sideswimfreeze |
| 13242 |
5/8✓ Branch 0 taken 26574438 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 26574438 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 26574438 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 26567530 times.
✓ Branch 7 taken 6908 times.
|
26574438 | || lstunclock > 0 || is_conveyor_stunned || spins>0 || usingActiveShield() |
| 13243 |
3/4✓ Branch 0 taken 26567530 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 23244042 times.
✓ Branch 3 taken 3323488 times.
|
26567530 | || ((action==attacking||action==sideswimattacking) |
| 13244 |
2/2✓ Branch 0 taken 740800 times.
✓ Branch 1 taken 25826730 times.
|
26567530 | && ((attack!=wSword && attack!=wWand) || !(itemsbuf[currentSwordOrWand].flags & item_flag5)) |
| 13245 |
2/2✓ Branch 0 taken 26489502 times.
✓ Branch 1 taken 662772 times.
|
26567530 | && charging!=0)) |
| 13246 | { | ||
| 13247 | 1677574 | return false; | |
| 13248 | } | ||
| 13249 | |||
| 13250 | 26489502 | int32_t r = (isdungeon()) ? 16 : 0; | |
| 13251 | 26489502 | int32_t r2 = get_qr(qr_NOBORDER) ? 0 : 8; | |
| 13252 | |||
| 13253 |
4/5✓ Branch 0 taken 7264862 times.
✓ Branch 1 taken 19224640 times.
✓ Branch 2 taken 8484302 times.
✓ Branch 3 taken 10740338 times.
✗ Branch 4 not taken.
|
26489502 | if(!get_qr(qr_ITEMSONEDGES)) switch(dir) |
| 13254 | { | ||
| 13255 | case up: | ||
| 13256 | case down: | ||
| 13257 |
2/2✓ Branch 0 taken 8184290 times.
✓ Branch 1 taken 300012 times.
|
8484302 | return !(y<(r2+r) || y>(160-r-r2)); |
| 13258 | |||
| 13259 | case left: | ||
| 13260 | case right: | ||
| 13261 |
2/2✓ Branch 0 taken 10451350 times.
✓ Branch 1 taken 288988 times.
|
10740338 | return !(x<(r2+r) || x>(240-r-r2)); |
| 13262 | ✗ | } | |
| 13263 | |||
| 13264 | 7264862 | return true; | |
| 13265 | 28182956 | } | |
| 13266 | |||
| 13267 | 16775 | bool isRaftFlag(int32_t flag) | |
| 13268 | { | ||
| 13269 |
4/4✓ Branch 0 taken 8791 times.
✓ Branch 1 taken 7984 times.
✓ Branch 2 taken 255 times.
✓ Branch 3 taken 8536 times.
|
16775 | return (flag==mfRAFT || flag==mfRAFT_BRANCH || flag==mfRAFT_BOUNCE); |
| 13270 | } | ||
| 13271 | |||
| 13272 | 7492412 | void handle_lens_triggers(int32_t l_id) | |
| 13273 | { | ||
| 13274 |
2/2✓ Branch 0 taken 7486153 times.
✓ Branch 1 taken 6259 times.
|
7492412 | bool enabled = l_id >= 0 && (itemsbuf[l_id].flags & item_flag6); |
| 13275 |
2/2✓ Branch 0 taken 7492412 times.
✓ Branch 1 taken 52446884 times.
|
59939296 | for(auto layer = 0; layer < 7; ++layer) |
| 13276 | { | ||
| 13277 | 52446884 | mapscr* tmp = FFCore.tempScreens[layer]; | |
| 13278 |
2/2✓ Branch 0 taken 9230651584 times.
✓ Branch 1 taken 52446884 times.
|
9283098468 | for(auto pos = 0; pos < 176; ++pos) |
| 13279 | { | ||
| 13280 | 9230651584 | newcombo const& cmb = combobuf[tmp->data[pos]]; | |
| 13281 |
4/4✓ Branch 0 taken 280896 times.
✓ Branch 1 taken 9230370688 times.
✓ Branch 2 taken 9230651398 times.
✓ Branch 3 taken 186 times.
|
9230651584 | if(enabled ? (cmb.triggerflags[1] & combotriggerLENSON) |
| 13282 | 9230370688 | : (cmb.triggerflags[1] & combotriggerLENSOFF)) | |
| 13283 | { | ||
| 13284 | 186 | do_trigger_combo(layer, pos); | |
| 13285 | 186 | } | |
| 13286 | 9230651584 | } | |
| 13287 | 52446884 | } | |
| 13288 |
2/2✓ Branch 0 taken 6537006 times.
✓ Branch 1 taken 955406 times.
|
7492412 | if (!get_qr(qr_OLD_FFC_FUNCTIONALITY)) |
| 13289 | { | ||
| 13290 | 955406 | word c = tmpscr->numFFC(); | |
| 13291 |
2/2✓ Branch 0 taken 2492052 times.
✓ Branch 1 taken 955406 times.
|
3447458 | for(word i=0; i<c; i++) |
| 13292 | { | ||
| 13293 | 2492052 | ffcdata& ffc = tmpscr->ffcs[i]; | |
| 13294 | 2492052 | newcombo const& cmb = combobuf[ffc.data]; | |
| 13295 |
3/4✓ Branch 0 taken 1596 times.
✓ Branch 1 taken 2490456 times.
✓ Branch 2 taken 2492052 times.
✗ Branch 3 not taken.
|
2492052 | if(enabled ? (cmb.triggerflags[1] & combotriggerLENSON) |
| 13296 | 2490456 | : (cmb.triggerflags[1] & combotriggerLENSOFF)) | |
| 13297 | { | ||
| 13298 | ✗ | do_trigger_combo_ffc(i); | |
| 13299 | ✗ | } | |
| 13300 | 2492052 | } | |
| 13301 | 955406 | } | |
| 13302 | 7492412 | } | |
| 13303 | |||
| 13304 | 13555937 | void do_lens() | |
| 13305 | { | ||
| 13306 |
2/2✓ Branch 0 taken 6063525 times.
✓ Branch 1 taken 7492412 times.
|
13555937 | if ( FFCore.getQuestHeaderInfo(vZelda) < 0x250 ) //2.10 or earlier |
| 13307 | { | ||
| 13308 | 6063525 | do_210_lens(); | |
| 13309 | 6063525 | return; | |
| 13310 | } | ||
| 13311 | |||
| 13312 | 7492412 | int32_t wpnPressed = getWpnPressed(itype_lens); | |
| 13313 |
6/6✓ Branch 0 taken 6256 times.
✓ Branch 1 taken 7486156 times.
✓ Branch 2 taken 375 times.
✓ Branch 3 taken 7485781 times.
✓ Branch 4 taken 390142 times.
✓ Branch 5 taken 7095639 times.
|
7492412 | int32_t itemid = lensid >= 0 ? lensid : wpnPressed>0 ? wpnPressed : Hero.getLastLensID()>0 ? Hero.getLastLensID() : current_item_id(itype_lens); |
| 13314 |
2/2✓ Branch 0 taken 6020950 times.
✓ Branch 1 taken 1471462 times.
|
7492412 | if(itemid >= 0) |
| 13315 | { | ||
| 13316 |
8/10✓ Branch 0 taken 5343 times.
✓ Branch 1 taken 1466119 times.
✓ Branch 2 taken 5343 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 693 times.
✓ Branch 5 taken 4650 times.
✓ Branch 6 taken 693 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 166 times.
✓ Branch 9 taken 527 times.
|
1471462 | if(isWpnPressed(itype_lens) && checkitem_jinx(itemid) && !lensclk && checkbunny(itemid) && checkmagiccost(itemid)) |
| 13317 | { | ||
| 13318 |
2/2✓ Branch 0 taken 318 times.
✓ Branch 1 taken 209 times.
|
527 | if(lensid<0) |
| 13319 | { | ||
| 13320 | 209 | lensid=itemid; | |
| 13321 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 209 times.
|
209 | if(itemsbuf[itemid].family == itype_lens) |
| 13322 | 209 | Hero.setLastLensID(itemid); | |
| 13323 |
2/2✓ Branch 0 taken 197 times.
✓ Branch 1 taken 12 times.
|
209 | if(get_qr(qr_MORESOUNDS)) sfx(itemsbuf[itemid].usesound); |
| 13324 | 209 | } | |
| 13325 | |||
| 13326 | 527 | paymagiccost(itemid, true); //Needs to ignore timer cause lensclk is our timer. | |
| 13327 | |||
| 13328 |
2/10✓ Branch 0 taken 527 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 527 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
527 | if(itemid>=0 && itemsbuf[itemid].script != 0 && !did_scriptl && !(FFCore.doscript(ScriptType::Item, itemid) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING))) |
| 13329 | { | ||
| 13330 | //clear the item script stack for a new script | ||
| 13331 | ✗ | int i = itemid; | |
| 13332 | ✗ | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 13333 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[i].script, i); | |
| 13334 | ✗ | did_scriptl=true; | |
| 13335 | ✗ | } | |
| 13336 | |||
| 13337 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 527 times.
|
527 | if (itemsbuf[itemid].magiccosttimer[0]) lensclk = itemsbuf[itemid].magiccosttimer[0]; |
| 13338 | 527 | else lensclk = 12; | |
| 13339 | 527 | } | |
| 13340 | else | ||
| 13341 | { | ||
| 13342 | 1470935 | did_scriptl=false; | |
| 13343 |
2/2✓ Branch 0 taken 1465203 times.
✓ Branch 1 taken 5732 times.
|
1470935 | if(!lensclk) |
| 13344 | { | ||
| 13345 | |||
| 13346 |
2/2✓ Branch 0 taken 1464997 times.
✓ Branch 1 taken 206 times.
|
1465203 | if(lensid>-1) |
| 13347 | { | ||
| 13348 | 206 | lensid=-1; | |
| 13349 | 206 | lensclk = 0; | |
| 13350 | |||
| 13351 |
2/2✓ Branch 0 taken 195 times.
✓ Branch 1 taken 11 times.
|
206 | if(get_qr(qr_MORESOUNDS)) sfx(WAV_ZN1LENSOFF); |
| 13352 | 206 | } | |
| 13353 | 1465203 | } | |
| 13354 | } | ||
| 13355 | 1471462 | } | |
| 13356 | 7492412 | handle_lens_triggers(lensid); | |
| 13357 | 13555937 | } | |
| 13358 | |||
| 13359 | 6063525 | void do_210_lens() | |
| 13360 | { | ||
| 13361 | 6063525 | int32_t wpnPressed = getWpnPressed(itype_lens); | |
| 13362 |
4/4✓ Branch 0 taken 3334 times.
✓ Branch 1 taken 6060191 times.
✓ Branch 2 taken 487 times.
✓ Branch 3 taken 6059704 times.
|
6063525 | int32_t itemid = lensid >= 0 ? lensid : wpnPressed>-1 ? wpnPressed : current_item_id(itype_lens); |
| 13363 |
2/2✓ Branch 0 taken 1226986 times.
✓ Branch 1 taken 4836539 times.
|
6063525 | if(itemid<0) |
| 13364 | 4836539 | return; | |
| 13365 | |||
| 13366 |
7/8✓ Branch 0 taken 3343 times.
✓ Branch 1 taken 1223643 times.
✓ Branch 2 taken 3343 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 522 times.
✓ Branch 5 taken 2821 times.
✓ Branch 6 taken 7 times.
✓ Branch 7 taken 515 times.
|
1226986 | if(isWpnPressed(itype_lens) && checkitem_jinx(itemid) && !lensclk && checkmagiccost(itemid)) |
| 13367 | { | ||
| 13368 |
2/2✓ Branch 0 taken 35 times.
✓ Branch 1 taken 480 times.
|
515 | if(lensid<0) |
| 13369 | { | ||
| 13370 | 480 | lensid=itemid; | |
| 13371 | |||
| 13372 |
1/2✓ Branch 0 taken 480 times.
✗ Branch 1 not taken.
|
480 | if(get_qr(qr_MORESOUNDS)) sfx(itemsbuf[itemid].usesound); |
| 13373 | 480 | } | |
| 13374 | |||
| 13375 | 515 | paymagiccost(itemid, true); | |
| 13376 | |||
| 13377 |
2/10✓ Branch 0 taken 515 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 515 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
515 | if(itemid>=0 && itemsbuf[itemid].script != 0 && !did_scriptl && !(FFCore.doscript(ScriptType::Item, itemid) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING))) |
| 13378 | { | ||
| 13379 | //clear the item script stack for a new script | ||
| 13380 | ✗ | int i = itemid; | |
| 13381 | ✗ | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 13382 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[i].script, i); | |
| 13383 | ✗ | did_scriptl=true; | |
| 13384 | ✗ | } | |
| 13385 | |||
| 13386 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 515 times.
|
515 | if (itemsbuf[itemid].magiccosttimer[0]) lensclk = itemsbuf[itemid].magiccosttimer[0]; |
| 13387 | 515 | else lensclk = 12; | |
| 13388 | 515 | } | |
| 13389 | else | ||
| 13390 | { | ||
| 13391 | 1226471 | did_scriptl=false; | |
| 13392 | |||
| 13393 |
7/8✓ Branch 0 taken 3299 times.
✓ Branch 1 taken 1223172 times.
✓ Branch 2 taken 2821 times.
✓ Branch 3 taken 478 times.
✓ Branch 4 taken 2821 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2820 times.
✓ Branch 7 taken 1 times.
|
1226471 | if(lensid>-1 && !(isWpnPressed(itype_lens) && checkitem_jinx(itemid) && checkmagiccost(itemid))) |
| 13394 | { | ||
| 13395 | 479 | lensid=-1; | |
| 13396 | 479 | lensclk = 0; | |
| 13397 | |||
| 13398 |
1/2✓ Branch 0 taken 479 times.
✗ Branch 1 not taken.
|
479 | if(get_qr(qr_MORESOUNDS)) sfx(WAV_ZN1LENSOFF); |
| 13399 | 479 | } | |
| 13400 | } | ||
| 13401 | 6063525 | } | |
| 13402 | |||
| 13403 | 14081 | void HeroClass::do_hopping() | |
| 13404 | { | ||
| 13405 | 14081 | do_lens(); | |
| 13406 | |||
| 13407 |
2/2✓ Branch 0 taken 554 times.
✓ Branch 1 taken 13527 times.
|
14081 | if(hopclk==0xFF) //|| (diagonalMovement && hopclk >= 0xFF) )) // swimming |
| 13408 | //Possible fix for exiting water in diagonal movement. -Z | ||
| 13409 | { | ||
| 13410 | 554 | int32_t flippers_id = current_item_id(itype_flippers); | |
| 13411 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 550 times.
|
554 | if(diveclk>0) |
| 13412 | { | ||
| 13413 | 4 | --diveclk; | |
| 13414 |
2/6✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
4 | if(flippers_id > -1 && itemsbuf[flippers_id].flags & item_flag2 && DrunkrAbtn()) //Cancellable Diving -V |
| 13415 | { | ||
| 13416 | ✗ | diveclk = itemsbuf[flippers_id].misc2; | |
| 13417 | ✗ | } | |
| 13418 | 4 | } | |
| 13419 |
2/2✓ Branch 0 taken 548 times.
✓ Branch 1 taken 2 times.
|
550 | else if(DrunkrAbtn()) |
| 13420 | { | ||
| 13421 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | bool global_diving=(flippers_id > -1 && itemsbuf[flippers_id].flags & item_flag1); |
| 13422 | 2 | bool screen_diving=(tmpscr->flags5&fTOGGLEDIVING) != 0; | |
| 13423 | |||
| 13424 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if(global_diving==screen_diving) |
| 13425 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | diveclk = (flippers_id < 0 ? 80 : (itemsbuf[flippers_id].misc1 + itemsbuf[flippers_id].misc2)); |
| 13426 | 2 | } | |
| 13427 | |||
| 13428 |
6/8✓ Branch 0 taken 427 times.
✓ Branch 1 taken 127 times.
✓ Branch 2 taken 156 times.
✓ Branch 3 taken 398 times.
✓ Branch 4 taken 156 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 156 times.
|
554 | if((!(x.getInt()&7) && !(y.getInt()&7)) || (diagonalMovement||NO_GRIDLOCK)) |
| 13429 | { | ||
| 13430 | 398 | SetSwim(); | |
| 13431 | 398 | hopclk = 0; | |
| 13432 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 398 times.
|
398 | if (!IsSideSwim()) |
| 13433 | { | ||
| 13434 | 398 | charging = attackclk = 0; | |
| 13435 | 398 | tapping = false; | |
| 13436 | 398 | } | |
| 13437 | 398 | } | |
| 13438 | else | ||
| 13439 | { | ||
| 13440 | 156 | herostep(); | |
| 13441 | |||
| 13442 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 156 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
156 | if(!isDiving() || (frame&1)) |
| 13443 | { | ||
| 13444 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 42 times.
✓ Branch 2 taken 7 times.
✓ Branch 3 taken 30 times.
✓ Branch 4 taken 77 times.
|
156 | switch(dir) |
| 13445 | { | ||
| 13446 | case up: | ||
| 13447 | 42 | y -= 1; | |
| 13448 | 42 | break; | |
| 13449 | |||
| 13450 | case down: | ||
| 13451 | 7 | y += 1; | |
| 13452 | 7 | break; | |
| 13453 | |||
| 13454 | case left: | ||
| 13455 | 30 | x -= 1; | |
| 13456 | 30 | break; | |
| 13457 | |||
| 13458 | case right: | ||
| 13459 | 77 | x += 1; | |
| 13460 | 77 | break; | |
| 13461 | } | ||
| 13462 | 156 | } | |
| 13463 | } | ||
| 13464 | 554 | } | |
| 13465 | else // hopping in or out (need to separate the cases...) | ||
| 13466 | { | ||
| 13467 |
4/6✓ Branch 0 taken 12509 times.
✓ Branch 1 taken 1018 times.
✓ Branch 2 taken 12509 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 12509 times.
|
13527 | if((diagonalMovement||NO_GRIDLOCK)) |
| 13468 | { | ||
| 13469 |
2/2✓ Branch 0 taken 643 times.
✓ Branch 1 taken 375 times.
|
1018 | if(hopclk==1) //hopping out |
| 13470 | //>= 1 possible fix for getting stuck on land edges. | ||
| 13471 | //No, this is not a clock. it's a type. 1 == out, 2 == in. | ||
| 13472 | { | ||
| 13473 |
1/2✓ Branch 0 taken 375 times.
✗ Branch 1 not taken.
|
375 | if(hopdir!=-1) dir=hopdir; |
| 13474 | |||
| 13475 | 375 | landswim=0; | |
| 13476 | |||
| 13477 |
2/2✓ Branch 0 taken 274 times.
✓ Branch 1 taken 101 times.
|
375 | if(dir==up) |
| 13478 | { | ||
| 13479 | 101 | herostep(); | |
| 13480 | 101 | herostep(); | |
| 13481 | 101 | int32_t sidestep=0; | |
| 13482 | |||
| 13483 |
2/6✗ Branch 0 not taken.
✓ Branch 1 taken 101 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 101 times.
|
101 | if(iswaterex(MAPCOMBO(x,y+(bigHitbox?0:8)-1), currmap, currscr, -1, x,y+(bigHitbox?0:8)-1, true, false) && !iswaterex(MAPCOMBO(x+8,y+(bigHitbox?0:8)-1), currmap, currscr, -1, x+8,y+(bigHitbox?0:8)-1, true, false) && !iswaterex(MAPCOMBO(x+15,y+(bigHitbox?0:8)-1), currmap, currscr, -1, x+15,y+(bigHitbox?0:8)-1, true, false)) |
| 13484 | ✗ | sidestep=1; | |
| 13485 |
3/6✓ Branch 0 taken 101 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 101 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 101 times.
✗ Branch 5 not taken.
|
101 | else if(!iswaterex(MAPCOMBO(x,y+(bigHitbox?0:8)-1), currmap, currscr, -1, x,y+(bigHitbox?0:8)-1, true, false) && !iswaterex(MAPCOMBO(x+7,y+(bigHitbox?0:8)-1), currmap, currscr, -1, x+7,y+(bigHitbox?0:8)-1, true, false) && iswaterex(MAPCOMBO(x+15,y+(bigHitbox?0:8)-1), currmap, currscr, -1, x+15,y+(bigHitbox?0:8)-1, true, false)) |
| 13486 | ✗ | sidestep=2; | |
| 13487 | |||
| 13488 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 101 times.
|
101 | if(sidestep==1) x++; |
| 13489 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 101 times.
|
101 | else if(sidestep==2) x--; |
| 13490 | 101 | else y--; | |
| 13491 | |||
| 13492 |
3/4✓ Branch 0 taken 101 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 93 times.
✓ Branch 3 taken 8 times.
|
101 | if(!iswaterex(MAPCOMBO(x.getInt(),y.getInt()+(bigHitbox?0:8)), currmap, currscr, -1, x.getInt(),y.getInt()+(bigHitbox?0:8), true, false)&&!iswaterex(MAPCOMBO(x.getInt(),y.getInt()+15), currmap, currscr, -1, x.getInt(),y.getInt()+15, true, false)) |
| 13493 | { | ||
| 13494 | 8 | hopclk=0; | |
| 13495 | 8 | diveclk=0; | |
| 13496 | 8 | action=none; FFCore.setHeroAction(none); | |
| 13497 | 8 | hopdir=-1; | |
| 13498 | 8 | } | |
| 13499 | 101 | } | |
| 13500 | |||
| 13501 |
2/2✓ Branch 0 taken 303 times.
✓ Branch 1 taken 72 times.
|
375 | if(dir==down) |
| 13502 | { | ||
| 13503 | 72 | herostep(); | |
| 13504 | 72 | herostep(); | |
| 13505 | 72 | int32_t sidestep=0; | |
| 13506 | |||
| 13507 |
2/6✗ Branch 0 not taken.
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 72 times.
|
72 | if(iswaterex(MAPCOMBO(x,y+16), currmap, currscr, -1, x,y+16, true, false) && !iswaterex(MAPCOMBO(x+8,y+16), currmap, currscr, -1, x+8,y+16, true, false) && !iswaterex(MAPCOMBO(x+15,y+16), currmap, currscr, -1, x+15,y+16, true, false)) |
| 13508 | ✗ | sidestep=1; | |
| 13509 |
3/6✓ Branch 0 taken 72 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 72 times.
✓ Branch 4 taken 72 times.
✗ Branch 5 not taken.
|
72 | else if(!iswaterex(MAPCOMBO(x,y+16), currmap, currscr, -1, x,y+16, true, false) && !iswaterex(MAPCOMBO(x+8,y+16), currmap, currscr, -1, x+8,y+16, true, false) && iswaterex(MAPCOMBO(x+15,y+16), currmap, currscr, -1, x+15,y+16, true, false)) |
| 13510 | ✗ | sidestep=2; | |
| 13511 | |||
| 13512 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 72 times.
|
72 | if(sidestep==1) x++; |
| 13513 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 72 times.
|
72 | else if(sidestep==2) x--; |
| 13514 | 72 | else y++; | |
| 13515 | |||
| 13516 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 66 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
72 | if(!iswaterex(MAPCOMBO(x.getInt(),y.getInt()+(bigHitbox?0:8)), currmap, currscr, -1, x.getInt(),y.getInt()+(bigHitbox?0:8), true, false)&&!iswaterex(MAPCOMBO(x.getInt(),y.getInt()+15), currmap, currscr, -1, x.getInt(),y.getInt()+15, true, false)) |
| 13517 | { | ||
| 13518 | 6 | hopclk=0; | |
| 13519 | 6 | diveclk=0; | |
| 13520 | 6 | action=none; FFCore.setHeroAction(none); | |
| 13521 | 6 | hopdir=-1; | |
| 13522 | 6 | } | |
| 13523 | 72 | } | |
| 13524 | |||
| 13525 |
2/2✓ Branch 0 taken 318 times.
✓ Branch 1 taken 57 times.
|
375 | if(dir==left) |
| 13526 | { | ||
| 13527 | 57 | herostep(); | |
| 13528 | 57 | herostep(); | |
| 13529 | 57 | int32_t sidestep=0; | |
| 13530 | |||
| 13531 |
2/6✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 57 times.
|
57 | if(iswaterex(MAPCOMBO(x-1,y+(bigHitbox?0:8)), currmap, currscr, -1, x-1,y+(bigHitbox?0:8), true, false) && !iswaterex(MAPCOMBO(x-1,y+(bigHitbox?8:12)), currmap, currscr, -1, x-1,y+(bigHitbox?8:12), true, false) && !iswaterex(MAPCOMBO(x-1,y+15), currmap, currscr, -1, x-1,y+15, true, false)) |
| 13532 | ✗ | sidestep=1; | |
| 13533 |
3/6✓ Branch 0 taken 57 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 57 times.
✓ Branch 4 taken 57 times.
✗ Branch 5 not taken.
|
57 | else if(!iswaterex(MAPCOMBO(x-1,y+(bigHitbox?0:8)), currmap, currscr, -1, x-1,y+(bigHitbox?0:8), true, false) && !iswaterex(MAPCOMBO(x-1,y+(bigHitbox?7:11)), currmap, currscr, -1, x-1,y+(bigHitbox?7:11), true, false) && iswaterex(MAPCOMBO(x-1,y+15), currmap, currscr, -1, x-1,y+15, true, false)) |
| 13534 | ✗ | sidestep=2; | |
| 13535 | |||
| 13536 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
57 | if(sidestep==1) y++; |
| 13537 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
57 | else if(sidestep==2) y--; |
| 13538 | 57 | else x--; | |
| 13539 | |||
| 13540 |
3/4✓ Branch 0 taken 57 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 53 times.
✓ Branch 3 taken 4 times.
|
57 | if(!iswaterex(MAPCOMBO(x.getInt(),y.getInt()+(bigHitbox?0:8)), currmap, currscr, -1, x.getInt(),y.getInt()+(bigHitbox?0:8), true, false)&&!iswaterex(MAPCOMBO(x.getInt()+15,y.getInt()+8), currmap, currscr, -1, x.getInt()+15,y.getInt()+8, true, false)) |
| 13541 | { | ||
| 13542 | 4 | hopclk=0; | |
| 13543 | 4 | diveclk=0; | |
| 13544 | 4 | action=none; FFCore.setHeroAction(none); | |
| 13545 | 4 | hopdir=-1; | |
| 13546 | 4 | } | |
| 13547 | 57 | } | |
| 13548 | |||
| 13549 |
2/2✓ Branch 0 taken 230 times.
✓ Branch 1 taken 145 times.
|
375 | if(dir==right) |
| 13550 | { | ||
| 13551 | 145 | herostep(); | |
| 13552 | 145 | herostep(); | |
| 13553 | 145 | int32_t sidestep=0; | |
| 13554 | |||
| 13555 |
2/6✗ Branch 0 not taken.
✓ Branch 1 taken 145 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 145 times.
|
145 | if(iswaterex(MAPCOMBO(x+16,y+(bigHitbox?0:8)), currmap, currscr, -1, x+16,y+(bigHitbox?0:8), true, false) && !iswaterex(MAPCOMBO(x+16,y+(bigHitbox?8:12)), currmap, currscr, -1, x+16,y+(bigHitbox?8:12), true, false) && !iswaterex(MAPCOMBO(x+16,y+15), currmap, currscr, -1, x+16,y+15, true, false)) |
| 13556 | ✗ | sidestep=1; | |
| 13557 |
3/6✓ Branch 0 taken 145 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 145 times.
✓ Branch 4 taken 145 times.
✗ Branch 5 not taken.
|
145 | else if(!iswaterex(MAPCOMBO(x+16,y+(bigHitbox?0:8)), currmap, currscr, -1, x+16,y+(bigHitbox?0:8), true, false) && !iswaterex(MAPCOMBO(x+16,y+(bigHitbox?7:11)), currmap, currscr, -1, x+16,y+(bigHitbox?7:11), true, false) && iswaterex(MAPCOMBO(x+16,y+15), currmap, currscr, -1, x+16,y+15, true, false)) |
| 13558 | ✗ | sidestep=2; | |
| 13559 | |||
| 13560 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 145 times.
|
145 | if(sidestep==1) y++; |
| 13561 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 145 times.
|
145 | else if(sidestep==2) y--; |
| 13562 | 145 | else x++; | |
| 13563 | |||
| 13564 |
3/4✓ Branch 0 taken 11 times.
✓ Branch 1 taken 134 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 11 times.
|
145 | if(!iswaterex(MAPCOMBO(x.getInt(),y.getInt()+(bigHitbox?0:8)), currmap, currscr, -1, x.getInt(),y.getInt()+(bigHitbox?0:8), true, false)&&!iswaterex(MAPCOMBO(x.getInt()+15,y.getInt()+8), currmap, currscr, -1, x.getInt()+15,y.getInt()+8, true, false)) |
| 13565 | { | ||
| 13566 | 11 | hopclk=0; | |
| 13567 | 11 | diveclk=0; | |
| 13568 | 11 | action=none; FFCore.setHeroAction(none); | |
| 13569 | 11 | hopdir=-1; | |
| 13570 | 11 | } | |
| 13571 | 145 | } | |
| 13572 | 375 | } | |
| 13573 | |||
| 13574 |
2/2✓ Branch 0 taken 375 times.
✓ Branch 1 taken 643 times.
|
1018 | if(hopclk==2) //hopping in |
| 13575 | { | ||
| 13576 | 643 | landswim=0; | |
| 13577 | |||
| 13578 |
2/2✓ Branch 0 taken 554 times.
✓ Branch 1 taken 89 times.
|
643 | if(dir==up) |
| 13579 | { | ||
| 13580 | 89 | herostep(); | |
| 13581 | 89 | herostep(); | |
| 13582 | 89 | int32_t sidestep=0; | |
| 13583 | |||
| 13584 |
6/6✓ Branch 0 taken 40 times.
✓ Branch 1 taken 49 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 39 times.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 88 times.
|
89 | if(!iswaterex(MAPCOMBO(x,y+(bigHitbox?0:8)-1), currmap, currscr, -1, x,y+(bigHitbox?0:8)-1, true, false) && iswaterex(MAPCOMBO(x+8,y+(bigHitbox?0:8)-1), currmap, currscr, -1, x+8,y+(bigHitbox?0:8)-1, true, false) && iswaterex(MAPCOMBO(x+15,y+(bigHitbox?0:8)-1), currmap, currscr, -1, x+15,y+(bigHitbox?0:8)-1, true, false)) |
| 13585 | 1 | sidestep=1; | |
| 13586 |
4/6✓ Branch 0 taken 49 times.
✓ Branch 1 taken 39 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 49 times.
✓ Branch 4 taken 88 times.
✗ Branch 5 not taken.
|
88 | else if(iswaterex(MAPCOMBO(x,y+(bigHitbox?0:8)-1), currmap, currscr, -1, x,y+(bigHitbox?0:8)-1, true, false) && iswaterex(MAPCOMBO(x+7,y+(bigHitbox?0:8)-1), currmap, currscr, -1, x+7,y+(bigHitbox?0:8)-1, true, false) && !iswaterex(MAPCOMBO(x+15,y+(bigHitbox?0:8)-1), currmap, currscr, -1, x+15,y+(bigHitbox?0:8)-1, true, false)) |
| 13587 | ✗ | sidestep=2; | |
| 13588 | |||
| 13589 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 88 times.
|
89 | if(sidestep==1) x++; |
| 13590 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 88 times.
|
88 | else if(sidestep==2) x--; |
| 13591 | 88 | else y--; | |
| 13592 | |||
| 13593 |
4/4✓ Branch 0 taken 50 times.
✓ Branch 1 taken 39 times.
✓ Branch 2 taken 46 times.
✓ Branch 3 taken 4 times.
|
89 | if(iswaterex(MAPCOMBO(x.getInt(),y.getInt()+(bigHitbox?0:8)), currmap, currscr, -1, x.getInt(),y.getInt()+(bigHitbox?0:8), true, false)&&iswaterex(MAPCOMBO(x.getInt(),y.getInt()+15), currmap, currscr, -1, x.getInt(),y.getInt()+15, true, false)) |
| 13594 | { | ||
| 13595 | 4 | hopclk=0xFF; | |
| 13596 | 4 | diveclk=0; | |
| 13597 | 4 | SetSwim(); | |
| 13598 | 4 | } | |
| 13599 | 89 | } | |
| 13600 | |||
| 13601 |
2/2✓ Branch 0 taken 501 times.
✓ Branch 1 taken 142 times.
|
643 | if(dir==down) |
| 13602 | { | ||
| 13603 | 142 | herostep(); | |
| 13604 | 142 | herostep(); | |
| 13605 | 142 | int32_t sidestep=0; | |
| 13606 | |||
| 13607 |
3/6✓ Branch 0 taken 142 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 142 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 142 times.
|
142 | if(!iswaterex(MAPCOMBO(x,y+16), currmap, currscr, -1, x,y+16, true, false) && iswaterex(MAPCOMBO(x+8,y+16), currmap, currscr, -1, x+8,y+16, true, false) && iswaterex(MAPCOMBO(x+15,y+16), currmap, currscr, -1, x+15,y+16, true, false)) |
| 13608 | ✗ | sidestep=1; | |
| 13609 |
2/6✗ Branch 0 not taken.
✓ Branch 1 taken 142 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 142 times.
✗ Branch 5 not taken.
|
142 | else if(iswaterex(MAPCOMBO(x,y+16), currmap, currscr, -1, x,y+16, true, false) && iswaterex(MAPCOMBO(x+8,y+16), currmap, currscr, -1, x+8,y+16, true, false) && !iswaterex(MAPCOMBO(x+15,y+16), currmap, currscr, -1, x+15,y+16, true, false)) |
| 13610 | ✗ | sidestep=2; | |
| 13611 | |||
| 13612 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 142 times.
|
142 | if(sidestep==1) x++; |
| 13613 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 142 times.
|
142 | else if(sidestep==2) x--; |
| 13614 | 142 | else y++; | |
| 13615 | |||
| 13616 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 142 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
142 | if(iswaterex(MAPCOMBO(x.getInt(),y.getInt()+(bigHitbox?0:8)), currmap, currscr, -1, x.getInt(),y.getInt()+(bigHitbox?0:8), true, false)&&iswaterex(MAPCOMBO(x.getInt(),y.getInt()+15), currmap, currscr, -1, x.getInt(),y.getInt()+15, true, false)) |
| 13617 | { | ||
| 13618 | ✗ | hopclk=0xFF; | |
| 13619 | ✗ | diveclk=0; | |
| 13620 | ✗ | SetSwim(); | |
| 13621 | ✗ | if (!IsSideSwim()) reset_swordcharge(); | |
| 13622 | ✗ | } | |
| 13623 | 142 | } | |
| 13624 | |||
| 13625 |
2/2✓ Branch 0 taken 510 times.
✓ Branch 1 taken 133 times.
|
643 | if(dir==left) |
| 13626 | { | ||
| 13627 | 133 | herostep(); | |
| 13628 | 133 | herostep(); | |
| 13629 | 133 | int32_t sidestep=0; | |
| 13630 | |||
| 13631 |
4/6✓ Branch 0 taken 31 times.
✓ Branch 1 taken 102 times.
✓ Branch 2 taken 31 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 133 times.
|
133 | if(!iswaterex(MAPCOMBO(x-1,y+(bigHitbox?0:8)), currmap, currscr, -1, x-1,y+(bigHitbox?0:8), true, false) && iswaterex(MAPCOMBO(x-1,y+(bigHitbox?8:12)), currmap, currscr, -1, x-1,y+(bigHitbox?8:12), true, false) && iswaterex(MAPCOMBO(x-1,y+15), currmap, currscr, -1, x-1,y+15, true, false)) |
| 13632 | ✗ | sidestep=1; | |
| 13633 |
4/6✓ Branch 0 taken 102 times.
✓ Branch 1 taken 31 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 102 times.
✓ Branch 4 taken 133 times.
✗ Branch 5 not taken.
|
133 | else if(iswaterex(MAPCOMBO(x-1,y+(bigHitbox?0:8)), currmap, currscr, -1, x-1,y+(bigHitbox?0:8), true, false) && iswaterex(MAPCOMBO(x-1,y+(bigHitbox?7:11)), currmap, currscr, -1, x-1,y+(bigHitbox?7:11), true, false) && !iswaterex(MAPCOMBO(x-1,y+15), currmap, currscr, -1, x-1,y+15, true, false)) |
| 13634 | ✗ | sidestep=2; | |
| 13635 | |||
| 13636 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 133 times.
|
133 | if(sidestep==1) y++; |
| 13637 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 133 times.
|
133 | else if(sidestep==2) y--; |
| 13638 | 133 | else x--; | |
| 13639 | |||
| 13640 |
4/4✓ Branch 0 taken 102 times.
✓ Branch 1 taken 31 times.
✓ Branch 2 taken 7 times.
✓ Branch 3 taken 95 times.
|
133 | if(iswaterex(MAPCOMBO(x.getInt(),y.getInt()+(bigHitbox?0:8)), currmap, currscr, -1, x.getInt(),y.getInt()+(bigHitbox?0:8), true, false)&&iswaterex(MAPCOMBO(x.getInt()+15,y.getInt()+8), currmap, currscr, -1, x.getInt()+15,y.getInt()+8, true, false)) |
| 13641 | { | ||
| 13642 | 7 | hopclk=0xFF; | |
| 13643 | 7 | diveclk=0; | |
| 13644 | 7 | SetSwim(); | |
| 13645 | 7 | } | |
| 13646 | 133 | } | |
| 13647 | |||
| 13648 |
2/2✓ Branch 0 taken 364 times.
✓ Branch 1 taken 279 times.
|
643 | if(dir==right) |
| 13649 | { | ||
| 13650 | 279 | herostep(); | |
| 13651 | 279 | herostep(); | |
| 13652 | |||
| 13653 | 279 | int32_t sidestep=0; | |
| 13654 | |||
| 13655 |
4/6✓ Branch 0 taken 207 times.
✓ Branch 1 taken 72 times.
✓ Branch 2 taken 207 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 279 times.
|
279 | if(!iswaterex(MAPCOMBO(x+16,y+(bigHitbox?0:8)), currmap, currscr, -1, x+16,y+(bigHitbox?0:8), true, false) && iswaterex(MAPCOMBO(x+16,y+(bigHitbox?8:12)), currmap, currscr, -1, x+16,y+(bigHitbox?8:12), true, false) && iswaterex(MAPCOMBO(x+16,y+15), currmap, currscr, -1, x+16,y+15, true, false)) |
| 13656 | ✗ | sidestep=1; | |
| 13657 |
4/6✓ Branch 0 taken 72 times.
✓ Branch 1 taken 207 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 72 times.
✓ Branch 4 taken 279 times.
✗ Branch 5 not taken.
|
279 | else if(iswaterex(MAPCOMBO(x+16,y+(bigHitbox?0:8)), currmap, currscr, -1, x+16,y+(bigHitbox?0:8), true, false) && iswaterex(MAPCOMBO(x+16,y+(bigHitbox?7:11)), currmap, currscr, -1, x+16,y+(bigHitbox?7:11), true, false) && !iswaterex(MAPCOMBO(x+16,y+15), currmap, currscr, -1, x+16,y+15, true, false)) |
| 13658 | ✗ | sidestep=2; | |
| 13659 | |||
| 13660 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 279 times.
|
279 | if(sidestep==1) y++; |
| 13661 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 279 times.
|
279 | else if(sidestep==2) y--; |
| 13662 | 279 | else x++; | |
| 13663 | |||
| 13664 |
3/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 274 times.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
279 | if(iswaterex(MAPCOMBO(x.getInt(),y.getInt()+(bigHitbox?0:8)), currmap, currscr, -1, x.getInt(),y.getInt()+(bigHitbox?0:8), true, false)&&iswaterex(MAPCOMBO(x.getInt()+15,y.getInt()+8), currmap, currscr, -1, x.getInt()+15,y.getInt()+8, true, false)) |
| 13665 | { | ||
| 13666 | 5 | hopclk=0xFF; | |
| 13667 | 5 | diveclk=0; | |
| 13668 | 5 | SetSwim(); | |
| 13669 | 5 | } | |
| 13670 | 279 | } | |
| 13671 | 643 | } | |
| 13672 | |||
| 13673 | 1018 | } | |
| 13674 | else | ||
| 13675 | { | ||
| 13676 |
7/8✓ Branch 0 taken 4823 times.
✓ Branch 1 taken 7686 times.
✓ Branch 2 taken 4823 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3622 times.
✓ Branch 5 taken 1201 times.
✓ Branch 6 taken 640 times.
✓ Branch 7 taken 7046 times.
|
12509 | if((dir<left ? !(x.getInt()&7) && !(y.getInt()&15) : !(x.getInt()&15) && !(y.getInt()&7))) |
| 13677 | { | ||
| 13678 | 1201 | action=none; FFCore.setHeroAction(none); | |
| 13679 | 1201 | hopclk = 0; | |
| 13680 | 1201 | diveclk = 0; | |
| 13681 | |||
| 13682 |
2/2✓ Branch 0 taken 576 times.
✓ Branch 1 taken 625 times.
|
1201 | if(iswaterex(MAPCOMBO(x.getInt(),y.getInt()+8), currmap, currscr, -1, x.getInt(),y.getInt()+8, true, false)) |
| 13683 | { | ||
| 13684 | // hopped in | ||
| 13685 | 625 | SetSwim(); | |
| 13686 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 625 times.
|
625 | if (!IsSideSwim()) attackclk = charging = spins = 0; |
| 13687 | 625 | } | |
| 13688 | 1201 | } | |
| 13689 | else | ||
| 13690 | { | ||
| 13691 | 11308 | herostep(); | |
| 13692 | 11308 | herostep(); | |
| 13693 | |||
| 13694 |
2/2✓ Branch 0 taken 10642 times.
✓ Branch 1 taken 666 times.
|
11308 | if(++hero_count>(16*hero_animation_speed)) |
| 13695 | 666 | hero_count=0; | |
| 13696 | |||
| 13697 | 11308 | int32_t xofs2 = x.getInt()&15; | |
| 13698 | 11308 | int32_t yofs2 = y.getInt()&15; | |
| 13699 | 11308 | int32_t s = 1 + (frame&1); | |
| 13700 | |||
| 13701 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 1656 times.
✓ Branch 2 taken 2606 times.
✓ Branch 3 taken 3402 times.
✓ Branch 4 taken 3644 times.
|
11308 | switch(dir) |
| 13702 | { | ||
| 13703 | case up: | ||
| 13704 |
4/4✓ Branch 0 taken 1173 times.
✓ Branch 1 taken 483 times.
✓ Branch 2 taken 1167 times.
✓ Branch 3 taken 6 times.
|
1656 | if(yofs2<3 || yofs2>13) --y; |
| 13705 | 1167 | else y-=s; | |
| 13706 | |||
| 13707 | 1656 | break; | |
| 13708 | |||
| 13709 | case down: | ||
| 13710 |
4/4✓ Branch 0 taken 2152 times.
✓ Branch 1 taken 454 times.
✓ Branch 2 taken 356 times.
✓ Branch 3 taken 1796 times.
|
2606 | if(yofs2<3 || yofs2>13) ++y; |
| 13711 | 1796 | else y+=s; | |
| 13712 | |||
| 13713 | 2606 | break; | |
| 13714 | |||
| 13715 | case left: | ||
| 13716 |
4/4✓ Branch 0 taken 2966 times.
✓ Branch 1 taken 436 times.
✓ Branch 2 taken 598 times.
✓ Branch 3 taken 2368 times.
|
3402 | if(xofs2<3 || xofs2>13) --x; |
| 13717 | 2368 | else x-=s; | |
| 13718 | |||
| 13719 | 3402 | break; | |
| 13720 | |||
| 13721 | case right: | ||
| 13722 |
4/4✓ Branch 0 taken 3009 times.
✓ Branch 1 taken 635 times.
✓ Branch 2 taken 492 times.
✓ Branch 3 taken 2517 times.
|
3644 | if(xofs2<3 || xofs2>13) ++x; |
| 13723 | 2517 | else x+=s; | |
| 13724 | |||
| 13725 | 3644 | break; | |
| 13726 | } | ||
| 13727 | } | ||
| 13728 | } | ||
| 13729 | } | ||
| 13730 | 14081 | } | |
| 13731 | |||
| 13732 | 113150 | void HeroClass::do_rafting() | |
| 13733 | { | ||
| 13734 | |||
| 13735 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 113150 times.
|
113150 | if(toogam) |
| 13736 | { | ||
| 13737 | ✗ | action=none; FFCore.setHeroAction(none); | |
| 13738 | ✗ | return; | |
| 13739 | } | ||
| 13740 | |||
| 13741 | 113150 | FFCore.setHeroAction(rafting); | |
| 13742 | |||
| 13743 | 113150 | do_lens(); | |
| 13744 | |||
| 13745 | 113150 | herostep(); | |
| 13746 | |||
| 13747 | //Calculate rafting speed | ||
| 13748 | 113150 | int32_t raft_item = current_item_id(itype_raft); | |
| 13749 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 113150 times.
|
113150 | int32_t raft_step = (raft_item < 0 ? 1 : itemsbuf[raft_item].misc1); |
| 13750 | 113150 | raft_step = vbound(raft_step, -8, 5); | |
| 13751 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 113150 times.
|
113150 | int32_t raft_time = raft_step < 0 ? 1<<(-raft_step) : 1; |
| 13752 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 113150 times.
|
113150 | if(raft_step < 0) raft_step = 1; |
| 13753 | 113150 | int32_t step_inc = 1 << (raft_step - 1); | |
| 13754 | // Fix position | ||
| 13755 |
1/2✓ Branch 0 taken 113150 times.
✗ Branch 1 not taken.
|
113150 | if(raft_step > 1) |
| 13756 | { | ||
| 13757 | ✗ | if(x.getInt() & (step_inc-1)) | |
| 13758 | { | ||
| 13759 | ✗ | x = x.getInt() & ~(step_inc-1); | |
| 13760 | ✗ | } | |
| 13761 | ✗ | if(y.getInt() & (step_inc-1)) | |
| 13762 | { | ||
| 13763 | ✗ | y = y.getInt() & ~(step_inc-1); | |
| 13764 | ✗ | } | |
| 13765 | ✗ | } | |
| 13766 | // Inc clock, check if we need to move this frame | ||
| 13767 | 113150 | ++raftclk; | |
| 13768 |
2/4✓ Branch 0 taken 113150 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 113150 times.
|
113150 | if((raftclk % raft_time) || raft_step == 0) return; //No movement this frame |
| 13769 | |||
| 13770 |
4/4✓ Branch 0 taken 54339 times.
✓ Branch 1 taken 58811 times.
✓ Branch 2 taken 46510 times.
✓ Branch 3 taken 7829 times.
|
120836 | if(!(x.getInt()&15) && !(y.getInt()&15)) |
| 13771 | { | ||
| 13772 | // this sections handles switching to raft branches | ||
| 13773 |
3/4✓ Branch 0 taken 7575 times.
✓ Branch 1 taken 254 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7575 times.
|
7829 | if((MAPFLAG(x,y)==mfRAFT_BRANCH||MAPCOMBOFLAG(x,y)==mfRAFT_BRANCH)) |
| 13774 | { | ||
| 13775 |
7/8✓ Branch 0 taken 177 times.
✓ Branch 1 taken 77 times.
✓ Branch 2 taken 38 times.
✓ Branch 3 taken 139 times.
✓ Branch 4 taken 3 times.
✓ Branch 5 taken 35 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 3 times.
|
254 | if(dir!=down && DrunkUp() && (isRaftFlag(nextflag(x,y,up,false))||isRaftFlag(nextflag(x,y,up,true)))) |
| 13776 | { | ||
| 13777 | 35 | dir = up; | |
| 13778 | 35 | goto skip; | |
| 13779 | } | ||
| 13780 | |||
| 13781 |
7/8✓ Branch 0 taken 175 times.
✓ Branch 1 taken 44 times.
✓ Branch 2 taken 63 times.
✓ Branch 3 taken 112 times.
✓ Branch 4 taken 15 times.
✓ Branch 5 taken 48 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 15 times.
|
219 | if(dir!=up && DrunkDown() && (isRaftFlag(nextflag(x,y,down,false))||isRaftFlag(nextflag(x,y,down,true)))) |
| 13782 | { | ||
| 13783 | 48 | dir = down; | |
| 13784 | 48 | goto skip; | |
| 13785 | } | ||
| 13786 | |||
| 13787 |
7/8✓ Branch 0 taken 134 times.
✓ Branch 1 taken 37 times.
✓ Branch 2 taken 36 times.
✓ Branch 3 taken 98 times.
✓ Branch 4 taken 5 times.
✓ Branch 5 taken 31 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 5 times.
|
171 | if(dir!=right && DrunkLeft() && (isRaftFlag(nextflag(x,y,left,false))||isRaftFlag(nextflag(x,y,left,true)))) |
| 13788 | { | ||
| 13789 | 31 | dir = left; | |
| 13790 | 31 | goto skip; | |
| 13791 | } | ||
| 13792 | |||
| 13793 |
7/8✓ Branch 0 taken 126 times.
✓ Branch 1 taken 14 times.
✓ Branch 2 taken 41 times.
✓ Branch 3 taken 85 times.
✓ Branch 4 taken 12 times.
✓ Branch 5 taken 29 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 12 times.
|
140 | if(dir!=left && DrunkRight() && (isRaftFlag(nextflag(x,y,right,false))||isRaftFlag(nextflag(x,y,right,true)))) |
| 13794 | { | ||
| 13795 | 29 | dir = right; | |
| 13796 | 29 | goto skip; | |
| 13797 | } | ||
| 13798 | 111 | } | |
| 13799 |
2/4✓ Branch 0 taken 7575 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 7575 times.
|
7575 | else if((MAPFLAG(x,y)==mfRAFT_BOUNCE||MAPCOMBOFLAG(x,y)==mfRAFT_BOUNCE)) |
| 13800 | { | ||
| 13801 | ✗ | if(dir == left) dir = right; | |
| 13802 | ✗ | else if(dir == right) dir = left; | |
| 13803 | ✗ | else if(dir == up) dir = down; | |
| 13804 | ✗ | else if(dir == down) dir = up; | |
| 13805 | ✗ | } | |
| 13806 | |||
| 13807 | |||
| 13808 |
4/4✓ Branch 0 taken 1382 times.
✓ Branch 1 taken 6304 times.
✓ Branch 2 taken 11 times.
✓ Branch 3 taken 1371 times.
|
7686 | if(!isRaftFlag(nextflag(x,y,dir,false))&&!isRaftFlag(nextflag(x,y,dir,true))) |
| 13809 | { | ||
| 13810 |
2/2✓ Branch 0 taken 739 times.
✓ Branch 1 taken 632 times.
|
1371 | if(dir<left) //going up or down |
| 13811 | { | ||
| 13812 |
3/4✓ Branch 0 taken 470 times.
✓ Branch 1 taken 269 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 470 times.
|
739 | if((isRaftFlag(nextflag(x,y,right,false))||isRaftFlag(nextflag(x,y,right,true)))) |
| 13813 | 269 | dir=right; | |
| 13814 |
3/4✓ Branch 0 taken 241 times.
✓ Branch 1 taken 229 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 241 times.
|
470 | else if((isRaftFlag(nextflag(x,y,left,false))||isRaftFlag(nextflag(x,y,left,true)))) |
| 13815 | 229 | dir=left; | |
| 13816 |
4/4✓ Branch 0 taken 226 times.
✓ Branch 1 taken 15 times.
✓ Branch 2 taken 210 times.
✓ Branch 3 taken 16 times.
|
241 | else if(y>0 && y<160) |
| 13817 | { | ||
| 13818 | 210 | action=none; FFCore.setHeroAction(none); | |
| 13819 | 210 | x = x.getInt(); | |
| 13820 | 210 | y = y.getInt(); | |
| 13821 | 210 | } | |
| 13822 | 739 | } | |
| 13823 | else //going left or right | ||
| 13824 | { | ||
| 13825 |
3/4✓ Branch 0 taken 389 times.
✓ Branch 1 taken 243 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 389 times.
|
632 | if((isRaftFlag(nextflag(x,y,down,false))||isRaftFlag(nextflag(x,y,down,true)))) |
| 13826 | 243 | dir=down; | |
| 13827 |
3/4✓ Branch 0 taken 147 times.
✓ Branch 1 taken 242 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 147 times.
|
389 | else if((isRaftFlag(nextflag(x,y,up,false))||isRaftFlag(nextflag(x,y,up,true)))) |
| 13828 | 242 | dir=up; | |
| 13829 |
4/4✓ Branch 0 taken 146 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 145 times.
|
147 | else if(x>0 && x<240) |
| 13830 | { | ||
| 13831 | 145 | action=none; FFCore.setHeroAction(none); | |
| 13832 | 145 | x = x.getInt(); | |
| 13833 | 145 | y = y.getInt(); | |
| 13834 | 145 | } | |
| 13835 | } | ||
| 13836 | 1371 | } | |
| 13837 | 7686 | } | |
| 13838 | |||
| 13839 | skip: | ||
| 13840 | |||
| 13841 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 25101 times.
✓ Branch 2 taken 24965 times.
✓ Branch 3 taken 29470 times.
✓ Branch 4 taken 33614 times.
|
113150 | switch(dir) |
| 13842 | { | ||
| 13843 | case up: | ||
| 13844 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 25092 times.
|
25101 | if(x.getInt()&15) |
| 13845 | { | ||
| 13846 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
|
9 | if(x.getInt()&8) |
| 13847 | ✗ | x++; | |
| 13848 | 9 | else x--; | |
| 13849 | 9 | } | |
| 13850 | 25092 | else y -= step_inc; | |
| 13851 | |||
| 13852 | 25101 | break; | |
| 13853 | |||
| 13854 | case down: | ||
| 13855 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24965 times.
|
24965 | if(x.getInt()&15) |
| 13856 | { | ||
| 13857 | ✗ | if(x.getInt()&8) | |
| 13858 | ✗ | x++; | |
| 13859 | ✗ | else x--; | |
| 13860 | ✗ | } | |
| 13861 | 24965 | else y += step_inc; | |
| 13862 | |||
| 13863 | 24965 | break; | |
| 13864 | |||
| 13865 | case left: | ||
| 13866 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 29464 times.
|
29470 | if(y.getInt()&15) |
| 13867 | { | ||
| 13868 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | if (get_qr(qr_BETTER_RAFT_2)) |
| 13869 | { | ||
| 13870 | ✗ | if ((y.getInt() % 16) < 4) y--; | |
| 13871 | ✗ | else y++; | |
| 13872 | ✗ | } | |
| 13873 | else | ||
| 13874 | { | ||
| 13875 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | if(y.getInt()&8) |
| 13876 | 6 | y++; | |
| 13877 | ✗ | else y--; | |
| 13878 | } | ||
| 13879 | 6 | } | |
| 13880 | 29464 | else x -= step_inc; | |
| 13881 | |||
| 13882 | 29470 | break; | |
| 13883 | |||
| 13884 | case right: | ||
| 13885 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 33614 times.
|
33614 | if(y.getInt()&15) |
| 13886 | { | ||
| 13887 | ✗ | if (get_qr(qr_BETTER_RAFT_2)) | |
| 13888 | { | ||
| 13889 | ✗ | if ((y.getInt() % 16) <= 4) y--; | |
| 13890 | ✗ | else y++; | |
| 13891 | ✗ | } | |
| 13892 | else | ||
| 13893 | { | ||
| 13894 | ✗ | if(y.getInt()&8) | |
| 13895 | ✗ | y++; | |
| 13896 | ✗ | else y--; | |
| 13897 | } | ||
| 13898 | ✗ | } | |
| 13899 | 33614 | else x += step_inc; | |
| 13900 | |||
| 13901 | 33614 | break; | |
| 13902 | } | ||
| 13903 | 113150 | } | |
| 13904 | |||
| 13905 | 252 | bool HeroClass::try_hover() | |
| 13906 | { | ||
| 13907 |
6/10✓ Branch 0 taken 252 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 250 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 2 times.
|
252 | if(hoverclk <= 0 && can_use_item(itype_hoverboots,i_hoverboots) && !ladderx && !laddery && !(hoverflags & HOV_OUT)) |
| 13908 | { | ||
| 13909 | 2 | int32_t itemid = current_item_id(itype_hoverboots); | |
| 13910 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if(hoverclk < 0) |
| 13911 | ✗ | hoverclk = -hoverclk; | |
| 13912 | else | ||
| 13913 | { | ||
| 13914 | 2 | fall = fakefall = jumping = 0; | |
| 13915 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if(itemsbuf[itemid].misc1) |
| 13916 | 2 | hoverclk = itemsbuf[itemid].misc1; | |
| 13917 | else | ||
| 13918 | { | ||
| 13919 | ✗ | hoverclk = 1; | |
| 13920 | ✗ | hoverflags |= HOV_INF; | |
| 13921 | } | ||
| 13922 | |||
| 13923 | |||
| 13924 | 2 | sfx(itemsbuf[itemid].usesound,pan(x.getInt())); | |
| 13925 | } | ||
| 13926 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if(itemsbuf[itemid].wpn) |
| 13927 |
3/6✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | decorations.add(new dHover(x, y, dHOVER, 0)); |
| 13928 | 2 | return true; | |
| 13929 | } | ||
| 13930 | 250 | return false; | |
| 13931 | 252 | } | |
| 13932 | |||
| 13933 | //Returns bitwise; lower 8 are dir pulled in, next 16 are combo ID, 25th bit is bool for if can be resisted | ||
| 13934 | //Returns '-1' if not being pulled | ||
| 13935 | //Returns '-2' if should be falling in | ||
| 13936 | 53809660 | int32_t HeroClass::check_pitslide(bool ignore_hover) | |
| 13937 | { | ||
| 13938 | //Pitfall todo -Emily | ||
| 13939 | //Iron boots; can't fight slipping, 2px/frame | ||
| 13940 | //Scripted variables to read pull dir/clk (clk only for non-hero) | ||
| 13941 | //Implement falling for all sprite types (npc AI) | ||
| 13942 | // Fall/slipping tiles for enemies | ||
| 13943 | // Fall/slipping SFX for enemies | ||
| 13944 | // Fall SFX for items/weapons | ||
| 13945 | // Weapons/Misc sprite shared for falling items/weapons | ||
| 13946 | //Maybe slip SFX for Hero? | ||
| 13947 | // Weapons/Misc sprite override for falling sprite? | ||
| 13948 | //Update std.zh with relevant new stuff | ||
| 13949 |
2/2✓ Branch 0 taken 1403264 times.
✓ Branch 1 taken 52406396 times.
|
53809660 | if(can_pitfall(ignore_hover)) |
| 13950 | { | ||
| 13951 |
2/2✓ Branch 0 taken 16358344 times.
✓ Branch 1 taken 36048052 times.
|
52406396 | bool can_diag = (diagonalMovement || get_qr(qr_DISABLE_4WAY_GRIDLOCK)); |
| 13952 | 52406396 | int32_t ispitul = getpitfall(x,y+(bigHitbox?0:8)); | |
| 13953 | 52406396 | int32_t ispitbl = getpitfall(x,y+15); | |
| 13954 | 52406396 | int32_t ispitur = getpitfall(x+15,y+(bigHitbox?0:8)); | |
| 13955 | 52406396 | int32_t ispitbr = getpitfall(x+15,y+15); | |
| 13956 | 52406396 | int32_t ispitul_50 = getpitfall(x+8,y+(bigHitbox?8:12)); | |
| 13957 | 52406396 | int32_t ispitbl_50 = getpitfall(x+8,y+(bigHitbox?7:11)); | |
| 13958 | 52406396 | int32_t ispitur_50 = getpitfall(x+7,y+(bigHitbox?8:12)); | |
| 13959 | 52406396 | int32_t ispitbr_50 = getpitfall(x+7,y+(bigHitbox?7:11)); | |
| 13960 | 52406396 | int32_t ispitul_75 = getpitfall(x+12,y+(bigHitbox?12:14)); | |
| 13961 | 52406396 | int32_t ispitbl_75 = getpitfall(x+12,y+(bigHitbox?3:9)); | |
| 13962 | 52406396 | int32_t ispitur_75 = getpitfall(x+3,y+(bigHitbox?12:14)); | |
| 13963 | 52406396 | int32_t ispitbr_75 = getpitfall(x+3,y+(bigHitbox?3:9)); | |
| 13964 | static const int32_t flag_pit_irresistable = (1<<24); | ||
| 13965 |
5/5✓ Branch 0 taken 52340475 times.
✓ Branch 1 taken 7154 times.
✓ Branch 2 taken 914 times.
✓ Branch 3 taken 34644 times.
✓ Branch 4 taken 23209 times.
|
52406396 | switch((ispitul?1:0) + (ispitur?1:0) + (ispitbl?1:0) + (ispitbr?1:0)) |
| 13966 | { | ||
| 13967 | 7154 | case 4: return -2; //Fully over pit; fall in | |
| 13968 | case 3: | ||
| 13969 | { | ||
| 13970 |
6/6✓ Branch 0 taken 446 times.
✓ Branch 1 taken 468 times.
✓ Branch 2 taken 276 times.
✓ Branch 3 taken 170 times.
✓ Branch 4 taken 254 times.
✓ Branch 5 taken 22 times.
|
914 | if(ispitul && ispitur && ispitbl) //UL_3 |
| 13971 | { | ||
| 13972 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(ispitul_50) |
| 13973 | { | ||
| 13974 |
3/6✓ Branch 0 taken 16 times.
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 16 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
22 | if(!ispitul_75 && (DrunkDown() || DrunkRight())) return -1; |
| 13975 | 6 | return (can_diag ? l_up : left) | (ispitul_75 ? flag_pit_irresistable : 0) | (ispitul << 8); | |
| 13976 | } | ||
| 13977 | ✗ | } | |
| 13978 |
5/6✓ Branch 0 taken 424 times.
✓ Branch 1 taken 468 times.
✓ Branch 2 taken 254 times.
✓ Branch 3 taken 170 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 254 times.
|
892 | else if(ispitul && ispitur && ispitbr) //UR_3 |
| 13979 | { | ||
| 13980 |
2/2✓ Branch 0 taken 39 times.
✓ Branch 1 taken 215 times.
|
254 | if(ispitur_50) |
| 13981 | { | ||
| 13982 |
5/6✓ Branch 0 taken 26 times.
✓ Branch 1 taken 13 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 16 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 10 times.
|
39 | if(!ispitur_75 && (DrunkDown() || DrunkLeft())) return -1; |
| 13983 | 23 | return (can_diag ? r_up : right) | (ispitur_75 ? flag_pit_irresistable : 0) | (ispitur << 8); | |
| 13984 | } | ||
| 13985 | 215 | } | |
| 13986 |
4/6✓ Branch 0 taken 170 times.
✓ Branch 1 taken 468 times.
✓ Branch 2 taken 170 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 170 times.
|
638 | else if(ispitul && ispitbl && ispitbr) //BL_3 |
| 13987 | { | ||
| 13988 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 156 times.
|
170 | if(ispitbl_50) |
| 13989 | { | ||
| 13990 |
4/6✓ Branch 0 taken 7 times.
✓ Branch 1 taken 7 times.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 7 times.
|
14 | if(!ispitbl_75 && (DrunkUp() || DrunkRight())) return -1; |
| 13991 | 14 | return (can_diag ? l_down : left) | (ispitbl_75 ? flag_pit_irresistable : 0) | (ispitbl << 8); | |
| 13992 | } | ||
| 13993 | 156 | } | |
| 13994 |
3/6✓ Branch 0 taken 468 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 468 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 468 times.
|
468 | else if(ispitbl && ispitur && ispitbr) //BR_3 |
| 13995 | { | ||
| 13996 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 464 times.
|
468 | if(ispitbr_50) |
| 13997 | { | ||
| 13998 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
4 | if(!ispitbr_75 && (DrunkUp() || DrunkLeft())) return -1; |
| 13999 | 4 | return (can_diag ? r_down : right) | (ispitbr_75 ? flag_pit_irresistable : 0) | (ispitbr << 8); | |
| 14000 | } | ||
| 14001 | 464 | } | |
| 14002 | 835 | break; | |
| 14003 | } | ||
| 14004 | case 2: | ||
| 14005 | { | ||
| 14006 |
4/4✓ Branch 0 taken 18174 times.
✓ Branch 1 taken 16470 times.
✓ Branch 2 taken 15743 times.
✓ Branch 3 taken 2431 times.
|
34644 | if(ispitul && ispitur) //Up |
| 14007 | { | ||
| 14008 |
2/2✓ Branch 0 taken 114 times.
✓ Branch 1 taken 2317 times.
|
2431 | if(DrunkDown()) |
| 14009 | { | ||
| 14010 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 114 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
114 | if(ispitul_75 && ispitur_75) //Straight up |
| 14011 | { | ||
| 14012 | ✗ | return up | flag_pit_irresistable | (ispitul << 8); | |
| 14013 | } | ||
| 14014 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 114 times.
|
114 | else if(ispitul_75) |
| 14015 | { | ||
| 14016 | ✗ | return (can_diag ? l_up : left) | flag_pit_irresistable | (ispitul << 8); | |
| 14017 | } | ||
| 14018 |
1/2✓ Branch 0 taken 114 times.
✗ Branch 1 not taken.
|
114 | else if(ispitur_75) |
| 14019 | { | ||
| 14020 | ✗ | return (can_diag ? r_up : right) | flag_pit_irresistable | (ispitur << 8); | |
| 14021 | } | ||
| 14022 | 114 | else return -1; | |
| 14023 | } | ||
| 14024 | else | ||
| 14025 | { | ||
| 14026 |
3/4✓ Branch 0 taken 202 times.
✓ Branch 1 taken 2115 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 202 times.
|
2317 | if(ispitul_50 && ispitur_50) //Straight up |
| 14027 | { | ||
| 14028 |
2/2✓ Branch 0 taken 70 times.
✓ Branch 1 taken 132 times.
|
202 | return up | ((ispitul_75 || ispitur_75) ? flag_pit_irresistable : 0) | (ispitul << 8); |
| 14029 | } | ||
| 14030 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2115 times.
|
2115 | else if(ispitul_50) |
| 14031 | { | ||
| 14032 | ✗ | if(DrunkRight() && !ispitul_75) return -1; | |
| 14033 | ✗ | return (can_diag ? l_up : left) | (ispitul_75 ? flag_pit_irresistable : 0) | (ispitul << 8); | |
| 14034 | } | ||
| 14035 |
1/2✓ Branch 0 taken 2115 times.
✗ Branch 1 not taken.
|
2115 | else if(ispitur_50) |
| 14036 | { | ||
| 14037 | ✗ | if(DrunkLeft() && !ispitur_75) return -1; | |
| 14038 | ✗ | return (can_diag ? r_up : right) | (ispitur_75 ? flag_pit_irresistable : 0) | (ispitur << 8); | |
| 14039 | } | ||
| 14040 | } | ||
| 14041 | 2115 | } | |
| 14042 |
4/4✓ Branch 0 taken 18616 times.
✓ Branch 1 taken 13597 times.
✓ Branch 2 taken 15727 times.
✓ Branch 3 taken 2889 times.
|
32213 | else if(ispitbl && ispitbr) //Down |
| 14043 | { | ||
| 14044 |
2/2✓ Branch 0 taken 74 times.
✓ Branch 1 taken 2815 times.
|
2889 | if(DrunkUp()) |
| 14045 | { | ||
| 14046 |
3/4✓ Branch 0 taken 4 times.
✓ Branch 1 taken 70 times.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
|
74 | if(ispitbl_75 && ispitbr_75) //Straight down |
| 14047 | { | ||
| 14048 | 4 | return down | flag_pit_irresistable | (ispitbl << 8); | |
| 14049 | } | ||
| 14050 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 70 times.
|
70 | else if(ispitbl_75) |
| 14051 | { | ||
| 14052 | ✗ | return (can_diag ? l_down : left) | flag_pit_irresistable | (ispitbl << 8); | |
| 14053 | } | ||
| 14054 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 70 times.
|
70 | else if(ispitbr_75) |
| 14055 | { | ||
| 14056 | ✗ | return (can_diag ? r_down : right) | flag_pit_irresistable | (ispitbr << 8); | |
| 14057 | } | ||
| 14058 | 70 | else return -1; | |
| 14059 | } | ||
| 14060 | else | ||
| 14061 | { | ||
| 14062 |
3/4✓ Branch 0 taken 44 times.
✓ Branch 1 taken 2771 times.
✓ Branch 2 taken 44 times.
✗ Branch 3 not taken.
|
2815 | if(ispitbl_50 && ispitbr_50) //Straight down |
| 14063 | { | ||
| 14064 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 34 times.
|
44 | return down | ((ispitbl_75 || ispitbr_75) ? flag_pit_irresistable : 0) | (ispitbl << 8); |
| 14065 | } | ||
| 14066 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2771 times.
|
2771 | else if(ispitbl_50) |
| 14067 | { | ||
| 14068 | ✗ | if(DrunkRight() && !ispitbl_75) return -1; | |
| 14069 | ✗ | return (can_diag ? l_down : left) | (ispitbl_75 ? flag_pit_irresistable : 0) | (ispitbl << 8); | |
| 14070 | } | ||
| 14071 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2771 times.
|
2771 | else if(ispitbr_50) |
| 14072 | { | ||
| 14073 | ✗ | if(DrunkLeft() && !ispitbr_75) return -1; | |
| 14074 | ✗ | return (can_diag ? r_down : right) | (ispitbr_75 ? flag_pit_irresistable : 0) | (ispitbr << 8); | |
| 14075 | } | ||
| 14076 | } | ||
| 14077 | 2771 | } | |
| 14078 |
3/4✓ Branch 0 taken 15727 times.
✓ Branch 1 taken 13597 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 15727 times.
|
29324 | else if(ispitbl && ispitul) //Left |
| 14079 | { | ||
| 14080 |
2/2✓ Branch 0 taken 818 times.
✓ Branch 1 taken 14909 times.
|
15727 | if(DrunkRight()) |
| 14081 | { | ||
| 14082 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 818 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
818 | if(ispitul_75 && ispitbl_75) //Straight left |
| 14083 | { | ||
| 14084 | ✗ | return left | flag_pit_irresistable | (ispitul << 8); | |
| 14085 | } | ||
| 14086 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 818 times.
|
818 | else if(ispitul_75) |
| 14087 | { | ||
| 14088 | ✗ | return (can_diag ? l_up : up) | flag_pit_irresistable | (ispitul << 8); | |
| 14089 | } | ||
| 14090 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 818 times.
|
818 | else if(ispitbl_75) |
| 14091 | { | ||
| 14092 | ✗ | return (can_diag ? l_down : down) | flag_pit_irresistable | (ispitbl << 8); | |
| 14093 | } | ||
| 14094 | 818 | else return -1; | |
| 14095 | } | ||
| 14096 | else | ||
| 14097 | { | ||
| 14098 |
3/4✓ Branch 0 taken 420 times.
✓ Branch 1 taken 14489 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 420 times.
|
14909 | if(ispitul_50 && ispitbl_50) //Straight left |
| 14099 | { | ||
| 14100 |
2/2✓ Branch 0 taken 105 times.
✓ Branch 1 taken 315 times.
|
420 | return left | ((ispitul_75 || ispitbl_75) ? flag_pit_irresistable : 0) | (ispitul << 8); |
| 14101 | } | ||
| 14102 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14489 times.
|
14489 | else if(ispitul_50) |
| 14103 | { | ||
| 14104 | ✗ | if(DrunkDown() && !ispitul_75) return -1; | |
| 14105 | ✗ | return (can_diag ? l_up : up) | (ispitul_75 ? flag_pit_irresistable : 0) | (ispitul << 8); | |
| 14106 | } | ||
| 14107 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14489 times.
|
14489 | else if(ispitbl_50) |
| 14108 | { | ||
| 14109 | ✗ | if(DrunkUp() && !ispitbl_75) return -1; | |
| 14110 | ✗ | return (can_diag ? l_down : down) | (ispitbl_75 ? flag_pit_irresistable : 0) | (ispitbl << 8); | |
| 14111 | } | ||
| 14112 | } | ||
| 14113 | 14489 | } | |
| 14114 |
3/4✓ Branch 0 taken 13597 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
✓ Branch 3 taken 13581 times.
|
13597 | else if(ispitbr && ispitur) //Right |
| 14115 | { | ||
| 14116 |
2/2✓ Branch 0 taken 763 times.
✓ Branch 1 taken 12818 times.
|
13581 | if(DrunkLeft()) |
| 14117 | { | ||
| 14118 |
3/4✓ Branch 0 taken 19 times.
✓ Branch 1 taken 744 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 19 times.
|
763 | if(ispitur_75 && ispitbr_75) //Straight right |
| 14119 | { | ||
| 14120 | 19 | return right | flag_pit_irresistable | (ispitur << 8); | |
| 14121 | } | ||
| 14122 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 744 times.
|
744 | else if(ispitur_75) |
| 14123 | { | ||
| 14124 | ✗ | return (can_diag ? r_up : up) | flag_pit_irresistable | (ispitur << 8); | |
| 14125 | } | ||
| 14126 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 744 times.
|
744 | else if(ispitbr_75) |
| 14127 | { | ||
| 14128 | ✗ | return (can_diag ? r_down : down) | flag_pit_irresistable | (ispitbr << 8); | |
| 14129 | } | ||
| 14130 | 744 | else return -1; | |
| 14131 | } | ||
| 14132 | else | ||
| 14133 | { | ||
| 14134 |
3/4✓ Branch 0 taken 450 times.
✓ Branch 1 taken 12368 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 450 times.
|
12818 | if(ispitur_50 && ispitbr_50) //Straight right |
| 14135 | { | ||
| 14136 |
2/2✓ Branch 0 taken 292 times.
✓ Branch 1 taken 158 times.
|
450 | return right | ((ispitur_75 || ispitbr_75) ? flag_pit_irresistable : 0) | (ispitur << 8); |
| 14137 | } | ||
| 14138 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12368 times.
|
12368 | else if(ispitur_50) |
| 14139 | { | ||
| 14140 | ✗ | if(DrunkDown() && !ispitur_75) return -1; | |
| 14141 | ✗ | return (can_diag ? r_up : up) | (ispitur_75 ? flag_pit_irresistable : 0) | (ispitur << 8); | |
| 14142 | } | ||
| 14143 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12368 times.
|
12368 | else if(ispitbr_50) |
| 14144 | { | ||
| 14145 | ✗ | if(DrunkUp() && !ispitbr_75) return -1; | |
| 14146 | ✗ | return (can_diag ? r_down : down) | (ispitbr_75 ? flag_pit_irresistable : 0) | (ispitbr << 8); | |
| 14147 | } | ||
| 14148 | } | ||
| 14149 | 12368 | } | |
| 14150 | 31759 | break; | |
| 14151 | } | ||
| 14152 | case 1: | ||
| 14153 | { | ||
| 14154 |
4/4✓ Branch 0 taken 7254 times.
✓ Branch 1 taken 15955 times.
✓ Branch 2 taken 7249 times.
✓ Branch 3 taken 5 times.
|
23209 | if(ispitul && ispitul_50) //UL_1 |
| 14155 | { | ||
| 14156 |
3/6✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
|
5 | if(!ispitul_75 && (DrunkDown() || DrunkRight())) return -1; |
| 14157 | 5 | return (can_diag ? l_up : left) | (ispitul_75 ? flag_pit_irresistable : 0) | (ispitul << 8); | |
| 14158 | } | ||
| 14159 |
4/4✓ Branch 0 taken 5438 times.
✓ Branch 1 taken 17766 times.
✓ Branch 2 taken 5370 times.
✓ Branch 3 taken 68 times.
|
23204 | if(ispitur && ispitur_50) //UR_1 |
| 14160 | { | ||
| 14161 |
5/6✓ Branch 0 taken 68 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 52 times.
✓ Branch 3 taken 16 times.
✓ Branch 4 taken 38 times.
✓ Branch 5 taken 14 times.
|
68 | if(!ispitur_75 && (DrunkDown() || DrunkLeft())) return -1; |
| 14162 | 14 | return (can_diag ? r_up : right) | (ispitur_75 ? flag_pit_irresistable : 0) | (ispitur << 8); | |
| 14163 | } | ||
| 14164 |
4/4✓ Branch 0 taken 4139 times.
✓ Branch 1 taken 18997 times.
✓ Branch 2 taken 4136 times.
✓ Branch 3 taken 3 times.
|
23136 | if(ispitbl && ispitbl_50) //BL_1 |
| 14165 | { | ||
| 14166 |
3/6✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
|
3 | if(!ispitbl_75 && (DrunkUp() || DrunkRight())) return -1; |
| 14167 | ✗ | return (can_diag ? l_down : left) | (ispitbl_75 ? flag_pit_irresistable : 0) | (ispitbl << 8); | |
| 14168 | } | ||
| 14169 |
4/4✓ Branch 0 taken 6378 times.
✓ Branch 1 taken 16755 times.
✓ Branch 2 taken 6324 times.
✓ Branch 3 taken 54 times.
|
23133 | if(ispitbr && ispitbr_50) //BR_1 |
| 14170 | { | ||
| 14171 |
5/6✓ Branch 0 taken 54 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29 times.
✓ Branch 3 taken 25 times.
✓ Branch 4 taken 24 times.
✓ Branch 5 taken 5 times.
|
54 | if(!ispitbr_75 && (DrunkUp() || DrunkLeft())) return -1; |
| 14172 | 5 | return (can_diag ? r_down : right) | (ispitbr_75 ? flag_pit_irresistable : 0) | (ispitbr << 8); | |
| 14173 | } | ||
| 14174 | 23079 | break; | |
| 14175 | } | ||
| 14176 | } | ||
| 14177 | 52396148 | } | |
| 14178 | 53799412 | return -1; | |
| 14179 | 53809660 | } | |
| 14180 | |||
| 14181 | 11831963 | bool HeroClass::pitslide() //Runs pitslide movement; returns true if pit is irresistable | |
| 14182 | { | ||
| 14183 | 11831963 | pitfall(); | |
| 14184 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 11831947 times.
|
11831963 | if(fallclk) return true; |
| 14185 | 11831947 | int32_t val = check_pitslide(); | |
| 14186 | //Val should not be -2 here; if -2 would have been returned, the 'return true' above should have triggered! | ||
| 14187 |
2/2✓ Branch 0 taken 202 times.
✓ Branch 1 taken 11831745 times.
|
11831947 | if(val == -1) |
| 14188 | { | ||
| 14189 | 11831745 | pit_pulldir = -1; | |
| 14190 | 11831745 | pit_pullclk = 0; | |
| 14191 | 11831745 | return false; | |
| 14192 | } | ||
| 14193 | 202 | int32_t dir = val&0xFF; | |
| 14194 | 202 | int32_t cmbid = (val&0xFFFF00)>>8; | |
| 14195 | 202 | int32_t sensitivity = combobuf[cmbid].attribytes[2]; | |
| 14196 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 202 times.
|
202 | if(combobuf[cmbid].usrflags&cflag5) //No pull at all |
| 14197 | { | ||
| 14198 | ✗ | pit_pulldir = -1; | |
| 14199 | ✗ | pit_pullclk = 0; | |
| 14200 | ✗ | return false; | |
| 14201 | } | ||
| 14202 |
4/6✓ Branch 0 taken 202 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 200 times.
✓ Branch 5 taken 2 times.
|
202 | if(dir > -1 && !(hoverflags & HOV_PITFALL_OUT) && try_hover()) //Engage hovers |
| 14203 | { | ||
| 14204 | 2 | pit_pulldir = -1; | |
| 14205 | 2 | pit_pullclk = 0; | |
| 14206 | 2 | return false; | |
| 14207 | } | ||
| 14208 | 200 | pit_pulldir = dir; | |
| 14209 | 200 | int32_t step = 1; | |
| 14210 |
2/2✓ Branch 0 taken 190 times.
✓ Branch 1 taken 10 times.
|
200 | if(sensitivity == 0) |
| 14211 | { | ||
| 14212 | 10 | step = 2; | |
| 14213 | 10 | sensitivity = 1; | |
| 14214 | 10 | } | |
| 14215 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 152 times.
|
200 | if(pit_pullclk++ % sensitivity) //No pull this frame |
| 14216 | 48 | return (val&0x100); | |
| 14217 |
4/4✓ Branch 0 taken 150 times.
✓ Branch 1 taken 162 times.
✓ Branch 2 taken 160 times.
✓ Branch 3 taken 152 times.
|
312 | for(; step > 0 && !fallclk; --step) |
| 14218 | { | ||
| 14219 |
3/3✓ Branch 0 taken 52 times.
✓ Branch 1 taken 68 times.
✓ Branch 2 taken 40 times.
|
160 | switch(dir) |
| 14220 | { | ||
| 14221 | case l_up: case l_down: case left: | ||
| 14222 | 52 | --x; break; | |
| 14223 | case r_up: case r_down: case right: | ||
| 14224 | 68 | ++x; break; | |
| 14225 | } | ||
| 14226 |
3/3✓ Branch 0 taken 37 times.
✓ Branch 1 taken 11 times.
✓ Branch 2 taken 112 times.
|
160 | switch(dir) |
| 14227 | { | ||
| 14228 | case l_up: case r_up: case up: | ||
| 14229 | 37 | --y; break; | |
| 14230 | case l_down: case r_down: case down: | ||
| 14231 | 11 | ++y; break; | |
| 14232 | } | ||
| 14233 | 160 | pitfall(); | |
| 14234 | 160 | } | |
| 14235 |
2/2✓ Branch 0 taken 118 times.
✓ Branch 1 taken 34 times.
|
152 | return fallclk || (val&0x100); |
| 14236 | 11831963 | } | |
| 14237 | |||
| 14238 | 11835623 | void HeroClass::pitfall() | |
| 14239 | { | ||
| 14240 |
2/2✓ Branch 0 taken 3500 times.
✓ Branch 1 taken 11832123 times.
|
11835623 | if(fallclk) |
| 14241 | { | ||
| 14242 | 3500 | drop_liftwpn(); | |
| 14243 |
3/4✓ Branch 0 taken 50 times.
✓ Branch 1 taken 3450 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 50 times.
|
3500 | if(fallclk == PITFALL_FALL_FRAMES && fallCombo) sfx(combobuf[fallCombo].attribytes[0], pan(x.getInt())); |
| 14244 | //Handle falling | ||
| 14245 |
2/2✓ Branch 0 taken 3450 times.
✓ Branch 1 taken 50 times.
|
3500 | if(!--fallclk) |
| 14246 | { | ||
| 14247 | 50 | std::vector<int32_t> &ev = FFCore.eventData; | |
| 14248 | 50 | ev.clear(); | |
| 14249 | 50 | ev.push_back(fallCombo*10000); | |
| 14250 | |||
| 14251 | 50 | throwGenScriptEvent(GENSCR_EVENT_PLAYER_FALL); | |
| 14252 | |||
| 14253 | 50 | fallCombo = ev[0]/10000; | |
| 14254 |
2/4✓ Branch 0 taken 50 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 50 times.
|
50 | if(fallCombo < 0 || fallCombo >= MAXCOMBOS) |
| 14255 | ✗ | fallCombo = 0; | |
| 14256 | |||
| 14257 | 50 | int32_t dmg = game->get_hp_per_heart()/4; | |
| 14258 | 50 | bool dmg_perc = false; | |
| 14259 | 50 | bool warp = false; | |
| 14260 | |||
| 14261 | 50 | action=none; FFCore.setHeroAction(none); | |
| 14262 |
1/2✓ Branch 0 taken 50 times.
✗ Branch 1 not taken.
|
50 | newcombo* cmb = fallCombo ? &combobuf[fallCombo] : NULL; |
| 14263 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 50 times.
|
50 | if(cmb) |
| 14264 | { | ||
| 14265 | 50 | dmg = cmb->attributes[0]/10000L; | |
| 14266 | 50 | dmg_perc = cmb->usrflags&cflag3; | |
| 14267 | 50 | warp = cmb->usrflags&cflag1; | |
| 14268 | 50 | } | |
| 14269 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 50 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
50 | if(cheat_superman && dmg > 0) |
| 14270 | ✗ | dmg = 0; | |
| 14271 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 38 times.
|
50 | if(dmg) //Damage |
| 14272 | { | ||
| 14273 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 38 times.
|
38 | if(dmg > 0) hclk=48; //IFrames only if damaged, not if healed |
| 14274 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 38 times.
|
38 | game->set_life(vbound(int32_t(dmg_perc ? game->get_life() - ((vbound(dmg,-100,100)/100.0)*game->get_maxlife()) : (game->get_life()-int64_t(dmg))),0,game->get_maxlife())); |
| 14275 | 38 | } | |
| 14276 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 47 times.
|
50 | if(warp) //Warp |
| 14277 | { | ||
| 14278 | 3 | sdir = dir; | |
| 14279 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | if(cmb->usrflags&cflag2) //Direct Warp |
| 14280 | { | ||
| 14281 | 3 | didpit=true; | |
| 14282 | 3 | pitx=x; | |
| 14283 | 3 | pity=y; | |
| 14284 | 3 | } | |
| 14285 | 3 | dowarp(0,vbound(cmb->attribytes[1],0,3),0); | |
| 14286 | 3 | } | |
| 14287 | else //Reset to screen entry | ||
| 14288 | { | ||
| 14289 | 47 | go_respawn_point(); | |
| 14290 | } | ||
| 14291 | 50 | } | |
| 14292 | 3500 | } | |
| 14293 |
2/2✓ Branch 0 taken 376806 times.
✓ Branch 1 taken 11455317 times.
|
11832123 | else if(can_pitfall()) |
| 14294 | { | ||
| 14295 | 11455317 | bool ispitul = ispitfall(x,y+(bigHitbox?0:8)); | |
| 14296 | 11455317 | bool ispitbl = ispitfall(x,y+15); | |
| 14297 | 11455317 | bool ispitur = ispitfall(x+15,y+(bigHitbox?0:8)); | |
| 14298 | 11455317 | bool ispitbr = ispitfall(x+15,y+15); | |
| 14299 | 11455317 | int32_t pitctr = getpitfall(x+8,y+(bigHitbox?8:12)); | |
| 14300 |
9/10✓ Branch 0 taken 4567 times.
✓ Branch 1 taken 11450750 times.
✓ Branch 2 taken 2842 times.
✓ Branch 3 taken 1725 times.
✓ Branch 4 taken 53 times.
✓ Branch 5 taken 2789 times.
✓ Branch 6 taken 50 times.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 50 times.
|
11455317 | if(ispitul && ispitbl && ispitur && ispitbr && pitctr) |
| 14301 | { | ||
| 14302 |
2/4✓ Branch 0 taken 50 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 50 times.
✗ Branch 3 not taken.
|
50 | if(!(hoverflags & HOV_PITFALL_OUT) && try_hover()) return; |
| 14303 |
3/4✓ Branch 0 taken 50 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 40 times.
|
50 | if(!bigHitbox && !ispitfall(x,y)) y = (y.getInt() + 8 - (y.getInt() % 8)); //Make the falling sprite fully over the pit |
| 14304 | 50 | fallclk = PITFALL_FALL_FRAMES; | |
| 14305 | 50 | fallCombo = pitctr; | |
| 14306 | 50 | action=falling; FFCore.setHeroAction(falling); | |
| 14307 | 50 | spins = 0; | |
| 14308 | 50 | charging = 0; | |
| 14309 | 50 | drop_liftwpn(); | |
| 14310 | 50 | } | |
| 14311 | 11455317 | } | |
| 14312 | 11835623 | } | |
| 14313 | |||
| 14314 | ✗ | void HeroClass::handle_slide(newcombo const& icecmb, zfix& dx, zfix& dy) | |
| 14315 | { | ||
| 14316 | ✗ | bool is_inair = z || fakez; | |
| 14317 | ✗ | zfix odx = dx, ody = dy; | |
| 14318 | ✗ | if(sliding == 2 && !is_inair) //landed from air-sliding | |
| 14319 | { | ||
| 14320 | ✗ | if((ice_vx+odx).sign() != ice_vx.sign()) | |
| 14321 | ✗ | ice_vx = 0; | |
| 14322 | ✗ | if((ice_vy+ody).sign() != ice_vy.sign()) | |
| 14323 | ✗ | ice_vy = 0; | |
| 14324 | ✗ | sliding = 1; | |
| 14325 | ✗ | } | |
| 14326 | ✗ | if(!sliding) //just hit the ice | |
| 14327 | { | ||
| 14328 | ✗ | if(is_inair) | |
| 14329 | ✗ | return; | |
| 14330 | ✗ | sliding = 1; | |
| 14331 | ✗ | zfix start_perc = icecmb.attribytes[0] / 100_zf; | |
| 14332 | ✗ | ice_vx = dx * start_perc; | |
| 14333 | ✗ | ice_vy = dy * start_perc; | |
| 14334 | ✗ | ice_entry_count = ice_entry_mcount = icecmb.attribytes[1]; | |
| 14335 | ✗ | } | |
| 14336 | else //not the first frame sliding | ||
| 14337 | { | ||
| 14338 | ✗ | if(is_inair) | |
| 14339 | ✗ | sliding = 2; | |
| 14340 | ✗ | zfix accel = zslongToFix(zc_max(1,icecmb.attributes[0])); | |
| 14341 | ✗ | zfix decel = zslongToFix(zc_max(1,icecmb.attributes[1])); | |
| 14342 | |||
| 14343 | ✗ | if(ice_entry_count) | |
| 14344 | { | ||
| 14345 | ✗ | if(--ice_entry_count) | |
| 14346 | { | ||
| 14347 | ✗ | zfix perc = zfix(ice_entry_count)/ice_entry_mcount; | |
| 14348 | ✗ | perc *= perc; //square the portion, for a better transition | |
| 14349 | ✗ | zfix normal_rate = zfix(steprate)/100/2; | |
| 14350 | ✗ | decel = (perc*normal_rate)+((1-perc)*decel); | |
| 14351 | ✗ | } | |
| 14352 | ✗ | } | |
| 14353 | //!TODO Traction Boots can be added here, with a multiplier on accel/decel | ||
| 14354 | //Accelerate in the pushed direction | ||
| 14355 | ✗ | if(is_inair) | |
| 14356 | { | ||
| 14357 | static const int air_accel = 100; | ||
| 14358 | ✗ | accel = abs(odx)/air_accel; | |
| 14359 | ✗ | if(accel) | |
| 14360 | { | ||
| 14361 | ✗ | if(odx < 0) | |
| 14362 | { | ||
| 14363 | ✗ | if(ice_vx - accel < odx) | |
| 14364 | { | ||
| 14365 | ✗ | if(ice_vx > odx) | |
| 14366 | ✗ | ice_vx = odx; | |
| 14367 | ✗ | else odx = 0; //allow decel | |
| 14368 | ✗ | } | |
| 14369 | ✗ | else ice_vx -= accel; | |
| 14370 | ✗ | } | |
| 14371 | else //if(odx > 0) | ||
| 14372 | { | ||
| 14373 | ✗ | if(ice_vx + accel > odx) | |
| 14374 | { | ||
| 14375 | ✗ | if(ice_vx < odx) | |
| 14376 | ✗ | ice_vx = odx; | |
| 14377 | ✗ | else odx = 0; //allow decel | |
| 14378 | ✗ | } | |
| 14379 | ✗ | else ice_vx += accel; | |
| 14380 | } | ||
| 14381 | ✗ | } | |
| 14382 | ✗ | accel = abs(ody)/air_accel; | |
| 14383 | ✗ | if(accel) | |
| 14384 | { | ||
| 14385 | ✗ | if(ody < 0) | |
| 14386 | { | ||
| 14387 | ✗ | if(ice_vy - accel < ody) | |
| 14388 | { | ||
| 14389 | ✗ | if(ice_vy > ody) | |
| 14390 | ✗ | ice_vy = ody; | |
| 14391 | ✗ | else ody = 0; //allow decel | |
| 14392 | ✗ | } | |
| 14393 | ✗ | else ice_vy -= accel; | |
| 14394 | ✗ | } | |
| 14395 | else //if(ody > 0) | ||
| 14396 | { | ||
| 14397 | ✗ | if(ice_vy + accel > ody) | |
| 14398 | { | ||
| 14399 | ✗ | if(ice_vy < ody) | |
| 14400 | ✗ | ice_vy = ody; | |
| 14401 | ✗ | else ody = 0; //allow decel | |
| 14402 | ✗ | } | |
| 14403 | ✗ | else ice_vy += accel; | |
| 14404 | } | ||
| 14405 | ✗ | } | |
| 14406 | ✗ | } | |
| 14407 | ✗ | else if(accel) | |
| 14408 | { | ||
| 14409 | ✗ | if(odx > 0) | |
| 14410 | ✗ | ice_vx += accel; | |
| 14411 | ✗ | else if(odx < 0) | |
| 14412 | ✗ | ice_vx -= accel; | |
| 14413 | ✗ | if(ody > 0) | |
| 14414 | ✗ | ice_vy += accel; | |
| 14415 | ✗ | else if(ody < 0) | |
| 14416 | ✗ | ice_vy -= accel; | |
| 14417 | ✗ | } | |
| 14418 | //Decelerate in non-pushed direction | ||
| 14419 | ✗ | if(is_inair) | |
| 14420 | ✗ | decel = zinit.air_drag; | |
| 14421 | ✗ | if(decel) | |
| 14422 | { | ||
| 14423 | ✗ | if(ice_vx) | |
| 14424 | { | ||
| 14425 | ✗ | if(!odx && abs(ice_vx) < decel) | |
| 14426 | ✗ | ice_vx = 0; | |
| 14427 | ✗ | else if(ice_vx > 0 && odx <= 0) | |
| 14428 | ✗ | ice_vx -= decel; | |
| 14429 | ✗ | else if(ice_vx < 0 && odx >= 0) | |
| 14430 | ✗ | ice_vx += decel; | |
| 14431 | ✗ | } | |
| 14432 | ✗ | if(ice_vy) | |
| 14433 | { | ||
| 14434 | ✗ | if(!ody && abs(ice_vy) < decel) | |
| 14435 | ✗ | ice_vy = 0; | |
| 14436 | ✗ | else if(ice_vy > 0 && ody <= 0) | |
| 14437 | ✗ | ice_vy -= decel; | |
| 14438 | ✗ | else if(ice_vy < 0 && ody >= 0) | |
| 14439 | ✗ | ice_vy += decel; | |
| 14440 | ✗ | } | |
| 14441 | ✗ | } | |
| 14442 | } | ||
| 14443 | ✗ | zfix cap = zslongToFix(zc_max(1,abs(icecmb.attributes[2]))); | |
| 14444 | ✗ | dx = ice_vx = vbound(ice_vx, -cap, cap); | |
| 14445 | ✗ | dy = ice_vy = vbound(ice_vy, -cap, cap); | |
| 14446 | ✗ | if(!dx && !dy) | |
| 14447 | ✗ | ice_entry_count = 0; | |
| 14448 | ✗ | } | |
| 14449 | 250467 | void HeroClass::mod_steps(std::vector<zfix*>& v) | |
| 14450 | { | ||
| 14451 |
2/4✓ Branch 0 taken 250467 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 250467 times.
✗ Branch 3 not taken.
|
250467 | bool can_combo = ((z==0 && fakez==0) || tmpscr->flags2&fAIRCOMBOS); |
| 14452 |
4/6✓ Branch 0 taken 21068 times.
✓ Branch 1 taken 229399 times.
✓ Branch 2 taken 21068 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 21068 times.
✗ Branch 5 not taken.
|
479866 | bool slowcombo = (combo_class_buf[combobuf[MAPCOMBO(x+7,y+8)].type].slow_movement && _effectflag(x+7,y+8,1,-1) && can_combo) || |
| 14453 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 229399 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
229399 | (isSideViewHero() && (on_sideview_solid_oldpos(this)||getOnSideviewLadder()) && combo_class_buf[combobuf[MAPCOMBO(x+7,y+8)].type].slow_movement && _effectflag(x+7,y+8,1,-1)); |
| 14454 | //!DIMITODO: add QR for slow combos under hero | ||
| 14455 |
4/4✓ Branch 0 taken 229399 times.
✓ Branch 1 taken 21068 times.
✓ Branch 2 taken 21068 times.
✓ Branch 3 taken 42136 times.
|
292603 | if(slowcombo) for (int32_t i = 0; i <= 1; ++i) |
| 14456 | { | ||
| 14457 |
2/2✓ Branch 0 taken 956 times.
✓ Branch 1 taken 41180 times.
|
42136 | if(tmpscr2[i].valid!=0) |
| 14458 | { | ||
| 14459 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 41180 times.
|
41180 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 14460 | { | ||
| 14461 | ✗ | if (combobuf[MAPCOMBO2(i,x+7,y+8)].type == cBRIDGE && !_walkflag_layer(x+7,y+8,1, &(tmpscr2[i]))) | |
| 14462 | { | ||
| 14463 | ✗ | slowcombo = false; | |
| 14464 | ✗ | break; | |
| 14465 | } | ||
| 14466 | ✗ | } | |
| 14467 | else | ||
| 14468 | { | ||
| 14469 |
2/4✓ Branch 0 taken 41180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 41180 times.
✗ Branch 3 not taken.
|
41180 | if (combobuf[MAPCOMBO2(i,x+7,y+8)].type == cBRIDGE && _effectflag_layer(x+7,y+8,1, &(tmpscr2[i]))) |
| 14470 | { | ||
| 14471 | ✗ | slowcombo = false; | |
| 14472 | ✗ | break; | |
| 14473 | } | ||
| 14474 | } | ||
| 14475 | 41180 | } | |
| 14476 | 63204 | } | |
| 14477 |
1/2✓ Branch 0 taken 250467 times.
✗ Branch 1 not taken.
|
250467 | bool slowcharging = charging>0 && (itemsbuf[getWpnPressed(itype_sword)].flags & item_flag10); |
| 14478 | 250467 | bool is_swimming = (action == swimming); | |
| 14479 | 250467 | int32_t shieldid = getCurrentActiveShield(); | |
| 14480 |
1/2✓ Branch 0 taken 250467 times.
✗ Branch 1 not taken.
|
250467 | if(shieldid > -1) |
| 14481 | { | ||
| 14482 | ✗ | itemdata const& shield = itemsbuf[shieldid]; | |
| 14483 | ✗ | if(shield.flags & item_flag10) //Change Speed flag | |
| 14484 | { | ||
| 14485 | ✗ | zfix perc = shield.misc7; | |
| 14486 | ✗ | perc /= 100; | |
| 14487 | ✗ | if(perc < 0) | |
| 14488 | ✗ | perc = (perc*-1)+1; | |
| 14489 | ✗ | zfix add(shield.misc8); | |
| 14490 | ✗ | add /= 100; | |
| 14491 | ✗ | for(zfix* stp : v) | |
| 14492 | { | ||
| 14493 | ✗ | zfix& pix = *stp; | |
| 14494 | ✗ | pix = (pix * perc) + add; | |
| 14495 | } | ||
| 14496 | ✗ | } | |
| 14497 | ✗ | } | |
| 14498 | |||
| 14499 | 250467 | auto slow_cpos = COMBOPOS(x+7,y+8); | |
| 14500 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 250467 times.
✓ Branch 2 taken 250256 times.
✓ Branch 3 taken 1753058 times.
|
2003314 | if(can_combo) for(int q = 6; q >= 0; --q) |
| 14501 | { | ||
| 14502 | 1753058 | mapscr* m = FFCore.tempScreens[q]; | |
| 14503 |
2/2✓ Branch 0 taken 851124 times.
✓ Branch 1 taken 901934 times.
|
1753058 | if(!m->valid) continue; |
| 14504 | 851124 | newcombo const& cmb = combobuf[m->data[slow_cpos]]; | |
| 14505 | |||
| 14506 |
2/6✓ Branch 0 taken 851124 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 851124 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
851124 | if (cmb.speed_mult != 1 || cmb.speed_div || cmb.speed_add) |
| 14507 | { | ||
| 14508 |
2/2✓ Branch 0 taken 4255620 times.
✓ Branch 1 taken 851124 times.
|
5106744 | for(zfix* stp : v) |
| 14509 | { | ||
| 14510 | 4255620 | zfix& pix = *stp; | |
| 14511 | 4255620 | pix *= cmb.speed_mult; | |
| 14512 |
1/2✓ Branch 0 taken 4255620 times.
✗ Branch 1 not taken.
|
4255620 | if(cmb.speed_div) |
| 14513 | 4255620 | pix /= cmb.speed_div; | |
| 14514 | 4255620 | pix += cmb.speed_add; | |
| 14515 | } | ||
| 14516 | 851124 | } | |
| 14517 |
4/4✓ Branch 0 taken 600868 times.
✓ Branch 1 taken 250256 times.
✓ Branch 2 taken 600657 times.
✓ Branch 3 taken 211 times.
|
851124 | if(q > 0 && cmb.type == cBRIDGE) |
| 14518 | { | ||
| 14519 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 211 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 211 times.
|
211 | if(get_qr(qr_OLD_BRIDGE_COMBOS) |
| 14520 | ✗ | ? !_walkflag_layer(x+7,y+8,1,&(tmpscr2[q-1])) | |
| 14521 | 211 | : _effectflag_layer(x+7,y+8,1,&(tmpscr2[q-1]))) | |
| 14522 | { | ||
| 14523 | 211 | break; //Bridge blocks speed change from below it | |
| 14524 | } | ||
| 14525 | ✗ | } | |
| 14526 | 1101380 | } | |
| 14527 | 250467 | zfix mult = 1, div = 1; | |
| 14528 |
2/2✓ Branch 0 taken 6290 times.
✓ Branch 1 taken 244177 times.
|
250467 | if(is_swimming) |
| 14529 | { | ||
| 14530 | 6290 | mult = game->swim_mult; | |
| 14531 | 6290 | div = game->swim_div; | |
| 14532 | 6290 | } | |
| 14533 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 244177 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
244177 | else if(slowcharging && slowcombo) //1/2 speed |
| 14534 | { | ||
| 14535 | ✗ | div = 2; | |
| 14536 | ✗ | } | |
| 14537 |
3/4✓ Branch 0 taken 244177 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 21068 times.
✓ Branch 3 taken 223109 times.
|
244177 | else if(slowcharging || slowcombo) //2/3 speed |
| 14538 | { | ||
| 14539 | 21068 | mult = 2; | |
| 14540 | 21068 | div = 3; | |
| 14541 | 21068 | } | |
| 14542 |
1/2✓ Branch 0 taken 250467 times.
✗ Branch 1 not taken.
|
250467 | if(!div) div = 1; |
| 14543 |
3/4✓ Branch 0 taken 223109 times.
✓ Branch 1 taken 27358 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 223109 times.
|
250467 | if(mult != 1 || div != 1) |
| 14544 | { | ||
| 14545 |
2/2✓ Branch 0 taken 136790 times.
✓ Branch 1 taken 27358 times.
|
164148 | for(zfix* stp : v) |
| 14546 | { | ||
| 14547 | 136790 | zfix& pix = *stp; | |
| 14548 | 136790 | pix = ((pix / div) * mult); | |
| 14549 | } | ||
| 14550 | 27358 | } | |
| 14551 | 250467 | } | |
| 14552 | |||
| 14553 | 13163283 | void HeroClass::moveheroOld() | |
| 14554 | { | ||
| 14555 |
4/4✓ Branch 0 taken 13153094 times.
✓ Branch 1 taken 10189 times.
✓ Branch 2 taken 9934 times.
✓ Branch 3 taken 13162068 times.
|
13163283 | if(lstunclock || is_conveyor_stunned) return; |
| 14556 | 13162068 | int32_t xoff=x.getInt()&7; | |
| 14557 | 13162068 | int32_t yoff=y.getInt()&7; | |
| 14558 |
4/4✓ Branch 0 taken 13018496 times.
✓ Branch 1 taken 143572 times.
✓ Branch 2 taken 20920 times.
✓ Branch 3 taken 13039416 times.
|
13162068 | if(NO_GRIDLOCK) |
| 14559 | { | ||
| 14560 | 164492 | xoff = 0; | |
| 14561 | 164492 | yoff = 0; | |
| 14562 | 164492 | } | |
| 14563 | 13174014 | int32_t push=pushing; | |
| 14564 | 13174014 | int32_t oldladderx=-1000, oldladdery=-1000; // moved here because linux complains "init crosses goto ~Koopa | |
| 14565 | 13174014 | pushing=0; | |
| 14566 | 13174014 | zfix temp_step(hero_newstep); | |
| 14567 | 13174014 | zfix temp_x(x); | |
| 14568 | 13174014 | zfix temp_y(y); | |
| 14569 | |||
| 14570 | 13174014 | int32_t flippers_id = current_item_id(itype_flippers); | |
| 14571 | 13174014 | itemdata const& itm = itemsbuf[flippers_id]; | |
| 14572 | 13174014 | byte intbtn = byte(itm.misc3&0xFF); | |
| 14573 | 13174014 | bool dive_pressed = getIntBtnInput(intbtn, true, true, false, false, true); | |
| 14574 | 13174014 | bool eatdive = false; | |
| 14575 |
2/2✓ Branch 0 taken 35254 times.
✓ Branch 1 taken 13138760 times.
|
13174014 | if(diveclk>0) |
| 14576 | { | ||
| 14577 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 35254 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
35254 | if (isSideViewHero() && get_qr(qr_SIDESWIM)) diveclk = 0; |
| 14578 | 35254 | --diveclk; | |
| 14579 |
4/8✓ Branch 0 taken 9502 times.
✓ Branch 1 taken 25752 times.
✓ Branch 2 taken 9502 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 9502 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
35254 | if(isDiving() && flippers_id > -1 && itemsbuf[flippers_id].flags & item_flag2 && dive_pressed) //Cancellable Diving -V |
| 14580 | { | ||
| 14581 | ✗ | diveclk = itemsbuf[flippers_id].misc2; | |
| 14582 | ✗ | eatdive = true; | |
| 14583 | ✗ | } | |
| 14584 | 35254 | } | |
| 14585 |
4/4✓ Branch 0 taken 113504 times.
✓ Branch 1 taken 13025256 times.
✓ Branch 2 taken 113277 times.
✓ Branch 3 taken 227 times.
|
13138760 | else if(action == swimming && dive_pressed) |
| 14586 | { | ||
| 14587 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 227 times.
|
227 | bool global_diving=(flippers_id > -1 && itemsbuf[flippers_id].flags & item_flag1); |
| 14588 | 227 | bool screen_diving=(tmpscr->flags5&fTOGGLEDIVING) != 0; | |
| 14589 | |||
| 14590 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 227 times.
|
227 | if(global_diving==screen_diving) |
| 14591 | { | ||
| 14592 |
1/2✓ Branch 0 taken 227 times.
✗ Branch 1 not taken.
|
227 | diveclk = (flippers_id < 0 ? 80 : (itemsbuf[flippers_id].misc1 + itemsbuf[flippers_id].misc2)); |
| 14593 | 227 | eatdive = true; | |
| 14594 | 227 | } | |
| 14595 | 227 | } | |
| 14596 |
2/2✓ Branch 0 taken 13173787 times.
✓ Branch 1 taken 227 times.
|
13174014 | if(eatdive) |
| 14597 | 227 | getIntBtnInput(intbtn, true, true, false, false, false); | |
| 14598 | |||
| 14599 |
2/2✓ Branch 0 taken 13060864 times.
✓ Branch 1 taken 113150 times.
|
13174014 | if(action==rafting) |
| 14600 | { | ||
| 14601 | 113150 | do_rafting(); | |
| 14602 | |||
| 14603 |
2/2✓ Branch 0 taken 112795 times.
✓ Branch 1 taken 355 times.
|
113150 | if(action==rafting) |
| 14604 | { | ||
| 14605 | 112795 | return; | |
| 14606 | } | ||
| 14607 | |||
| 14608 | |||
| 14609 | 355 | set_respawn_point(); | |
| 14610 | 355 | trySideviewLadder(); | |
| 14611 | 355 | } | |
| 14612 | |||
| 14613 | 13061219 | int32_t olddirectwpn = directWpn; // To be reinstated if startwpn() fails | |
| 14614 | 13061219 | int32_t btnwpn = -1; | |
| 14615 | |||
| 14616 | //&0xFFF removes the "bow & arrows" bitmask | ||
| 14617 | //The Quick Sword is allowed to interrupt attacks. | ||
| 14618 |
4/4✓ Branch 0 taken 12888789 times.
✓ Branch 1 taken 172430 times.
✓ Branch 2 taken 8698442 times.
✓ Branch 3 taken 4190347 times.
|
13061219 | int32_t currentSwordOrWand = (itemsbuf[dowpn].family == itype_wand || itemsbuf[dowpn].family == itype_sword)?dowpn:-1; |
| 14619 |
8/8✓ Branch 0 taken 11439049 times.
✓ Branch 1 taken 1622170 times.
✓ Branch 2 taken 11427751 times.
✓ Branch 3 taken 11298 times.
✓ Branch 4 taken 390049 times.
✓ Branch 5 taken 1243419 times.
✓ Branch 6 taken 72183 times.
✓ Branch 7 taken 1561285 times.
|
13061219 | if((!attackclk && action!=attacking && action != sideswimattacking) || ((attack==wSword || attack==wWand) && (itemsbuf[currentSwordOrWand].flags & item_flag5))) |
| 14620 | { | ||
| 14621 |
2/2✓ Branch 0 taken 28908 times.
✓ Branch 1 taken 11471026 times.
|
11499934 | if(DrunkrBbtn()) |
| 14622 | { | ||
| 14623 | 28908 | btnwpn=getItemFamily(itemsbuf,Bwpn); | |
| 14624 |
2/2✓ Branch 0 taken 28704 times.
✓ Branch 1 taken 204 times.
|
28908 | dowpn = NEG_OR_MASK(Bwpn,0xFFF); |
| 14625 | 28908 | directWpn = directItemB; | |
| 14626 | 28908 | } | |
| 14627 |
2/2✓ Branch 0 taken 89300 times.
✓ Branch 1 taken 11381726 times.
|
11471026 | else if(DrunkrAbtn()) |
| 14628 | { | ||
| 14629 | 89300 | btnwpn=getItemFamily(itemsbuf,Awpn); | |
| 14630 |
2/2✓ Branch 0 taken 86643 times.
✓ Branch 1 taken 2657 times.
|
89300 | dowpn = NEG_OR_MASK(Awpn,0xFFF); |
| 14631 | 89300 | directWpn = directItemA; | |
| 14632 | 89300 | } | |
| 14633 |
4/4✓ Branch 0 taken 150132 times.
✓ Branch 1 taken 11231594 times.
✓ Branch 2 taken 150076 times.
✓ Branch 3 taken 56 times.
|
11381726 | else if(get_qr(qr_SET_XBUTTON_ITEMS) && DrunkrEx1btn()) |
| 14634 | { | ||
| 14635 | 56 | btnwpn=getItemFamily(itemsbuf,Xwpn); | |
| 14636 |
1/2✓ Branch 0 taken 56 times.
✗ Branch 1 not taken.
|
56 | dowpn = NEG_OR_MASK(Xwpn,0xFFF); |
| 14637 | 56 | directWpn = directItemX; | |
| 14638 | 56 | } | |
| 14639 |
4/4✓ Branch 0 taken 150076 times.
✓ Branch 1 taken 11231594 times.
✓ Branch 2 taken 149953 times.
✓ Branch 3 taken 123 times.
|
11381670 | else if(get_qr(qr_SET_YBUTTON_ITEMS) && DrunkrEx2btn()) |
| 14640 | { | ||
| 14641 | 123 | btnwpn=getItemFamily(itemsbuf,Ywpn); | |
| 14642 |
1/2✓ Branch 0 taken 123 times.
✗ Branch 1 not taken.
|
123 | dowpn = NEG_OR_MASK(Ywpn,0xFFF); |
| 14643 | 123 | directWpn = directItemY; | |
| 14644 | 123 | } | |
| 14645 | |||
| 14646 |
1/2✓ Branch 0 taken 11499934 times.
✗ Branch 1 not taken.
|
11499934 | if(directWpn >= MAXITEMS) directWpn = -1; |
| 14647 | |||
| 14648 | // The Quick Sword only allows repeated sword or wand swings. | ||
| 14649 |
7/8✓ Branch 0 taken 11427751 times.
✓ Branch 1 taken 72183 times.
✓ Branch 2 taken 72183 times.
✓ Branch 3 taken 11427751 times.
✓ Branch 4 taken 71496 times.
✓ Branch 5 taken 687 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 11428438 times.
|
11499934 | if((action==attacking||action==sideswimattacking) && ((attack==wSword && btnwpn!=itype_sword) || (attack==wWand && btnwpn!=itype_wand))) |
| 14650 | 71496 | btnwpn=-1; | |
| 14651 | 11499934 | } | |
| 14652 | |||
| 14653 |
2/2✓ Branch 0 taken 4337521 times.
✓ Branch 1 taken 8723698 times.
|
13061219 | auto swordid = (directWpn>-1 ? directWpn : current_item_id(itype_sword)); |
| 14654 |
11/12✓ Branch 0 taken 12230675 times.
✓ Branch 1 taken 830544 times.
✓ Branch 2 taken 11686483 times.
✓ Branch 3 taken 544192 times.
✓ Branch 4 taken 8096526 times.
✓ Branch 5 taken 3589957 times.
✓ Branch 6 taken 8037414 times.
✓ Branch 7 taken 59112 times.
✓ Branch 8 taken 85986 times.
✓ Branch 9 taken 7951428 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 85986 times.
|
13061219 | if(can_attack() && (swordid > -1 && itemsbuf[swordid].family==itype_sword) && checkitem_jinx(swordid) && btnwpn==itype_sword && charging==0) |
| 14655 | { | ||
| 14656 |
2/2✓ Branch 0 taken 3220 times.
✓ Branch 1 taken 82766 times.
|
85986 | attackid=directWpn>-1 ? directWpn : current_item_id(itype_sword); |
| 14657 |
5/6✓ Branch 0 taken 85984 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 15 times.
✓ Branch 3 taken 85969 times.
✓ Branch 4 taken 15 times.
✗ Branch 5 not taken.
|
85986 | if(checkbunny(attackid) && (checkmagiccost(attackid) || !(itemsbuf[attackid].flags & item_flag6))) |
| 14658 | { | ||
| 14659 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 85969 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
85969 | if((itemsbuf[attackid].flags & item_flag6) && !(misc_internal_hero_flags & LF_PAID_SWORD_COST)) |
| 14660 | { | ||
| 14661 | ✗ | paymagiccost(attackid,true); | |
| 14662 | ✗ | misc_internal_hero_flags |= LF_PAID_SWORD_COST; | |
| 14663 | ✗ | } | |
| 14664 | 85969 | SetAttack(); | |
| 14665 | 85969 | attack=wSword; | |
| 14666 | |||
| 14667 | 85969 | attackclk=0; | |
| 14668 |
2/2✓ Branch 0 taken 3203 times.
✓ Branch 1 taken 82766 times.
|
85969 | sfx(itemsbuf[directWpn>-1 ? directWpn : current_item_id(itype_sword)].usesound, pan(x.getInt())); |
| 14669 | |||
| 14670 |
7/10✓ Branch 0 taken 85969 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 524 times.
✓ Branch 3 taken 85445 times.
✓ Branch 4 taken 524 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 7 times.
✓ Branch 7 taken 517 times.
✓ Branch 8 taken 7 times.
✗ Branch 9 not taken.
|
85969 | if(dowpn>-1 && itemsbuf[dowpn].script!=0 && !did_scripta && !(FFCore.doscript(ScriptType::Item, dowpn) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING))) |
| 14671 | { | ||
| 14672 |
1/2✓ Branch 0 taken 517 times.
✗ Branch 1 not taken.
|
517 | if(!checkmagiccost(dowpn)) |
| 14673 | { | ||
| 14674 | ✗ | item_error(); | |
| 14675 | ✗ | } | |
| 14676 | else | ||
| 14677 | { | ||
| 14678 | //clear the item script stack for a new script | ||
| 14679 | 517 | int i = dowpn; | |
| 14680 | 517 | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 14681 | 517 | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[i].script, i); | |
| 14682 | 517 | did_scripta=true; | |
| 14683 | } | ||
| 14684 | 517 | } | |
| 14685 | 85969 | } | |
| 14686 | else | ||
| 14687 | { | ||
| 14688 | 17 | item_error(); | |
| 14689 | } | ||
| 14690 | 85986 | } | |
| 14691 | else | ||
| 14692 | { | ||
| 14693 | 12975233 | did_scripta=false; | |
| 14694 | } | ||
| 14695 | |||
| 14696 |
6/10✓ Branch 0 taken 12913414 times.
✓ Branch 1 taken 147805 times.
✓ Branch 2 taken 12913414 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 12913414 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 12913414 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 12913414 times.
|
13061219 | if(action!=swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking && !getOnSideviewLadder()) |
| 14697 | { | ||
| 14698 |
3/4✓ Branch 0 taken 2285779 times.
✓ Branch 1 taken 10627635 times.
✓ Branch 2 taken 2285779 times.
✗ Branch 3 not taken.
|
12913414 | if(DrunkUp() && canSideviewLadder()) |
| 14699 | { | ||
| 14700 | ✗ | setOnSideviewLadder(true); | |
| 14701 | ✗ | } | |
| 14702 |
3/4✓ Branch 0 taken 1978404 times.
✓ Branch 1 taken 10935010 times.
✓ Branch 2 taken 1978404 times.
✗ Branch 3 not taken.
|
12913414 | else if(DrunkDown() && canSideviewLadder(true)) |
| 14703 | { | ||
| 14704 | ✗ | y+=1; | |
| 14705 | ✗ | old_y += 1; | |
| 14706 | ✗ | setOnSideviewLadder(true); | |
| 14707 | ✗ | } | |
| 14708 | 12913414 | } | |
| 14709 | |||
| 14710 | 13061219 | int32_t wx=x; | |
| 14711 | 13061219 | int32_t wy=y; | |
| 14712 |
3/6✓ Branch 0 taken 8998463 times.
✓ Branch 1 taken 4062756 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 13061219 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
13061219 | if((action==none || action==walking) && getOnSideviewLadder() && (get_qr(qr_SIDEVIEWLADDER_FACEUP)!=0)) //Allow DIR to change if standing still on sideview ladder, and force-face up. |
| 14713 | { | ||
| 14714 | ✗ | if((xoff==0)||diagonalMovement) | |
| 14715 | { | ||
| 14716 | ✗ | if(DrunkUp()) dir=up; | |
| 14717 | ✗ | if(DrunkDown()) dir=down; | |
| 14718 | ✗ | } | |
| 14719 | |||
| 14720 | ✗ | if((yoff==0)||diagonalMovement) | |
| 14721 | { | ||
| 14722 | ✗ | if(DrunkLeft()) dir=left; | |
| 14723 | ✗ | if(DrunkRight()) dir=right; | |
| 14724 | ✗ | } | |
| 14725 | ✗ | } | |
| 14726 | |||
| 14727 |
5/5✓ Branch 0 taken 20920 times.
✓ Branch 1 taken 3081499 times.
✓ Branch 2 taken 2639666 times.
✓ Branch 3 taken 3528153 times.
✓ Branch 4 taken 3790981 times.
|
13061219 | switch(dir) |
| 14728 | { | ||
| 14729 | case up: | ||
| 14730 | 3081499 | wy-=16; | |
| 14731 | 3081499 | break; | |
| 14732 | |||
| 14733 | case down: | ||
| 14734 | 2639666 | wy+=16; | |
| 14735 | 2639666 | break; | |
| 14736 | |||
| 14737 | case left: | ||
| 14738 | 3528153 | wx-=16; | |
| 14739 | 3528153 | break; | |
| 14740 | |||
| 14741 | case right: | ||
| 14742 | 3790981 | wx+=16; | |
| 14743 | 3790981 | break; | |
| 14744 | } | ||
| 14745 | |||
| 14746 | 13061219 | do_lens(); | |
| 14747 | |||
| 14748 | 13061219 | WalkflagInfo info; | |
| 14749 | |||
| 14750 | 13061219 | bool no_jinx = true; | |
| 14751 |
6/8✓ Branch 0 taken 12230675 times.
✓ Branch 1 taken 788704 times.
✓ Branch 2 taken 28348 times.
✓ Branch 3 taken 12202327 times.
✓ Branch 4 taken 28348 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 28348 times.
|
13061219 | if(can_attack() && btnwpn>itype_sword && charging==0 && btnwpn!=itype_rupee) // This depends on item 0 being a rupee... |
| 14752 | { | ||
| 14753 | 28348 | bool paidmagic = false; | |
| 14754 |
1/2✓ Branch 0 taken 28348 times.
✗ Branch 1 not taken.
|
28348 | bool liftonly = lift_wpn && (liftflags & LIFTFL_DIS_ITEMS); |
| 14755 |
6/10✓ Branch 0 taken 28348 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 26563 times.
✓ Branch 3 taken 1785 times.
✓ Branch 4 taken 1785 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1785 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1785 times.
|
28348 | if(!liftonly && btnwpn==itype_wand && (directWpn>-1 ? (!item_disabled(directWpn) ? itemsbuf[directWpn].family==itype_wand : false) : current_item(itype_wand))) |
| 14756 | { | ||
| 14757 |
1/2✓ Branch 0 taken 1785 times.
✗ Branch 1 not taken.
|
1785 | attackid=directWpn>-1 ? directWpn : current_item_id(itype_wand); |
| 14758 | 1785 | no_jinx = checkitem_jinx(attackid); | |
| 14759 |
4/8✓ Branch 0 taken 1784 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1784 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1784 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
1785 | if(no_jinx && checkbunny(attackid) && ((!(itemsbuf[attackid].flags & item_flag6)) || checkmagiccost(attackid))) |
| 14760 | { | ||
| 14761 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1784 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1784 | if((itemsbuf[attackid].flags & item_flag6) && !(misc_internal_hero_flags & LF_PAID_WAND_COST)){ |
| 14762 | ✗ | paymagiccost(attackid,true); | |
| 14763 | ✗ | misc_internal_hero_flags |= LF_PAID_WAND_COST; | |
| 14764 | ✗ | } | |
| 14765 | 1784 | SetAttack(); | |
| 14766 | 1784 | attack=wWand; | |
| 14767 | 1784 | attackclk=0; | |
| 14768 | 1784 | } | |
| 14769 | else | ||
| 14770 | { | ||
| 14771 | 1 | item_error(); | |
| 14772 | } | ||
| 14773 | 1785 | } | |
| 14774 |
5/8✓ Branch 0 taken 26563 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2255 times.
✓ Branch 3 taken 24308 times.
✓ Branch 4 taken 2255 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 2255 times.
|
28818 | else if(!liftonly && (btnwpn==itype_hammer)&&!((action==attacking||action==sideswimattacking) && attack==wHammer) |
| 14775 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 2255 times.
✓ Branch 2 taken 2255 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2255 times.
|
2255 | && (directWpn>-1 ? (!item_disabled(directWpn) ? itemsbuf[directWpn].family==itype_hammer : false) : current_item(itype_hammer))) |
| 14776 | { | ||
| 14777 | 2255 | no_jinx = checkitem_jinx(dowpn); | |
| 14778 |
3/6✓ Branch 0 taken 2255 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2255 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2255 times.
|
2255 | if(!(no_jinx && checkmagiccost(dowpn) && checkbunny(dowpn))) |
| 14779 | { | ||
| 14780 | ✗ | item_error(); | |
| 14781 | ✗ | } | |
| 14782 | else | ||
| 14783 | { | ||
| 14784 | 2255 | paymagiccost(dowpn); | |
| 14785 | 2255 | paidmagic = true; | |
| 14786 | 2255 | SetAttack(); | |
| 14787 | 2255 | attack=wHammer; | |
| 14788 |
1/2✓ Branch 0 taken 2255 times.
✗ Branch 1 not taken.
|
2255 | attackid=directWpn>-1 ? directWpn : current_item_id(itype_hammer); |
| 14789 | 2255 | attackclk=0; | |
| 14790 | } | ||
| 14791 | 2255 | } | |
| 14792 |
5/8✓ Branch 0 taken 24308 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1832 times.
✓ Branch 3 taken 22476 times.
✓ Branch 4 taken 1832 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1832 times.
|
26140 | else if(!liftonly && (btnwpn==itype_candle)&&!((action==attacking||action==sideswimattacking) && attack==wFire) |
| 14793 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 1832 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1832 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1832 times.
|
1832 | && (directWpn>-1 ? (!item_disabled(directWpn) ? itemsbuf[directWpn].family==itype_candle : false) : current_item(itype_candle))) |
| 14794 | { | ||
| 14795 | //checkbunny handled where magic cost is paid | ||
| 14796 |
1/2✓ Branch 0 taken 1832 times.
✗ Branch 1 not taken.
|
1832 | attackid=directWpn>-1 ? directWpn : current_item_id(itype_candle); |
| 14797 | 1832 | no_jinx = checkitem_jinx(attackid); | |
| 14798 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1832 times.
|
1832 | if(no_jinx) |
| 14799 | { | ||
| 14800 | 1832 | SetAttack(); | |
| 14801 | 1832 | attack=wFire; | |
| 14802 | 1832 | attackclk=0; | |
| 14803 | 1832 | } | |
| 14804 | 1832 | } | |
| 14805 |
5/8✓ Branch 0 taken 22476 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 22472 times.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 4 times.
|
22480 | else if(!liftonly && (btnwpn==itype_cbyrna)&&!((action==attacking||action==sideswimattacking) && attack==wCByrna) |
| 14806 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
|
4 | && (directWpn>-1 ? (!item_disabled(directWpn) ? itemsbuf[directWpn].family==itype_cbyrna : false) : current_item(itype_cbyrna))) |
| 14807 | { | ||
| 14808 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | attackid=directWpn>-1 ? directWpn : current_item_id(itype_cbyrna); |
| 14809 | 4 | no_jinx = checkitem_jinx(attackid); | |
| 14810 |
3/8✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
4 | if(no_jinx && checkbunny(attackid) && ((!(itemsbuf[attackid].flags & item_flag6)) || checkmagiccost(attackid))) |
| 14811 | { | ||
| 14812 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
4 | if((itemsbuf[attackid].flags & item_flag6) && !(misc_internal_hero_flags & LF_PAID_CBYRNA_COST)){ |
| 14813 | ✗ | paymagiccost(attackid,true); | |
| 14814 | ✗ | misc_internal_hero_flags |= LF_PAID_CBYRNA_COST; | |
| 14815 | ✗ | } | |
| 14816 | 4 | SetAttack(); | |
| 14817 | 4 | attack=wCByrna; | |
| 14818 | 4 | attackclk=0; | |
| 14819 | 4 | } | |
| 14820 | else | ||
| 14821 | { | ||
| 14822 | ✗ | item_error(); | |
| 14823 | } | ||
| 14824 | 4 | } | |
| 14825 |
2/8✓ Branch 0 taken 22472 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 22472 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
22472 | else if(!liftonly && (btnwpn==itype_bugnet)&&!((action==attacking||action==sideswimattacking) && attack==wBugNet) |
| 14826 | ✗ | && (directWpn>-1 ? (!item_disabled(directWpn) && itemsbuf[directWpn].family==itype_bugnet) : current_item(itype_bugnet))) | |
| 14827 | { | ||
| 14828 | ✗ | attackid = directWpn>-1 ? directWpn : current_item_id(itype_bugnet); | |
| 14829 | ✗ | no_jinx = checkitem_jinx(attackid); | |
| 14830 | ✗ | if(no_jinx && checkbunny(attackid) && checkmagiccost(attackid)) | |
| 14831 | { | ||
| 14832 | ✗ | paymagiccost(attackid); | |
| 14833 | ✗ | SetAttack(); | |
| 14834 | ✗ | attack = wBugNet; | |
| 14835 | ✗ | attackclk = 0; | |
| 14836 | ✗ | sfx(itemsbuf[attackid].usesound); | |
| 14837 | ✗ | } | |
| 14838 | else | ||
| 14839 | { | ||
| 14840 | ✗ | item_error(); | |
| 14841 | } | ||
| 14842 | ✗ | } | |
| 14843 | else | ||
| 14844 | { | ||
| 14845 |
1/2✓ Branch 0 taken 22472 times.
✗ Branch 1 not taken.
|
22472 | auto itmid = directWpn>-1 ? directWpn : current_item_id(btnwpn); |
| 14846 | 22472 | no_jinx = checkitem_jinx(itmid); | |
| 14847 |
2/2✓ Branch 0 taken 51 times.
✓ Branch 1 taken 22421 times.
|
22472 | if(no_jinx) |
| 14848 | { | ||
| 14849 | 22421 | paidmagic = startwpn(itmid); | |
| 14850 | |||
| 14851 |
2/2✓ Branch 0 taken 19414 times.
✓ Branch 1 taken 3007 times.
|
22421 | if(paidmagic) |
| 14852 | { | ||
| 14853 |
6/10✓ Branch 0 taken 19394 times.
✓ Branch 1 taken 20 times.
✓ Branch 2 taken 19394 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 19394 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 19394 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 19394 times.
|
19414 | if(action==casting || action==drowning || action==lavadrowning || action == sideswimcasting || action==sidedrowning) |
| 14854 | { | ||
| 14855 | ; | ||
| 14856 | 20 | } | |
| 14857 | else | ||
| 14858 | { | ||
| 14859 | 19394 | SetAttack(); | |
| 14860 | 19394 | attackclk=0; | |
| 14861 | 19394 | attack=none; | |
| 14862 | |||
| 14863 |
2/2✓ Branch 0 taken 5913 times.
✓ Branch 1 taken 13481 times.
|
19394 | if(btnwpn==itype_brang) |
| 14864 | { | ||
| 14865 | 13481 | attack=wBrang; | |
| 14866 | 13481 | } | |
| 14867 | } | ||
| 14868 | 19414 | } | |
| 14869 | else | ||
| 14870 | { | ||
| 14871 | // Weapon not started: directWpn should be reset to prev. value. | ||
| 14872 | 3007 | directWpn = olddirectwpn; | |
| 14873 | } | ||
| 14874 | 22421 | } | |
| 14875 | } | ||
| 14876 | |||
| 14877 |
8/12✓ Branch 0 taken 28348 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28296 times.
✓ Branch 3 taken 52 times.
✓ Branch 4 taken 1211 times.
✓ Branch 5 taken 27085 times.
✓ Branch 6 taken 1145 times.
✓ Branch 7 taken 66 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1145 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
28348 | if(dowpn>-1 && no_jinx && itemsbuf[dowpn].script!=0 && !did_scriptb && !(FFCore.doscript(ScriptType::Item, dowpn) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING))) |
| 14878 | { | ||
| 14879 |
3/4✓ Branch 0 taken 1143 times.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1145 times.
|
1145 | if(!((paidmagic || checkmagiccost(dowpn)) && checkbunny(dowpn))) |
| 14880 | { | ||
| 14881 | ✗ | item_error(); | |
| 14882 | ✗ | } | |
| 14883 | else | ||
| 14884 | { | ||
| 14885 | // Only charge for magic if item's magic cost wasn't already charged | ||
| 14886 | // for the item's main use. | ||
| 14887 |
4/4✓ Branch 0 taken 1143 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 7 times.
✓ Branch 3 taken 1136 times.
|
1145 | if(!paidmagic && attack!=wWand) |
| 14888 | 1136 | paymagiccost(dowpn); | |
| 14889 | //clear the item script stack for a new script | ||
| 14890 | 1145 | int i = dowpn; | |
| 14891 | 1145 | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 14892 | 1145 | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[i].script, i); | |
| 14893 | 1145 | did_scriptb=true; | |
| 14894 | } | ||
| 14895 | 1145 | } | |
| 14896 | |||
| 14897 |
8/12✓ Branch 0 taken 28296 times.
✓ Branch 1 taken 52 times.
✓ Branch 2 taken 28276 times.
✓ Branch 3 taken 20 times.
✓ Branch 4 taken 28276 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 28276 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 28276 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 28276 times.
|
28348 | if(no_jinx && (action==casting || action==drowning || action==lavadrowning || action == sideswimcasting || action==sidedrowning)) |
| 14898 | { | ||
| 14899 | 20 | return; | |
| 14900 | } | ||
| 14901 |
2/2✓ Branch 0 taken 28276 times.
✓ Branch 1 taken 52 times.
|
28328 | if(!no_jinx) |
| 14902 | 52 | did_scriptb = false; | |
| 14903 | 28328 | } | |
| 14904 | else | ||
| 14905 | { | ||
| 14906 | 12991031 | did_scriptb=false; | |
| 14907 | } | ||
| 14908 | |||
| 14909 |
6/6✓ Branch 0 taken 11439715 times.
✓ Branch 1 taken 1579644 times.
✓ Branch 2 taken 11317057 times.
✓ Branch 3 taken 122658 times.
✓ Branch 4 taken 20920 times.
✓ Branch 5 taken 11337017 times.
|
13019359 | if(attackclk || action==attacking || action==sideswimattacking) |
| 14910 | { | ||
| 14911 | |||
| 14912 |
4/8✓ Branch 0 taken 122658 times.
✓ Branch 1 taken 1600564 times.
✓ Branch 2 taken 122658 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 122658 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
1723222 | if((attackclk==0) && action!=sideswimattacking && getOnSideviewLadder() && (get_qr(qr_SIDEVIEWLADDER_FACEUP)!=0)) //Allow DIR to change if standing still on sideview ladder, and force-face up. |
| 14913 | { | ||
| 14914 | ✗ | if((xoff==0)||diagonalMovement) | |
| 14915 | { | ||
| 14916 | ✗ | if(DrunkUp()) dir=up; | |
| 14917 | ✗ | if(DrunkDown()) dir=down; | |
| 14918 | ✗ | } | |
| 14919 | |||
| 14920 | ✗ | if((yoff==0)||diagonalMovement) | |
| 14921 | { | ||
| 14922 | ✗ | if(DrunkLeft()) dir=left; | |
| 14923 | ✗ | if(DrunkRight()) dir=right; | |
| 14924 | ✗ | } | |
| 14925 | ✗ | } | |
| 14926 | |||
| 14927 | 1723222 | bool attacked = doattack(); | |
| 14928 | |||
| 14929 | // This section below interferes with script-setting Hero->Dir, so it comes after doattack | ||
| 14930 |
10/12✓ Branch 0 taken 1720077 times.
✓ Branch 1 taken 3145 times.
✓ Branch 2 taken 1239266 times.
✓ Branch 3 taken 480811 times.
✓ Branch 4 taken 264928 times.
✓ Branch 5 taken 974338 times.
✓ Branch 6 taken 229279 times.
✓ Branch 7 taken 35649 times.
✓ Branch 8 taken 229279 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 229279 times.
|
1723222 | if(!inlikelike && attackclk>4 && (attackclk&3)==0 && charging==0 && spins==0 && action!=sideswimattacking) |
| 14931 | { | ||
| 14932 |
4/4✓ Branch 0 taken 110634 times.
✓ Branch 1 taken 118645 times.
✓ Branch 2 taken 37796 times.
✓ Branch 3 taken 72838 times.
|
229279 | if((xoff==0)||diagonalMovement) |
| 14933 | { | ||
| 14934 |
2/2✓ Branch 0 taken 140052 times.
✓ Branch 1 taken 16389 times.
|
156441 | if(DrunkUp()) dir=up; |
| 14935 | |||
| 14936 |
2/2✓ Branch 0 taken 137053 times.
✓ Branch 1 taken 19388 times.
|
156441 | if(DrunkDown()) dir=down; |
| 14937 | 156441 | } | |
| 14938 | |||
| 14939 |
4/4✓ Branch 0 taken 87877 times.
✓ Branch 1 taken 141402 times.
✓ Branch 2 taken 35727 times.
✓ Branch 3 taken 52150 times.
|
229279 | if((yoff==0)||diagonalMovement) |
| 14940 | { | ||
| 14941 |
2/2✓ Branch 0 taken 151761 times.
✓ Branch 1 taken 25368 times.
|
177129 | if(DrunkLeft()) dir=left; |
| 14942 | |||
| 14943 |
2/2✓ Branch 0 taken 150942 times.
✓ Branch 1 taken 26187 times.
|
177129 | if(DrunkRight()) dir=right; |
| 14944 | 177129 | } | |
| 14945 | 229279 | } | |
| 14946 | |||
| 14947 |
9/10✓ Branch 0 taken 1607618 times.
✓ Branch 1 taken 115604 times.
✓ Branch 2 taken 1566632 times.
✓ Branch 3 taken 40986 times.
✓ Branch 4 taken 1566197 times.
✓ Branch 5 taken 435 times.
✓ Branch 6 taken 1561835 times.
✓ Branch 7 taken 4362 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1561835 times.
|
1723222 | if(attacked && (charging==0 && spins<=5) && jumping<1 && action!=sideswimattacking) |
| 14948 | { | ||
| 14949 | 1561835 | return; | |
| 14950 | } | ||
| 14951 |
2/2✓ Branch 0 taken 45783 times.
✓ Branch 1 taken 115604 times.
|
161387 | else if(!attacked) |
| 14952 | { | ||
| 14953 | // Spin attack - change direction | ||
| 14954 |
3/4✓ Branch 0 taken 665 times.
✓ Branch 1 taken 114939 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 665 times.
|
115604 | if(spins>1 && attack != wHammer) |
| 14955 | { | ||
| 14956 | 665 | spins--; | |
| 14957 | |||
| 14958 |
2/2✓ Branch 0 taken 620 times.
✓ Branch 1 taken 45 times.
|
665 | if(spins%5==0) |
| 14959 | { | ||
| 14960 |
1/2✓ Branch 0 taken 45 times.
✗ Branch 1 not taken.
|
45 | int id = currentscroll > -1 ? currentscroll : (current_item_id(spins>5 ? itype_spinscroll2 : itype_spinscroll)); |
| 14961 | 45 | sfx(itemsbuf[id].usesound,pan(x.getInt())); | |
| 14962 | 45 | } | |
| 14963 | 665 | attackclk=1; | |
| 14964 | |||
| 14965 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 167 times.
✓ Branch 2 taken 166 times.
✓ Branch 3 taken 166 times.
✓ Branch 4 taken 166 times.
|
665 | switch(dir) |
| 14966 | { | ||
| 14967 | case up: | ||
| 14968 | 167 | dir=left; | |
| 14969 | 167 | break; | |
| 14970 | |||
| 14971 | case right: | ||
| 14972 | 166 | dir=up; | |
| 14973 | 166 | break; | |
| 14974 | |||
| 14975 | case down: | ||
| 14976 | 166 | dir=right; | |
| 14977 | 166 | break; | |
| 14978 | |||
| 14979 | case left: | ||
| 14980 | 166 | dir=down; | |
| 14981 | 166 | break; | |
| 14982 | } | ||
| 14983 | |||
| 14984 | 665 | return; | |
| 14985 | } | ||
| 14986 | else | ||
| 14987 | { | ||
| 14988 | 114939 | spins=0; | |
| 14989 | } | ||
| 14990 | |||
| 14991 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 114939 times.
|
114939 | if (IsSideSwim()) {action=sideswimming; FFCore.setHeroAction(sideswimming);} |
| 14992 | 114939 | else {action=none; FFCore.setHeroAction(none);} | |
| 14993 | 114939 | attackclk=0; | |
| 14994 | 114939 | charging=0; | |
| 14995 | 114939 | } | |
| 14996 | 160722 | } | |
| 14997 | |||
| 14998 |
2/2✓ Branch 0 taken 62 times.
✓ Branch 1 taken 11497677 times.
|
11497739 | if(pitslide()) //Check pit's 'pull'. If true, then Hero cannot fight the pull. |
| 14999 | 62 | return; | |
| 15000 | |||
| 15001 |
2/2✓ Branch 0 taken 4316397 times.
✓ Branch 1 taken 7181280 times.
|
11497677 | if(action==walking) //still walking |
| 15002 | { | ||
| 15003 |
9/10✓ Branch 0 taken 5274700 times.
✓ Branch 1 taken 1906580 times.
✓ Branch 2 taken 3672659 times.
✓ Branch 3 taken 1602041 times.
✓ Branch 4 taken 1933719 times.
✓ Branch 5 taken 1738940 times.
✓ Branch 6 taken 79630 times.
✓ Branch 7 taken 1854089 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 79630 times.
|
7181280 | if(!DrunkUp() && !DrunkDown() && !DrunkLeft() && !DrunkRight() && !autostep) |
| 15004 | { | ||
| 15005 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 79630 times.
|
79630 | if(attackclk>0) SetAttack(); |
| 15006 | 79630 | else {action = none; FFCore.setHeroAction(none);} | |
| 15007 | 79630 | hero_count=-1; | |
| 15008 | 79630 | return; | |
| 15009 | } | ||
| 15010 | |||
| 15011 | 7101650 | autostep=false; | |
| 15012 | |||
| 15013 |
4/6✓ Branch 0 taken 4948676 times.
✓ Branch 1 taken 2152974 times.
✓ Branch 2 taken 4948676 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4948676 times.
|
7101650 | if(!(diagonalMovement || NO_GRIDLOCK)) |
| 15014 | { | ||
| 15015 |
2/4✓ Branch 0 taken 4948676 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4948676 times.
|
4948676 | if(get_qr(qr_NEW_HERO_MOVEMENT) || IsSideSwim()) |
| 15016 | { | ||
| 15017 | ✗ | if(dir==up&&yoff) | |
| 15018 | { | ||
| 15019 | ✗ | info = walkflag(x,y+(bigHitbox?0:8)-int32_t(lsteps[y.getInt()&7]),2,up); | |
| 15020 | ✗ | info = info || walkflagMBlock(x+8,y+(bigHitbox?0:8)-int32_t(lsteps[y.getInt()&7])); | |
| 15021 | ✗ | execute(info); | |
| 15022 | |||
| 15023 | ✗ | if(!info.isUnwalkable()) | |
| 15024 | { | ||
| 15025 | ✗ | moveOld2(up); | |
| 15026 | ✗ | } | |
| 15027 | else | ||
| 15028 | { | ||
| 15029 | ✗ | action=none; FFCore.setHeroAction(none); | |
| 15030 | } | ||
| 15031 | |||
| 15032 | ✗ | return; | |
| 15033 | } | ||
| 15034 | |||
| 15035 | ✗ | if(dir==down&&yoff) | |
| 15036 | { | ||
| 15037 | ✗ | info = walkflag(x,y+15+int32_t(lsteps[y.getInt()&7]),2,down); | |
| 15038 | ✗ | info = info || walkflagMBlock(x+8,y+15+int32_t(lsteps[y.getInt()&7])); | |
| 15039 | ✗ | execute(info); | |
| 15040 | |||
| 15041 | ✗ | if(!info.isUnwalkable()) | |
| 15042 | { | ||
| 15043 | ✗ | moveOld2(down); | |
| 15044 | ✗ | } | |
| 15045 | else | ||
| 15046 | { | ||
| 15047 | ✗ | action=none; FFCore.setHeroAction(none); | |
| 15048 | } | ||
| 15049 | |||
| 15050 | ✗ | return; | |
| 15051 | } | ||
| 15052 | |||
| 15053 | ✗ | if(dir==left&&xoff) | |
| 15054 | { | ||
| 15055 | ✗ | info = walkflag(x-int32_t(lsteps[x.getInt()&7]),y+(bigHitbox?0:8),1,left) || walkflag(x-int32_t(lsteps[x.getInt()&7]),y+8,1,left); | |
| 15056 | ✗ | execute(info); | |
| 15057 | |||
| 15058 | ✗ | if(!info.isUnwalkable()) | |
| 15059 | { | ||
| 15060 | ✗ | moveOld2(left); | |
| 15061 | ✗ | } | |
| 15062 | else | ||
| 15063 | { | ||
| 15064 | ✗ | action=none; FFCore.setHeroAction(none); | |
| 15065 | } | ||
| 15066 | |||
| 15067 | ✗ | return; | |
| 15068 | } | ||
| 15069 | |||
| 15070 | ✗ | if(dir==right&&xoff) | |
| 15071 | { | ||
| 15072 | ✗ | info = walkflag(x+15+int32_t(lsteps[x.getInt()&7]),y+(bigHitbox?0:8),1,right) || walkflag(x+15+int32_t(lsteps[x.getInt()&7]),y+8,1,right); | |
| 15073 | ✗ | execute(info); | |
| 15074 | |||
| 15075 | ✗ | if(!info.isUnwalkable()) | |
| 15076 | { | ||
| 15077 | ✗ | moveOld2(right); | |
| 15078 | ✗ | } | |
| 15079 | else | ||
| 15080 | { | ||
| 15081 | ✗ | action=none; FFCore.setHeroAction(none); | |
| 15082 | } | ||
| 15083 | |||
| 15084 | ✗ | return; | |
| 15085 | } | ||
| 15086 | ✗ | } | |
| 15087 | else | ||
| 15088 | { | ||
| 15089 |
4/4✓ Branch 0 taken 1152419 times.
✓ Branch 1 taken 3796257 times.
✓ Branch 2 taken 188754 times.
✓ Branch 3 taken 963665 times.
|
4948676 | if(dir==up&&yoff) |
| 15090 | { | ||
| 15091 | 963665 | while(true) | |
| 15092 | { | ||
| 15093 | 963667 | info = walkflag(temp_x,temp_y+(bigHitbox?0:8)-temp_step,2,up); | |
| 15094 | 963667 | info = info || walkflagMBlock(temp_x+8,temp_y+(bigHitbox?0:8)-temp_step); | |
| 15095 | 963667 | execute(info); | |
| 15096 | |||
| 15097 |
2/2✓ Branch 0 taken 5173 times.
✓ Branch 1 taken 958494 times.
|
963667 | if(!info.isUnwalkable()) |
| 15098 | { | ||
| 15099 | 958494 | hero_newstep = temp_step; | |
| 15100 | 958494 | x = temp_x; | |
| 15101 | 958494 | y = temp_y; | |
| 15102 | 958494 | moveOld2(up); | |
| 15103 | 958494 | return; | |
| 15104 | } | ||
| 15105 | //Could not move, try moving less | ||
| 15106 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5173 times.
|
5173 | if(temp_y != int32_t(temp_y)) |
| 15107 | { | ||
| 15108 | ✗ | temp_y = floor((double)temp_y); | |
| 15109 | ✗ | continue; | |
| 15110 | } | ||
| 15111 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 5171 times.
|
5173 | else if(temp_step > 1) |
| 15112 | { | ||
| 15113 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if(temp_step != int32_t(temp_step)) //floor |
| 15114 | 2 | temp_step = floor((double)temp_step); | |
| 15115 | ✗ | else --temp_step; | |
| 15116 | 2 | continue; | |
| 15117 | } | ||
| 15118 | else //Can't move less, stop moving | ||
| 15119 | { | ||
| 15120 | 5171 | action=none; FFCore.setHeroAction(none); | |
| 15121 | } | ||
| 15122 | 5171 | return; | |
| 15123 | } | ||
| 15124 | } | ||
| 15125 | |||
| 15126 |
4/4✓ Branch 0 taken 945024 times.
✓ Branch 1 taken 3039987 times.
✓ Branch 2 taken 156231 times.
✓ Branch 3 taken 788793 times.
|
3985011 | if(dir==down&&yoff) |
| 15127 | { | ||
| 15128 | 788793 | while(true) | |
| 15129 | { | ||
| 15130 | 788847 | info = walkflag(temp_x,temp_y+15+temp_step,2,down); | |
| 15131 | 788847 | info = info || walkflagMBlock(temp_x+8,temp_y+15+temp_step); | |
| 15132 | 788847 | execute(info); | |
| 15133 | |||
| 15134 |
2/2✓ Branch 0 taken 4455 times.
✓ Branch 1 taken 784392 times.
|
788847 | if(!info.isUnwalkable()) |
| 15135 | { | ||
| 15136 | 784392 | hero_newstep = temp_step; | |
| 15137 | 784392 | x = temp_x; | |
| 15138 | 784392 | y = temp_y; | |
| 15139 | 784392 | moveOld2(down); | |
| 15140 | 784392 | return; | |
| 15141 | } | ||
| 15142 | //Could not move, try moving less | ||
| 15143 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4455 times.
|
4455 | if(temp_y != int32_t(temp_y)) |
| 15144 | { | ||
| 15145 | ✗ | temp_y = floor((double)temp_y); | |
| 15146 | ✗ | continue; | |
| 15147 | } | ||
| 15148 |
2/2✓ Branch 0 taken 54 times.
✓ Branch 1 taken 4401 times.
|
4455 | else if(temp_step > 1) |
| 15149 | { | ||
| 15150 |
1/2✓ Branch 0 taken 54 times.
✗ Branch 1 not taken.
|
54 | if(temp_step != int32_t(temp_step)) //floor |
| 15151 | 54 | temp_step = floor((double)temp_step); | |
| 15152 | ✗ | else --temp_step; | |
| 15153 | 54 | continue; | |
| 15154 | } | ||
| 15155 | else //Can't move less, stop moving | ||
| 15156 | { | ||
| 15157 | 4401 | action=none; FFCore.setHeroAction(none); | |
| 15158 | } | ||
| 15159 | 4401 | return; | |
| 15160 | } | ||
| 15161 | } | ||
| 15162 | |||
| 15163 |
4/4✓ Branch 0 taken 1387303 times.
✓ Branch 1 taken 1808915 times.
✓ Branch 2 taken 232465 times.
✓ Branch 3 taken 1154838 times.
|
3196218 | if(dir==left&&xoff) |
| 15164 | { | ||
| 15165 | 1154838 | while(true) | |
| 15166 | { | ||
| 15167 | 1154838 | info = walkflag(temp_x-temp_step,temp_y+(bigHitbox?0:8),1,left) || walkflag(temp_x-temp_step,temp_y+8,1,left); | |
| 15168 | 1154838 | execute(info); | |
| 15169 | |||
| 15170 |
2/2✓ Branch 0 taken 5165 times.
✓ Branch 1 taken 1149673 times.
|
1154838 | if(!info.isUnwalkable()) |
| 15171 | { | ||
| 15172 | 1149673 | hero_newstep = temp_step; | |
| 15173 | 1149673 | x = temp_x; | |
| 15174 | 1149673 | y = temp_y; | |
| 15175 | 1149673 | moveOld2(left); | |
| 15176 | 1149673 | return; | |
| 15177 | } | ||
| 15178 | //Could not move, try moving less | ||
| 15179 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5165 times.
|
5165 | if(temp_x != int32_t(temp_x)) |
| 15180 | { | ||
| 15181 | ✗ | temp_x = floor((double)temp_x); | |
| 15182 | ✗ | continue; | |
| 15183 | } | ||
| 15184 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5165 times.
|
5165 | else if(temp_step > 1) |
| 15185 | { | ||
| 15186 | ✗ | if(temp_step != int32_t(temp_step)) //floor | |
| 15187 | ✗ | temp_step = floor((double)temp_step); | |
| 15188 | ✗ | else --temp_step; | |
| 15189 | ✗ | continue; | |
| 15190 | } | ||
| 15191 | else //Can't move less, stop moving | ||
| 15192 | { | ||
| 15193 | 5165 | action=none; FFCore.setHeroAction(none); | |
| 15194 | } | ||
| 15195 | 5165 | return; | |
| 15196 | } | ||
| 15197 | } | ||
| 15198 | |||
| 15199 |
4/4✓ Branch 0 taken 1463930 times.
✓ Branch 1 taken 577450 times.
✓ Branch 2 taken 245283 times.
✓ Branch 3 taken 1218647 times.
|
2041380 | if(dir==right&&xoff) |
| 15200 | { | ||
| 15201 | 1218647 | while(true) | |
| 15202 | { | ||
| 15203 | 1218709 | info = walkflag(temp_x+15+temp_step,temp_y+(bigHitbox?0:8),1,right) || walkflag(temp_x+15+temp_step,temp_y+8,1,right); | |
| 15204 | 1218709 | execute(info); | |
| 15205 | |||
| 15206 |
2/2✓ Branch 0 taken 5827 times.
✓ Branch 1 taken 1212882 times.
|
1218709 | if(!info.isUnwalkable()) |
| 15207 | { | ||
| 15208 | 1212882 | hero_newstep = temp_step; | |
| 15209 | 1212882 | x = temp_x; | |
| 15210 | 1212882 | y = temp_y; | |
| 15211 | 1212882 | moveOld2(right); | |
| 15212 | 1212882 | return; | |
| 15213 | } | ||
| 15214 | //Could not move, try moving less | ||
| 15215 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5827 times.
|
5827 | if(temp_x != int32_t(temp_x)) |
| 15216 | { | ||
| 15217 | ✗ | temp_x = floor((double)temp_x); | |
| 15218 | ✗ | continue; | |
| 15219 | } | ||
| 15220 |
2/2✓ Branch 0 taken 62 times.
✓ Branch 1 taken 5765 times.
|
5827 | else if(temp_step > 1) |
| 15221 | { | ||
| 15222 |
1/2✓ Branch 0 taken 62 times.
✗ Branch 1 not taken.
|
62 | if(temp_step != int32_t(temp_step)) //floor |
| 15223 | 62 | temp_step = floor((double)temp_step); | |
| 15224 | ✗ | else --temp_step; | |
| 15225 | 62 | continue; | |
| 15226 | } | ||
| 15227 | else //Can't move less, stop moving | ||
| 15228 | { | ||
| 15229 | 5765 | action=none; FFCore.setHeroAction(none); | |
| 15230 | } | ||
| 15231 | 5765 | return; | |
| 15232 | } | ||
| 15233 | } | ||
| 15234 | } | ||
| 15235 | 822733 | } | |
| 15236 | |||
| 15237 | 2975707 | } // endif (action==walking) | |
| 15238 | |||
| 15239 |
16/24✓ Branch 0 taken 7145259 times.
✓ Branch 1 taken 146845 times.
✓ Branch 2 taken 7145259 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7145259 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 7145259 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 7145259 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 7145259 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 7145259 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 7145259 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 7145259 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 7104273 times.
✓ Branch 19 taken 40986 times.
✓ Branch 20 taken 7103838 times.
✓ Branch 21 taken 435 times.
✓ Branch 22 taken 89445 times.
✓ Branch 23 taken 7014393 times.
|
7292104 | if((action!=swimming)&&(action!=sideswimming)&&(action !=sideswimhit)&&(action !=sideswimattacking)&&(action!=casting)&&(action!=sideswimcasting)&&(action!=drowning)&&(action!=sidedrowning)&&(action!=lavadrowning) && charging==0 && spins==0 && jumping<1) |
| 15240 | { | ||
| 15241 | 7014393 | action=none; FFCore.setHeroAction(none); | |
| 15242 | 7014393 | } | |
| 15243 | |||
| 15244 |
2/2✓ Branch 0 taken 3514037 times.
✓ Branch 1 taken 3778067 times.
|
7292104 | if(diagonalMovement) |
| 15245 | { | ||
| 15246 |
5/5✓ Branch 0 taken 1131643 times.
✓ Branch 1 taken 529876 times.
✓ Branch 2 taken 440396 times.
✓ Branch 3 taken 676094 times.
✓ Branch 4 taken 736028 times.
|
3514037 | switch(holddir) |
| 15247 | { | ||
| 15248 | case up: | ||
| 15249 |
2/2✓ Branch 0 taken 513235 times.
✓ Branch 1 taken 16641 times.
|
529876 | if(!Up()) |
| 15250 | { | ||
| 15251 | 16641 | holddir=-1; | |
| 15252 | 16641 | } | |
| 15253 | |||
| 15254 | 529876 | break; | |
| 15255 | |||
| 15256 | case down: | ||
| 15257 |
2/2✓ Branch 0 taken 425601 times.
✓ Branch 1 taken 14795 times.
|
440396 | if(!Down()) |
| 15258 | { | ||
| 15259 | 14795 | holddir=-1; | |
| 15260 | 14795 | } | |
| 15261 | |||
| 15262 | 440396 | break; | |
| 15263 | |||
| 15264 | case left: | ||
| 15265 |
2/2✓ Branch 0 taken 656348 times.
✓ Branch 1 taken 19746 times.
|
676094 | if(!Left()) |
| 15266 | { | ||
| 15267 | 19746 | holddir=-1; | |
| 15268 | 19746 | } | |
| 15269 | |||
| 15270 | 676094 | break; | |
| 15271 | |||
| 15272 | case right: | ||
| 15273 |
2/2✓ Branch 0 taken 715630 times.
✓ Branch 1 taken 20398 times.
|
736028 | if(!Right()) |
| 15274 | { | ||
| 15275 | 20398 | holddir=-1; | |
| 15276 | 20398 | } | |
| 15277 | |||
| 15278 | 736028 | break; | |
| 15279 | |||
| 15280 | default: | ||
| 15281 | 1131643 | break; | |
| 15282 | } //end switch | ||
| 15283 | |||
| 15284 |
4/4✓ Branch 0 taken 2986357 times.
✓ Branch 1 taken 527680 times.
✓ Branch 2 taken 31652 times.
✓ Branch 3 taken 3017049 times.
|
3514037 | if(get_qr(qr_NEW_HERO_MOVEMENT) || IsSideSwim()) //!DIRECTION SET |
| 15285 | { | ||
| 15286 | 559332 | walkable = false; | |
| 15287 |
6/6✓ Branch 0 taken 93100 times.
✓ Branch 1 taken 414620 times.
✓ Branch 2 taken 90091 times.
✓ Branch 3 taken 3009 times.
✓ Branch 4 taken 22809 times.
✓ Branch 5 taken 67282 times.
|
559332 | if(DrunkUp()&&(holddir==-1||holddir==up)) |
| 15288 | { | ||
| 15289 |
5/8✓ Branch 0 taken 3090 times.
✓ Branch 1 taken 67201 times.
✓ Branch 2 taken 3057 times.
✓ Branch 3 taken 33 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 3090 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
70291 | if(isdungeon() && (x<=26 || x>=214) && !get_qr(qr_FREEFORM) && !toogam) |
| 15290 | { | ||
| 15291 | ✗ | } | |
| 15292 | else | ||
| 15293 | { | ||
| 15294 |
5/10✓ Branch 0 taken 69327 times.
✓ Branch 1 taken 964 times.
✓ Branch 2 taken 69327 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 69327 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 69327 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
70291 | if(charging==0 && spins==0 && action != sideswimattacking && !(IsSideSwim() && get_qr(qr_SIDESWIMDIR))) |
| 15295 | { | ||
| 15296 | 69327 | dir=up; | |
| 15297 | 69327 | } | |
| 15298 | |||
| 15299 | 70291 | holddir=up; | |
| 15300 | |||
| 15301 |
4/4✓ Branch 0 taken 9160 times.
✓ Branch 1 taken 61131 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 9158 times.
|
70291 | if(DrunkRight()&&shiftdir!=left) |
| 15302 | { | ||
| 15303 | 9158 | shiftdir=right; | |
| 15304 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 9158 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
9158 | if (IsSideSwim() && get_qr(qr_SIDESWIMDIR) && (charging==0 && spins==0)) dir = right; |
| 15305 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 9158 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
9158 | if (!IsSideSwim() || (charging==0 && spins==0)) sideswimdir = right; |
| 15306 | 9158 | } | |
| 15307 |
4/4✓ Branch 0 taken 8603 times.
✓ Branch 1 taken 52530 times.
✓ Branch 2 taken 9 times.
✓ Branch 3 taken 8594 times.
|
61133 | else if(DrunkLeft()&&shiftdir!=right) |
| 15308 | { | ||
| 15309 | 8594 | shiftdir=left; | |
| 15310 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 8594 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
8594 | if (IsSideSwim() && get_qr(qr_SIDESWIMDIR) && (charging==0 && spins==0)) dir = left; |
| 15311 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 8594 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
8594 | if (!IsSideSwim() || (charging==0 && spins==0)) sideswimdir = left; |
| 15312 | 8594 | } | |
| 15313 | else | ||
| 15314 | { | ||
| 15315 | 52539 | shiftdir=-1; | |
| 15316 | } | ||
| 15317 | |||
| 15318 | //walkable if Ladder can be placed or is already placed vertically | ||
| 15319 |
1/18✗ Branch 0 not taken.
✓ Branch 1 taken 70291 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
70291 | if(isSideViewHero() && !toogam && !((can_deploy_ladder() && get_qr(qr_OLD_LADDER_ITEM_SIDEVIEW)) || (ladderx && laddery && ladderdir==up)) && !getOnSideviewLadder() && action != sideswimming && action != sideswimhit && action != sideswimattacking) |
| 15320 | { | ||
| 15321 | ✗ | walkable=false; | |
| 15322 | ✗ | } | |
| 15323 | else | ||
| 15324 | { | ||
| 15325 |
4/8✗ Branch 0 not taken.
✓ Branch 1 taken 70291 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 70287 times.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
|
70291 | if ((get_qr(qr_OLD_LADDER_ITEM_SIDEVIEW) && can_deploy_ladder()) || (ladderx && laddery && ladderdir==up)) justmoved = 2; //Prevent the slope-snap code from running |
| 15326 | 70291 | do | |
| 15327 | { | ||
| 15328 | 81819 | zfix ty = y - hero_newstep; | |
| 15329 | 163638 | info = walkflag(x,(bigHitbox?0:8) + ty,2,up) | |
| 15330 | 81819 | || walkflag(x+15,(bigHitbox?0:8) + ty,1,up); | |
| 15331 | |||
| 15332 |
3/4✓ Branch 0 taken 287 times.
✓ Branch 1 taken 81532 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 287 times.
|
81819 | if (ty < 0 && !bigHitbox) //sanity check for up scroll |
| 15333 | { | ||
| 15334 | 287 | info = info || walkflag(x, 0_zf, 2, up); | |
| 15335 | 287 | info = info || walkflag(x+15, 0_zf, 1, up); | |
| 15336 | 287 | } | |
| 15337 | 81819 | info = info || walkflagMBlock(x+15, (bigHitbox?0:8) + ty); | |
| 15338 | |||
| 15339 | 81819 | execute(info); | |
| 15340 | |||
| 15341 |
2/2✓ Branch 0 taken 22065 times.
✓ Branch 1 taken 59754 times.
|
81819 | if(info.isUnwalkable()) |
| 15342 | { | ||
| 15343 |
2/2✓ Branch 0 taken 991 times.
✓ Branch 1 taken 21074 times.
|
22065 | if(y != y.getInt()) |
| 15344 | { | ||
| 15345 | 991 | y.doRound(); | |
| 15346 | 991 | } | |
| 15347 |
2/2✓ Branch 0 taken 10537 times.
✓ Branch 1 taken 10537 times.
|
21074 | else if(hero_newstep > 1) |
| 15348 | { | ||
| 15349 |
1/2✓ Branch 0 taken 10537 times.
✗ Branch 1 not taken.
|
10537 | if(hero_newstep != int32_t(hero_newstep)) //floor |
| 15350 | 10537 | hero_newstep = floor((double)hero_newstep); | |
| 15351 | ✗ | else --hero_newstep; | |
| 15352 | 10537 | } | |
| 15353 | else | ||
| 15354 | 10537 | break; | |
| 15355 | 11528 | } | |
| 15356 | 59754 | else walkable = true; | |
| 15357 |
2/2✓ Branch 0 taken 11528 times.
✓ Branch 1 taken 59754 times.
|
71282 | } |
| 15358 | 71282 | while(!walkable); | |
| 15359 | } | ||
| 15360 | |||
| 15361 | 70291 | int32_t s=shiftdir; | |
| 15362 | |||
| 15363 |
5/6✓ Branch 0 taken 3090 times.
✓ Branch 1 taken 67201 times.
✓ Branch 2 taken 3058 times.
✓ Branch 3 taken 32 times.
✓ Branch 4 taken 3090 times.
✗ Branch 5 not taken.
|
70291 | if(isdungeon() && (y<=26 || y>=134) && !get_qr(qr_FREEFORM)) |
| 15364 | { | ||
| 15365 | ✗ | shiftdir=-1; | |
| 15366 | ✗ | } | |
| 15367 | else | ||
| 15368 | { | ||
| 15369 |
2/2✓ Branch 0 taken 8594 times.
✓ Branch 1 taken 61697 times.
|
70291 | if(s==left) |
| 15370 | { | ||
| 15371 | 8594 | do | |
| 15372 | { | ||
| 15373 | 10018 | info = (walkflag(x-hero_newstep_diag,y+(bigHitbox?0:8),1,left)||walkflag(x-hero_newstep_diag,y+15,1,left)); | |
| 15374 | |||
| 15375 | 10018 | execute(info); | |
| 15376 | |||
| 15377 |
2/2✓ Branch 0 taken 2721 times.
✓ Branch 1 taken 7297 times.
|
10018 | if(info.isUnwalkable()) |
| 15378 | { | ||
| 15379 |
2/2✓ Branch 0 taken 127 times.
✓ Branch 1 taken 2594 times.
|
2721 | if(x != x.getInt()) |
| 15380 | { | ||
| 15381 | 127 | x.doRound(); | |
| 15382 | 127 | } | |
| 15383 |
2/2✓ Branch 0 taken 1297 times.
✓ Branch 1 taken 1297 times.
|
2594 | else if(hero_newstep_diag > 1) |
| 15384 | { | ||
| 15385 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1297 times.
|
1297 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 15386 | 1297 | hero_newstep_diag.doFloor(); | |
| 15387 | ✗ | else --hero_newstep_diag; | |
| 15388 | 1297 | } | |
| 15389 | else | ||
| 15390 | 1297 | shiftdir = -1; | |
| 15391 | 2721 | } | |
| 15392 |
2/2✓ Branch 0 taken 5967 times.
✓ Branch 1 taken 1330 times.
|
7297 | else if(walkable) |
| 15393 | { | ||
| 15394 | 5967 | do | |
| 15395 | { | ||
| 15396 | 5996 | info = walkflag(x-hero_newstep_diag,(bigHitbox?0:8)+(y-hero_newstep),1,left); | |
| 15397 | 5996 | execute(info); | |
| 15398 |
2/2✓ Branch 0 taken 46 times.
✓ Branch 1 taken 5950 times.
|
5996 | if(info.isUnwalkable()) |
| 15399 | { | ||
| 15400 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 34 times.
|
46 | if(x != x.getInt()) |
| 15401 | { | ||
| 15402 | 12 | x.doRound(); | |
| 15403 | 12 | } | |
| 15404 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 17 times.
|
34 | else if(hero_newstep_diag > 1) |
| 15405 | { | ||
| 15406 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 15407 | 17 | hero_newstep_diag.doFloor(); | |
| 15408 | ✗ | else --hero_newstep_diag; | |
| 15409 | 17 | } | |
| 15410 | else | ||
| 15411 | 17 | shiftdir = -1; | |
| 15412 | 46 | } | |
| 15413 | 5950 | else break; | |
| 15414 |
2/2✓ Branch 0 taken 29 times.
✓ Branch 1 taken 17 times.
|
46 | } |
| 15415 | 46 | while(shiftdir != -1); | |
| 15416 | 5967 | break; | |
| 15417 | } | ||
| 15418 | 1330 | else break; | |
| 15419 |
2/2✓ Branch 0 taken 1424 times.
✓ Branch 1 taken 1297 times.
|
2721 | } |
| 15420 | 2721 | while(shiftdir != -1); | |
| 15421 | 8594 | } | |
| 15422 |
2/2✓ Branch 0 taken 52539 times.
✓ Branch 1 taken 9158 times.
|
61697 | else if(s==right) |
| 15423 | { | ||
| 15424 | 9158 | do | |
| 15425 | { | ||
| 15426 | 10732 | info = (walkflag(x+15+hero_newstep_diag,y+(bigHitbox?0:8),1,right)||walkflag(x+15+hero_newstep_diag,y+15,1,right)); | |
| 15427 | |||
| 15428 | 10732 | execute(info); | |
| 15429 | |||
| 15430 |
2/2✓ Branch 0 taken 3002 times.
✓ Branch 1 taken 7730 times.
|
10732 | if(info.isUnwalkable()) |
| 15431 | { | ||
| 15432 |
2/2✓ Branch 0 taken 124 times.
✓ Branch 1 taken 2878 times.
|
3002 | if(x != x.getInt()) |
| 15433 | { | ||
| 15434 | 124 | x.doRound(); | |
| 15435 | 124 | } | |
| 15436 |
2/2✓ Branch 0 taken 1450 times.
✓ Branch 1 taken 1428 times.
|
2878 | else if(hero_newstep_diag > 1) |
| 15437 | { | ||
| 15438 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1450 times.
|
1450 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 15439 | 1450 | hero_newstep_diag.doFloor(); | |
| 15440 | ✗ | else --hero_newstep_diag; | |
| 15441 | 1450 | } | |
| 15442 | else | ||
| 15443 | 1428 | shiftdir = -1; | |
| 15444 | 3002 | } | |
| 15445 |
2/2✓ Branch 0 taken 6443 times.
✓ Branch 1 taken 1287 times.
|
7730 | else if(walkable) |
| 15446 | { | ||
| 15447 | 6443 | do | |
| 15448 | { | ||
| 15449 | 6465 | info = walkflag(x+15+hero_newstep_diag,(bigHitbox?0:8)+(y-hero_newstep),1,right); | |
| 15450 | 6465 | execute(info); | |
| 15451 |
2/2✓ Branch 0 taken 36 times.
✓ Branch 1 taken 6429 times.
|
6465 | if(info.isUnwalkable()) |
| 15452 | { | ||
| 15453 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 29 times.
|
36 | if(x != x.getInt()) |
| 15454 | { | ||
| 15455 | 7 | x.doRound(); | |
| 15456 | 7 | } | |
| 15457 |
2/2✓ Branch 0 taken 15 times.
✓ Branch 1 taken 14 times.
|
29 | else if(hero_newstep_diag > 1) |
| 15458 | { | ||
| 15459 |
1/2✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
|
15 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 15460 | 15 | hero_newstep_diag.doFloor(); | |
| 15461 | ✗ | else --hero_newstep_diag; | |
| 15462 | 15 | } | |
| 15463 | else | ||
| 15464 | 14 | shiftdir = -1; | |
| 15465 | 36 | } | |
| 15466 | 6429 | else break; | |
| 15467 |
2/2✓ Branch 0 taken 22 times.
✓ Branch 1 taken 14 times.
|
36 | } |
| 15468 | 36 | while(shiftdir != -1); | |
| 15469 | 6443 | break; | |
| 15470 | } | ||
| 15471 | 1287 | else break; | |
| 15472 |
2/2✓ Branch 0 taken 1574 times.
✓ Branch 1 taken 1428 times.
|
3002 | } |
| 15473 | 3002 | while(shiftdir != -1); | |
| 15474 | 9158 | } | |
| 15475 | } | ||
| 15476 | |||
| 15477 | 70291 | moveOld2(up); | |
| 15478 | 70291 | shiftdir=s; | |
| 15479 | |||
| 15480 |
2/2✓ Branch 0 taken 59754 times.
✓ Branch 1 taken 10537 times.
|
70291 | if(!walkable) |
| 15481 | { | ||
| 15482 |
2/2✓ Branch 0 taken 2995 times.
✓ Branch 1 taken 7542 times.
|
10537 | if(shiftdir==-1) //Corner-shove; prevent being stuck on corners -V |
| 15483 | { | ||
| 15484 | 7542 | x = x.getInt(); | |
| 15485 | 7542 | y = y.getInt(); | |
| 15486 |
6/8✗ Branch 0 not taken.
✓ Branch 1 taken 7542 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7542 times.
✓ Branch 4 taken 5992 times.
✓ Branch 5 taken 1550 times.
✓ Branch 6 taken 522 times.
✓ Branch 7 taken 7020 times.
|
9092 | if(!_walkflag(x,y+(bigHitbox?0:8)-1,1,SWITCHBLOCK_STATE) && |
| 15487 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 1550 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1550 times.
✓ Branch 4 taken 1021 times.
✓ Branch 5 taken 529 times.
|
1550 | !_walkflag(x+8, y+(bigHitbox?0:8)-1,1,SWITCHBLOCK_STATE) && |
| 15488 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 529 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 529 times.
|
529 | _walkflag(x+15,y+(bigHitbox?0:8)-1,1,SWITCHBLOCK_STATE)) |
| 15489 | { | ||
| 15490 |
7/12✓ Branch 0 taken 510 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 510 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 510 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 510 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 510 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 522 times.
|
522 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11),y+(bigHitbox?0:8)-1)) |
| 15491 | 522 | sprite::move((zfix)-1,(zfix)0); | |
| 15492 | 522 | } | |
| 15493 | else | ||
| 15494 | { | ||
| 15495 |
6/8✗ Branch 0 not taken.
✓ Branch 1 taken 7020 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7020 times.
✓ Branch 4 taken 1028 times.
✓ Branch 5 taken 5992 times.
✓ Branch 6 taken 579 times.
✓ Branch 7 taken 6441 times.
|
13012 | if(_walkflag(x, y+(bigHitbox?0:8)-1,1,SWITCHBLOCK_STATE) && |
| 15496 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 5992 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5992 times.
✓ Branch 4 taken 5413 times.
✓ Branch 5 taken 579 times.
|
5992 | !_walkflag(x+7, y+(bigHitbox?0:8)-1,1,SWITCHBLOCK_STATE) && |
| 15497 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 579 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 579 times.
|
579 | !_walkflag(x+15,y+(bigHitbox?0:8)-1,1,SWITCHBLOCK_STATE)) |
| 15498 | { | ||
| 15499 |
7/12✓ Branch 0 taken 572 times.
✓ Branch 1 taken 7 times.
✓ Branch 2 taken 572 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 572 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 572 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 572 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 579 times.
|
579 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4),y+(bigHitbox?0:8)-1)) |
| 15500 | 579 | sprite::move((zfix)1,(zfix)0); | |
| 15501 | 579 | } | |
| 15502 | else | ||
| 15503 | { | ||
| 15504 | 6441 | pushing=push+1; | |
| 15505 | } | ||
| 15506 | } | ||
| 15507 | 7542 | } | |
| 15508 | else | ||
| 15509 | { | ||
| 15510 | 2995 | pushing=push+1; // L: This makes solid damage combos and diagonal-triggered Armoses work. | |
| 15511 | } | ||
| 15512 | 10537 | } | |
| 15513 | |||
| 15514 | 70291 | return; | |
| 15515 | } | ||
| 15516 | ✗ | } | |
| 15517 | |||
| 15518 |
6/6✓ Branch 0 taken 87724 times.
✓ Branch 1 taken 349705 times.
✓ Branch 2 taken 84786 times.
✓ Branch 3 taken 2938 times.
✓ Branch 4 taken 64681 times.
✓ Branch 5 taken 20105 times.
|
437429 | if(DrunkDown()&&(holddir==-1||holddir==down)) |
| 15519 | { | ||
| 15520 |
4/8✓ Branch 0 taken 2687 times.
✓ Branch 1 taken 64932 times.
✓ Branch 2 taken 2687 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2687 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
67619 | if(isdungeon() && (x<=26 || x>=214) && !get_qr(qr_FREEFORM) && !toogam) |
| 15521 | { | ||
| 15522 | ✗ | } | |
| 15523 | else | ||
| 15524 | { | ||
| 15525 |
5/10✓ Branch 0 taken 67415 times.
✓ Branch 1 taken 204 times.
✓ Branch 2 taken 67415 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 67415 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 67415 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
67619 | if(charging==0 && spins==0 && action != sideswimattacking && !(IsSideSwim() && get_qr(qr_SIDESWIMDIR))) |
| 15526 | { | ||
| 15527 | 67415 | dir=down; | |
| 15528 | 67415 | } | |
| 15529 | |||
| 15530 | 67619 | holddir=down; | |
| 15531 | |||
| 15532 |
4/4✓ Branch 0 taken 9849 times.
✓ Branch 1 taken 57770 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 9843 times.
|
67619 | if(DrunkRight()&&shiftdir!=left) |
| 15533 | { | ||
| 15534 | 9843 | shiftdir=right; | |
| 15535 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 9843 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
9843 | if (IsSideSwim() && get_qr(qr_SIDESWIMDIR) && (charging==0 && spins==0)) dir = right; |
| 15536 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 9843 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
9843 | if (!IsSideSwim() || (charging==0 && spins==0)) sideswimdir = right; |
| 15537 | 9843 | } | |
| 15538 |
4/4✓ Branch 0 taken 10829 times.
✓ Branch 1 taken 46947 times.
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 10821 times.
|
57776 | else if(DrunkLeft()&&shiftdir!=right) |
| 15539 | { | ||
| 15540 | 10821 | shiftdir=left; | |
| 15541 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 10821 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
10821 | if (IsSideSwim() && get_qr(qr_SIDESWIMDIR) && (charging==0 && spins==0)) dir = left; |
| 15542 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 10821 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
10821 | if (!IsSideSwim() || (charging==0 && spins==0)) sideswimdir = left; |
| 15543 | 10821 | } | |
| 15544 | else | ||
| 15545 | { | ||
| 15546 | 46955 | shiftdir=-1; | |
| 15547 | } | ||
| 15548 | |||
| 15549 | //bool walkable; | ||
| 15550 |
1/12✗ Branch 0 not taken.
✓ Branch 1 taken 67619 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
67619 | if(isSideViewHero() && !toogam && !getOnSideviewLadder() && action != sideswimming && action != sideswimhit && action != sideswimattacking) |
| 15551 | { | ||
| 15552 | ✗ | walkable=false; | |
| 15553 | ✗ | } | |
| 15554 | else | ||
| 15555 | { | ||
| 15556 | 67619 | do | |
| 15557 | { | ||
| 15558 | 76878 | info = walkflag(x,15+(y+hero_newstep),2,down); | |
| 15559 | |||
| 15560 |
2/2✓ Branch 0 taken 46006 times.
✓ Branch 1 taken 30872 times.
|
76878 | if(x.getFloor() & 7) |
| 15561 | 46006 | info = info || walkflag(x+15,15+(y+hero_newstep),1,down); | |
| 15562 | else | ||
| 15563 | 30872 | info = info || walkflagMBlock(x+15, 15+(y+hero_newstep)); | |
| 15564 | |||
| 15565 | 76878 | execute(info); | |
| 15566 | |||
| 15567 |
2/2✓ Branch 0 taken 17507 times.
✓ Branch 1 taken 59371 times.
|
76878 | if(info.isUnwalkable()) |
| 15568 | { | ||
| 15569 |
2/2✓ Branch 0 taken 811 times.
✓ Branch 1 taken 16696 times.
|
17507 | if(y != y.getInt()) |
| 15570 | { | ||
| 15571 | 811 | y.doRound(); | |
| 15572 | 811 | } | |
| 15573 |
2/2✓ Branch 0 taken 8448 times.
✓ Branch 1 taken 8248 times.
|
16696 | else if(hero_newstep > 1) |
| 15574 | { | ||
| 15575 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8448 times.
|
8448 | if(hero_newstep != int32_t(hero_newstep)) //floor |
| 15576 | 8448 | hero_newstep = floor((double)hero_newstep); | |
| 15577 | ✗ | else --hero_newstep; | |
| 15578 | 8448 | } | |
| 15579 | else | ||
| 15580 | 8248 | break; | |
| 15581 | 9259 | } | |
| 15582 | 59371 | else walkable = true; | |
| 15583 |
2/2✓ Branch 0 taken 9259 times.
✓ Branch 1 taken 59371 times.
|
68630 | } |
| 15584 | 68630 | while(!walkable); | |
| 15585 | } | ||
| 15586 | |||
| 15587 | 67619 | int32_t s=shiftdir; | |
| 15588 | |||
| 15589 |
5/6✓ Branch 0 taken 2687 times.
✓ Branch 1 taken 64932 times.
✓ Branch 2 taken 2685 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2687 times.
✗ Branch 5 not taken.
|
67619 | if(isdungeon() && (y<=26 || y>=134) && !get_qr(qr_FREEFORM)) |
| 15590 | { | ||
| 15591 | ✗ | shiftdir=-1; | |
| 15592 | ✗ | } | |
| 15593 | else | ||
| 15594 | { | ||
| 15595 |
2/2✓ Branch 0 taken 10821 times.
✓ Branch 1 taken 56798 times.
|
67619 | if(s==left) |
| 15596 | { | ||
| 15597 | 10821 | do | |
| 15598 | { | ||
| 15599 | 12380 | info = (walkflag(x-hero_newstep_diag,y+(bigHitbox?0:8),1,left)||walkflag(x-hero_newstep_diag,y+15,1,left)); | |
| 15600 | |||
| 15601 | 12380 | execute(info); | |
| 15602 | |||
| 15603 |
2/2✓ Branch 0 taken 2934 times.
✓ Branch 1 taken 9446 times.
|
12380 | if(info.isUnwalkable()) |
| 15604 | { | ||
| 15605 |
2/2✓ Branch 0 taken 184 times.
✓ Branch 1 taken 2750 times.
|
2934 | if(x != x.getInt()) |
| 15606 | { | ||
| 15607 | 184 | x.doRound(); | |
| 15608 | 184 | } | |
| 15609 |
2/2✓ Branch 0 taken 1375 times.
✓ Branch 1 taken 1375 times.
|
2750 | else if(hero_newstep_diag > 1) |
| 15610 | { | ||
| 15611 |
1/2✓ Branch 0 taken 1375 times.
✗ Branch 1 not taken.
|
1375 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 15612 | 1375 | hero_newstep_diag.doFloor(); | |
| 15613 | ✗ | else --hero_newstep_diag; | |
| 15614 | 1375 | } | |
| 15615 | else | ||
| 15616 | 1375 | shiftdir = -1; | |
| 15617 | 2934 | } | |
| 15618 |
2/2✓ Branch 0 taken 7871 times.
✓ Branch 1 taken 1575 times.
|
9446 | else if(walkable) |
| 15619 | { | ||
| 15620 | 7871 | do | |
| 15621 | { | ||
| 15622 | 7911 | info = walkflag(x-hero_newstep_diag,15+(y+hero_newstep),1,left); | |
| 15623 | 7911 | execute(info); | |
| 15624 |
2/2✓ Branch 0 taken 55 times.
✓ Branch 1 taken 7856 times.
|
7911 | if(info.isUnwalkable()) |
| 15625 | { | ||
| 15626 |
2/2✓ Branch 0 taken 25 times.
✓ Branch 1 taken 30 times.
|
55 | if(x != x.getInt()) |
| 15627 | { | ||
| 15628 | 25 | x.doRound(); | |
| 15629 | 25 | } | |
| 15630 |
2/2✓ Branch 0 taken 15 times.
✓ Branch 1 taken 15 times.
|
30 | else if(hero_newstep_diag > 1) |
| 15631 | { | ||
| 15632 |
1/2✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
|
15 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 15633 | 15 | hero_newstep_diag.doFloor(); | |
| 15634 | ✗ | else --hero_newstep_diag; | |
| 15635 | 15 | } | |
| 15636 | else | ||
| 15637 | 15 | shiftdir = -1; | |
| 15638 | 55 | } | |
| 15639 | 7856 | else break; | |
| 15640 |
2/2✓ Branch 0 taken 40 times.
✓ Branch 1 taken 15 times.
|
55 | } |
| 15641 | 55 | while(shiftdir != -1); | |
| 15642 | 7871 | break; | |
| 15643 | } | ||
| 15644 | 1575 | else break; | |
| 15645 |
2/2✓ Branch 0 taken 1559 times.
✓ Branch 1 taken 1375 times.
|
2934 | } |
| 15646 | 2934 | while(shiftdir != -1); | |
| 15647 | 10821 | } | |
| 15648 |
2/2✓ Branch 0 taken 46955 times.
✓ Branch 1 taken 9843 times.
|
56798 | else if(s==right) |
| 15649 | { | ||
| 15650 | 9843 | do | |
| 15651 | { | ||
| 15652 | 11188 | info = (walkflag(x+15+hero_newstep_diag,y+(bigHitbox?0:8),1,right)||walkflag(x+15+hero_newstep_diag,y+15,1,right)); | |
| 15653 | |||
| 15654 | 11188 | execute(info); | |
| 15655 | |||
| 15656 |
2/2✓ Branch 0 taken 2594 times.
✓ Branch 1 taken 8594 times.
|
11188 | if(info.isUnwalkable()) |
| 15657 | { | ||
| 15658 |
2/2✓ Branch 0 taken 90 times.
✓ Branch 1 taken 2504 times.
|
2594 | if(x != x.getInt()) |
| 15659 | { | ||
| 15660 | 90 | x.doRound(); | |
| 15661 | 90 | } | |
| 15662 |
2/2✓ Branch 0 taken 1255 times.
✓ Branch 1 taken 1249 times.
|
2504 | else if(hero_newstep_diag > 1) |
| 15663 | { | ||
| 15664 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1255 times.
|
1255 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 15665 | 1255 | hero_newstep_diag.doFloor(); | |
| 15666 | ✗ | else --hero_newstep_diag; | |
| 15667 | 1255 | } | |
| 15668 | else | ||
| 15669 | 1249 | shiftdir = -1; | |
| 15670 | 2594 | } | |
| 15671 |
2/2✓ Branch 0 taken 6976 times.
✓ Branch 1 taken 1618 times.
|
8594 | else if(walkable) |
| 15672 | { | ||
| 15673 | 6976 | do | |
| 15674 | { | ||
| 15675 | 7022 | info = walkflag(x+15+hero_newstep_diag,15+(y+hero_newstep),1,right); | |
| 15676 | 7022 | execute(info); | |
| 15677 |
2/2✓ Branch 0 taken 75 times.
✓ Branch 1 taken 6947 times.
|
7022 | if(info.isUnwalkable()) |
| 15678 | { | ||
| 15679 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 58 times.
|
75 | if(x != x.getInt()) |
| 15680 | { | ||
| 15681 | 17 | x.doRound(); | |
| 15682 | 17 | } | |
| 15683 |
2/2✓ Branch 0 taken 29 times.
✓ Branch 1 taken 29 times.
|
58 | else if(hero_newstep_diag > 1) |
| 15684 | { | ||
| 15685 |
1/2✓ Branch 0 taken 29 times.
✗ Branch 1 not taken.
|
29 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 15686 | 29 | hero_newstep_diag.doFloor(); | |
| 15687 | ✗ | else --hero_newstep_diag; | |
| 15688 | 29 | } | |
| 15689 | else | ||
| 15690 | 29 | shiftdir = -1; | |
| 15691 | 75 | } | |
| 15692 | 6947 | else break; | |
| 15693 |
2/2✓ Branch 0 taken 46 times.
✓ Branch 1 taken 29 times.
|
75 | } |
| 15694 | 75 | while(shiftdir != -1); | |
| 15695 | 6976 | break; | |
| 15696 | } | ||
| 15697 | 1618 | else break; | |
| 15698 |
2/2✓ Branch 0 taken 1345 times.
✓ Branch 1 taken 1249 times.
|
2594 | } |
| 15699 | 2594 | while(shiftdir != -1); | |
| 15700 | 9843 | } | |
| 15701 | } | ||
| 15702 | |||
| 15703 | 67619 | moveOld2(down); | |
| 15704 | 67619 | shiftdir=s; | |
| 15705 | |||
| 15706 |
2/2✓ Branch 0 taken 59371 times.
✓ Branch 1 taken 8248 times.
|
67619 | if(!walkable) |
| 15707 | { | ||
| 15708 |
2/2✓ Branch 0 taken 3454 times.
✓ Branch 1 taken 4794 times.
|
8248 | if(shiftdir==-1) //Corner-shove; prevent being stuck on corners -V |
| 15709 | { | ||
| 15710 | 4794 | x = x.getInt(); | |
| 15711 | 4794 | y = y.getInt(); | |
| 15712 |
6/8✗ Branch 0 not taken.
✓ Branch 1 taken 4794 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4794 times.
✓ Branch 4 taken 3564 times.
✓ Branch 5 taken 1230 times.
✓ Branch 6 taken 515 times.
✓ Branch 7 taken 4279 times.
|
6024 | if(!_walkflag(x, y+15+1,1,SWITCHBLOCK_STATE)&& |
| 15713 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 1230 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1230 times.
✓ Branch 4 taken 698 times.
✓ Branch 5 taken 532 times.
|
1230 | !_walkflag(x+8, y+15+1,1,SWITCHBLOCK_STATE)&& |
| 15714 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 532 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 532 times.
|
532 | _walkflag(x+15,y+15+1,1,SWITCHBLOCK_STATE)) |
| 15715 | { | ||
| 15716 |
9/12✓ Branch 0 taken 511 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 511 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 511 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 507 times.
✓ Branch 7 taken 4 times.
✓ Branch 8 taken 507 times.
✓ Branch 9 taken 4 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 515 times.
|
515 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11),y+15+1)) |
| 15717 | 515 | sprite::move((zfix)-1,(zfix)0); | |
| 15718 | 515 | } | |
| 15719 |
6/8✗ Branch 0 not taken.
✓ Branch 1 taken 4279 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4279 times.
✓ Branch 4 taken 715 times.
✓ Branch 5 taken 3564 times.
✓ Branch 6 taken 505 times.
✓ Branch 7 taken 3774 times.
|
7843 | else if(_walkflag(x, y+15+1,1,SWITCHBLOCK_STATE)&& |
| 15720 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 3564 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3564 times.
✓ Branch 4 taken 3059 times.
✓ Branch 5 taken 505 times.
|
3564 | !_walkflag(x+7, y+15+1,1,SWITCHBLOCK_STATE)&& |
| 15721 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 505 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 505 times.
|
505 | !_walkflag(x+15,y+15+1,1,SWITCHBLOCK_STATE)) |
| 15722 | { | ||
| 15723 |
7/12✓ Branch 0 taken 499 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 499 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 499 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 499 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 499 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 505 times.
|
505 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4),y+15+1)) |
| 15724 | 505 | sprite::move((zfix)1,(zfix)0); | |
| 15725 | 505 | } | |
| 15726 | else | ||
| 15727 | { | ||
| 15728 | 3774 | pushing=push+1; | |
| 15729 | } | ||
| 15730 | 4794 | } | |
| 15731 | else | ||
| 15732 | { | ||
| 15733 | 3454 | pushing=push+1; // L: This makes solid damage combos and diagonal-triggered Armoses work. | |
| 15734 | } | ||
| 15735 | 8248 | } | |
| 15736 | |||
| 15737 | 67619 | return; | |
| 15738 | } | ||
| 15739 | ✗ | } | |
| 15740 | |||
| 15741 |
6/6✓ Branch 0 taken 93361 times.
✓ Branch 1 taken 276449 times.
✓ Branch 2 taken 90070 times.
✓ Branch 3 taken 3291 times.
✓ Branch 4 taken 89971 times.
✓ Branch 5 taken 99 times.
|
369810 | if(DrunkLeft()&&(holddir==-1||holddir==left)) |
| 15742 | { | ||
| 15743 |
5/8✓ Branch 0 taken 2992 times.
✓ Branch 1 taken 90270 times.
✓ Branch 2 taken 2945 times.
✓ Branch 3 taken 47 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2992 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
93262 | if(isdungeon() && (y<=26 || y>=134) && !get_qr(qr_FREEFORM) && !toogam) |
| 15744 | { | ||
| 15745 | ✗ | } | |
| 15746 | else | ||
| 15747 | { | ||
| 15748 |
4/6✓ Branch 0 taken 92863 times.
✓ Branch 1 taken 399 times.
✓ Branch 2 taken 92863 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 92863 times.
|
93262 | if(charging==0 && spins==0 && action != sideswimattacking) |
| 15749 | { | ||
| 15750 | 92863 | dir=left; | |
| 15751 | 92863 | } | |
| 15752 | 93262 | sideswimdir = left; | |
| 15753 | |||
| 15754 | 93262 | holddir=left; | |
| 15755 | |||
| 15756 |
4/4✓ Branch 0 taken 11555 times.
✓ Branch 1 taken 81707 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 11554 times.
|
93262 | if(DrunkUp()&&shiftdir!=down) |
| 15757 | { | ||
| 15758 | 11554 | shiftdir=up; | |
| 15759 | 11554 | } | |
| 15760 |
4/4✓ Branch 0 taken 10348 times.
✓ Branch 1 taken 71360 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 10346 times.
|
81708 | else if(DrunkDown()&&shiftdir!=up) |
| 15761 | { | ||
| 15762 | 10346 | shiftdir=down; | |
| 15763 | 10346 | } | |
| 15764 | else | ||
| 15765 | { | ||
| 15766 | 71362 | shiftdir=-1; | |
| 15767 | } | ||
| 15768 | |||
| 15769 | 93262 | do | |
| 15770 | { | ||
| 15771 | 103105 | info = walkflag(x-hero_newstep,y+(bigHitbox?0:8),1,left)||walkflag(x-hero_newstep,y+8,1,left); | |
| 15772 | |||
| 15773 | 103105 | info = info || walkflag(x-hero_newstep,y+15,1,left); | |
| 15774 | |||
| 15775 | 103105 | execute(info); | |
| 15776 | |||
| 15777 |
2/2✓ Branch 0 taken 18840 times.
✓ Branch 1 taken 84265 times.
|
103105 | if(info.isUnwalkable()) |
| 15778 | { | ||
| 15779 |
2/2✓ Branch 0 taken 848 times.
✓ Branch 1 taken 17992 times.
|
18840 | if(x != x.getInt()) |
| 15780 | { | ||
| 15781 | 848 | x.doRound(); | |
| 15782 | 848 | } | |
| 15783 |
2/2✓ Branch 0 taken 8995 times.
✓ Branch 1 taken 8997 times.
|
17992 | else if(hero_newstep > 1) |
| 15784 | { | ||
| 15785 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8995 times.
|
8995 | if(hero_newstep != int32_t(hero_newstep)) //floor |
| 15786 | 8995 | hero_newstep = floor((double)hero_newstep); | |
| 15787 | ✗ | else --hero_newstep; | |
| 15788 | 8995 | } | |
| 15789 | else | ||
| 15790 | 8997 | break; | |
| 15791 | 9843 | } | |
| 15792 | 84265 | else walkable = true; | |
| 15793 |
2/2✓ Branch 0 taken 9843 times.
✓ Branch 1 taken 84265 times.
|
94108 | } |
| 15794 | 94108 | while(!walkable); | |
| 15795 | |||
| 15796 | 93262 | int32_t s=shiftdir; | |
| 15797 | |||
| 15798 |
10/14✓ Branch 0 taken 2992 times.
✓ Branch 1 taken 90270 times.
✓ Branch 2 taken 2948 times.
✓ Branch 3 taken 44 times.
✓ Branch 4 taken 2992 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 894 times.
✓ Branch 7 taken 92368 times.
✓ Branch 8 taken 894 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 894 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 894 times.
✗ Branch 13 not taken.
|
93262 | if((isdungeon() && (x<=26 || x>=214) && !get_qr(qr_FREEFORM)) || (isSideViewHero() && !getOnSideviewLadder() && action != sideswimming && action != sideswimhit && action != sideswimattacking)) |
| 15799 | { | ||
| 15800 | 894 | shiftdir=-1; | |
| 15801 | 894 | } | |
| 15802 | else | ||
| 15803 | { | ||
| 15804 |
2/2✓ Branch 0 taken 80814 times.
✓ Branch 1 taken 11554 times.
|
92368 | if(s==up) |
| 15805 | { | ||
| 15806 | 11554 | do | |
| 15807 | { | ||
| 15808 | 13173 | zfix ty = y - hero_newstep_diag; | |
| 15809 | 26346 | info = walkflag(x,(bigHitbox?0:8) + ty,2,up) | |
| 15810 | 13173 | || walkflag(x+15,(bigHitbox?0:8) + ty,1,up); | |
| 15811 | |||
| 15812 |
3/4✓ Branch 0 taken 7 times.
✓ Branch 1 taken 13166 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7 times.
|
13173 | if (ty < 0 && !bigHitbox) //sanity check for up scroll |
| 15813 | { | ||
| 15814 | 7 | info = info || walkflag(x, 0_zf, 2, up); | |
| 15815 | 7 | info = info || walkflag(x+15, 0_zf, 1, up); | |
| 15816 | 7 | } | |
| 15817 | 13173 | info = info || walkflagMBlock(x+15, (bigHitbox?0:8) + ty); | |
| 15818 | |||
| 15819 | 13173 | execute(info); | |
| 15820 | |||
| 15821 |
2/2✓ Branch 0 taken 3045 times.
✓ Branch 1 taken 10128 times.
|
13173 | if(info.isUnwalkable()) |
| 15822 | { | ||
| 15823 |
2/2✓ Branch 0 taken 193 times.
✓ Branch 1 taken 2852 times.
|
3045 | if(y != y.getInt()) |
| 15824 | { | ||
| 15825 | 193 | y.doRound(); | |
| 15826 | 193 | } | |
| 15827 |
2/2✓ Branch 0 taken 1426 times.
✓ Branch 1 taken 1426 times.
|
2852 | else if(hero_newstep_diag > 1) |
| 15828 | { | ||
| 15829 |
1/2✓ Branch 0 taken 1426 times.
✗ Branch 1 not taken.
|
1426 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 15830 | 1426 | hero_newstep_diag.doFloor(); | |
| 15831 | ✗ | else --hero_newstep_diag; | |
| 15832 | 1426 | } | |
| 15833 | else | ||
| 15834 | 1426 | shiftdir = -1; | |
| 15835 | 3045 | } | |
| 15836 |
2/2✓ Branch 0 taken 8472 times.
✓ Branch 1 taken 1656 times.
|
10128 | else if(walkable) |
| 15837 | { | ||
| 15838 | 8472 | do | |
| 15839 | { | ||
| 15840 | 8531 | zfix tx = x-hero_newstep, ty = y-hero_newstep_diag; | |
| 15841 | 8531 | info = walkflag(tx,(bigHitbox?0:8)+ty,1,up); | |
| 15842 | |||
| 15843 |
3/4✓ Branch 0 taken 7 times.
✓ Branch 1 taken 8524 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7 times.
|
8531 | if (ty < 0 && !bigHitbox) //sanity check for up scroll |
| 15844 | { | ||
| 15845 | 7 | info = info || walkflag(tx, 0_zf, 1, up); | |
| 15846 | 7 | info = info || walkflag(tx+15, 0_zf, 1, up); | |
| 15847 | 7 | } | |
| 15848 | 8531 | info = info || walkflagMBlock(tx+15, (bigHitbox?0:8) + ty); | |
| 15849 | |||
| 15850 | 8531 | execute(info); | |
| 15851 |
2/2✓ Branch 0 taken 97 times.
✓ Branch 1 taken 8434 times.
|
8531 | if(info.isUnwalkable()) |
| 15852 | { | ||
| 15853 |
2/2✓ Branch 0 taken 21 times.
✓ Branch 1 taken 76 times.
|
97 | if(y != y.getInt()) |
| 15854 | { | ||
| 15855 | 21 | y.doRound(); | |
| 15856 | 21 | } | |
| 15857 |
2/2✓ Branch 0 taken 38 times.
✓ Branch 1 taken 38 times.
|
76 | else if(hero_newstep_diag > 1) |
| 15858 | { | ||
| 15859 |
1/2✓ Branch 0 taken 38 times.
✗ Branch 1 not taken.
|
38 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 15860 | 38 | hero_newstep_diag.doFloor(); | |
| 15861 | ✗ | else --hero_newstep_diag; | |
| 15862 | 38 | } | |
| 15863 | else | ||
| 15864 | 38 | shiftdir = -1; | |
| 15865 | 97 | } | |
| 15866 | 8434 | else break; | |
| 15867 |
2/2✓ Branch 0 taken 59 times.
✓ Branch 1 taken 38 times.
|
97 | } |
| 15868 | 97 | while(shiftdir != -1); | |
| 15869 | 8472 | break; | |
| 15870 | } | ||
| 15871 | 1656 | else break; | |
| 15872 |
2/2✓ Branch 0 taken 1619 times.
✓ Branch 1 taken 1426 times.
|
3045 | } |
| 15873 | 3045 | while(shiftdir != -1); | |
| 15874 | 11554 | } | |
| 15875 |
2/2✓ Branch 0 taken 70468 times.
✓ Branch 1 taken 10346 times.
|
80814 | else if(s==down) |
| 15876 | { | ||
| 15877 | 10346 | do | |
| 15878 | { | ||
| 15879 | 12334 | info = walkflag(x,y+15+hero_newstep_diag,2,down)||walkflag(x+15,y+15+hero_newstep_diag,1,down); | |
| 15880 | |||
| 15881 | 12334 | execute(info); | |
| 15882 | |||
| 15883 |
2/2✓ Branch 0 taken 3745 times.
✓ Branch 1 taken 8589 times.
|
12334 | if(info.isUnwalkable()) |
| 15884 | { | ||
| 15885 |
2/2✓ Branch 0 taken 191 times.
✓ Branch 1 taken 3554 times.
|
3745 | if(y != y.getInt()) |
| 15886 | { | ||
| 15887 | 191 | y.doRound(); | |
| 15888 | 191 | } | |
| 15889 |
2/2✓ Branch 0 taken 1797 times.
✓ Branch 1 taken 1757 times.
|
3554 | else if(hero_newstep_diag > 1) |
| 15890 | { | ||
| 15891 |
1/2✓ Branch 0 taken 1797 times.
✗ Branch 1 not taken.
|
1797 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 15892 | 1797 | hero_newstep_diag.doFloor(); | |
| 15893 | ✗ | else --hero_newstep_diag; | |
| 15894 | 1797 | } | |
| 15895 | else | ||
| 15896 | 1757 | shiftdir = -1; | |
| 15897 | 3745 | } | |
| 15898 |
2/2✓ Branch 0 taken 7058 times.
✓ Branch 1 taken 1531 times.
|
8589 | else if(walkable) |
| 15899 | { | ||
| 15900 | 7058 | do | |
| 15901 | { | ||
| 15902 | 7074 | info = walkflag(x-hero_newstep,y+15+hero_newstep_diag,1,down); | |
| 15903 | 7074 | execute(info); | |
| 15904 |
2/2✓ Branch 0 taken 28 times.
✓ Branch 1 taken 7046 times.
|
7074 | if(info.isUnwalkable()) |
| 15905 | { | ||
| 15906 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 24 times.
|
28 | if(y != y.getInt()) |
| 15907 | { | ||
| 15908 | 4 | y.doRound(); | |
| 15909 | 4 | } | |
| 15910 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 12 times.
|
24 | else if(hero_newstep_diag > 1) |
| 15911 | { | ||
| 15912 |
1/2✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
|
12 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 15913 | 12 | hero_newstep_diag.doFloor(); | |
| 15914 | ✗ | else --hero_newstep_diag; | |
| 15915 | 12 | } | |
| 15916 | else | ||
| 15917 | 12 | shiftdir = -1; | |
| 15918 | 28 | } | |
| 15919 | 7046 | else break; | |
| 15920 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 12 times.
|
28 | } |
| 15921 | 28 | while(shiftdir != -1); | |
| 15922 | 7058 | break; | |
| 15923 | } | ||
| 15924 | 1531 | else break; | |
| 15925 |
2/2✓ Branch 0 taken 1988 times.
✓ Branch 1 taken 1757 times.
|
3745 | } |
| 15926 | 3745 | while(shiftdir != -1); | |
| 15927 | 10346 | } | |
| 15928 | } | ||
| 15929 | |||
| 15930 | 93262 | moveOld2(left); | |
| 15931 | 93262 | shiftdir=s; | |
| 15932 | |||
| 15933 |
2/2✓ Branch 0 taken 84265 times.
✓ Branch 1 taken 8997 times.
|
93262 | if(!walkable) |
| 15934 | { | ||
| 15935 |
2/2✓ Branch 0 taken 3508 times.
✓ Branch 1 taken 5489 times.
|
8997 | if(shiftdir==-1) //Corner-shove; prevent being stuck on corners -V |
| 15936 | { | ||
| 15937 | 5489 | x = x.getInt(); | |
| 15938 | 5489 | y = y.getInt(); | |
| 15939 | 5489 | int32_t v1=bigHitbox?0:8; | |
| 15940 | 5489 | int32_t v2=bigHitbox?8:12; | |
| 15941 | |||
| 15942 |
6/8✗ Branch 0 not taken.
✓ Branch 1 taken 5489 times.
✓ Branch 2 taken 5489 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4861 times.
✓ Branch 5 taken 628 times.
✓ Branch 6 taken 128 times.
✓ Branch 7 taken 5361 times.
|
6117 | if(!_walkflag(x-1,y+v1,1,SWITCHBLOCK_STATE)&& |
| 15943 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 628 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 628 times.
✓ Branch 4 taken 499 times.
✓ Branch 5 taken 129 times.
|
628 | !_walkflag(x-1,y+v2,1,SWITCHBLOCK_STATE)&& |
| 15944 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 129 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 129 times.
|
129 | _walkflag(x-1,y+15,1,SWITCHBLOCK_STATE)) |
| 15945 | { | ||
| 15946 |
9/12✓ Branch 0 taken 121 times.
✓ Branch 1 taken 7 times.
✓ Branch 2 taken 121 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 121 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 118 times.
✓ Branch 7 taken 3 times.
✓ Branch 8 taken 118 times.
✓ Branch 9 taken 3 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 128 times.
|
128 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x-1,y+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11))) |
| 15947 | 128 | sprite::move((zfix)0,(zfix)-1); | |
| 15948 | 128 | } | |
| 15949 |
6/8✗ Branch 0 not taken.
✓ Branch 1 taken 5361 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5361 times.
✓ Branch 4 taken 500 times.
✓ Branch 5 taken 4861 times.
✓ Branch 6 taken 137 times.
✓ Branch 7 taken 5224 times.
|
10222 | else if(_walkflag(x-1,y+v1, 1,SWITCHBLOCK_STATE)&& |
| 15950 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 4861 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4861 times.
✓ Branch 4 taken 4724 times.
✓ Branch 5 taken 137 times.
|
4861 | !_walkflag(x-1,y+v2-1,1,SWITCHBLOCK_STATE)&& |
| 15951 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 137 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 137 times.
|
137 | !_walkflag(x-1,y+15, 1,SWITCHBLOCK_STATE)) |
| 15952 | { | ||
| 15953 |
7/12✓ Branch 0 taken 136 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 136 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 136 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 136 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 136 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 137 times.
|
137 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x-1,y+v1+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4))) |
| 15954 | 137 | sprite::move((zfix)0,(zfix)1); | |
| 15955 | 137 | } | |
| 15956 | else | ||
| 15957 | { | ||
| 15958 | 5224 | pushing=push+1; | |
| 15959 | } | ||
| 15960 | 5489 | } | |
| 15961 | else | ||
| 15962 | { | ||
| 15963 | 3508 | pushing=push+1; // L: This makes solid damage combos and diagonal-triggered Armoses work. | |
| 15964 | |||
| 15965 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3508 times.
|
3508 | if(action!=swimming) |
| 15966 | { | ||
| 15967 | 3508 | } | |
| 15968 | } | ||
| 15969 | 8997 | } | |
| 15970 | |||
| 15971 | 93262 | return; | |
| 15972 | } | ||
| 15973 | ✗ | } | |
| 15974 | |||
| 15975 |
5/6✓ Branch 0 taken 95437 times.
✓ Branch 1 taken 181111 times.
✓ Branch 2 taken 92065 times.
✓ Branch 3 taken 3372 times.
✓ Branch 4 taken 92065 times.
✗ Branch 5 not taken.
|
276548 | if(DrunkRight()&&(holddir==-1||holddir==right)) |
| 15976 | { | ||
| 15977 |
5/8✓ Branch 0 taken 3423 times.
✓ Branch 1 taken 92014 times.
✓ Branch 2 taken 3321 times.
✓ Branch 3 taken 102 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 3423 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
95437 | if(isdungeon() && (y<=26 || y>=134) && !get_qr(qr_FREEFORM) && !toogam) |
| 15978 | { | ||
| 15979 | ✗ | } | |
| 15980 | else | ||
| 15981 | { | ||
| 15982 |
4/6✓ Branch 0 taken 94735 times.
✓ Branch 1 taken 702 times.
✓ Branch 2 taken 94735 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 94735 times.
|
95437 | if(charging==0 && spins==0 && action != sideswimattacking) |
| 15983 | { | ||
| 15984 | 94735 | dir=right; | |
| 15985 | 94735 | } | |
| 15986 | 95437 | sideswimdir = right; | |
| 15987 | |||
| 15988 | 95437 | holddir=right; | |
| 15989 | |||
| 15990 |
4/4✓ Branch 0 taken 11226 times.
✓ Branch 1 taken 84211 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 11225 times.
|
95437 | if(DrunkUp()&&shiftdir!=down) |
| 15991 | { | ||
| 15992 | 11225 | shiftdir=up; | |
| 15993 | 11225 | } | |
| 15994 |
4/4✓ Branch 0 taken 9753 times.
✓ Branch 1 taken 74459 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 9749 times.
|
84212 | else if(DrunkDown()&&shiftdir!=up) |
| 15995 | { | ||
| 15996 | 9749 | shiftdir=down; | |
| 15997 | 9749 | } | |
| 15998 | else | ||
| 15999 | { | ||
| 16000 | 74463 | shiftdir=-1; | |
| 16001 | } | ||
| 16002 | |||
| 16003 | 95437 | do | |
| 16004 | { | ||
| 16005 | 105997 | info = walkflag(x+15+hero_newstep,y+(bigHitbox?0:8),1,right)||walkflag(x+15+hero_newstep,y+8,1,right);; | |
| 16006 | |||
| 16007 | 105997 | info = info || walkflag(x+15+hero_newstep,y+15,1,right); | |
| 16008 | |||
| 16009 | 105997 | execute(info); | |
| 16010 | |||
| 16011 |
2/2✓ Branch 0 taken 20178 times.
✓ Branch 1 taken 85819 times.
|
105997 | if(info.isUnwalkable()) |
| 16012 | { | ||
| 16013 |
2/2✓ Branch 0 taken 755 times.
✓ Branch 1 taken 19423 times.
|
20178 | if(x != x.getInt()) |
| 16014 | { | ||
| 16015 | 755 | x.doRound(); | |
| 16016 | 755 | } | |
| 16017 |
2/2✓ Branch 0 taken 9805 times.
✓ Branch 1 taken 9618 times.
|
19423 | else if(hero_newstep > 1) |
| 16018 | { | ||
| 16019 |
1/2✓ Branch 0 taken 9805 times.
✗ Branch 1 not taken.
|
9805 | if(hero_newstep != int32_t(hero_newstep)) //floor |
| 16020 | 9805 | hero_newstep = floor((double)hero_newstep); | |
| 16021 | ✗ | else --hero_newstep; | |
| 16022 | 9805 | } | |
| 16023 | else | ||
| 16024 | 9618 | break; | |
| 16025 | 10560 | } | |
| 16026 | 85819 | else walkable = true; | |
| 16027 |
2/2✓ Branch 0 taken 10560 times.
✓ Branch 1 taken 85819 times.
|
96379 | } |
| 16028 | 96379 | while(!walkable); | |
| 16029 | |||
| 16030 | 95437 | int32_t s=shiftdir; | |
| 16031 | |||
| 16032 |
10/14✓ Branch 0 taken 3423 times.
✓ Branch 1 taken 92014 times.
✓ Branch 2 taken 3373 times.
✓ Branch 3 taken 50 times.
✓ Branch 4 taken 3423 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1560 times.
✓ Branch 7 taken 93877 times.
✓ Branch 8 taken 1560 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 1560 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1560 times.
✗ Branch 13 not taken.
|
95437 | if((isdungeon() && (x<=26 || x>=214) && !get_qr(qr_FREEFORM)) || (isSideViewHero() && !getOnSideviewLadder() && action != sideswimming && action != sideswimhit && action != sideswimattacking)) |
| 16033 | { | ||
| 16034 | 1560 | shiftdir=-1; | |
| 16035 | 1560 | } | |
| 16036 | else | ||
| 16037 | { | ||
| 16038 |
2/2✓ Branch 0 taken 82652 times.
✓ Branch 1 taken 11225 times.
|
93877 | if(s==up) |
| 16039 | { | ||
| 16040 | 11225 | do | |
| 16041 | { | ||
| 16042 | 12557 | zfix ty = y - hero_newstep_diag; | |
| 16043 | 25114 | info = walkflag(x,(bigHitbox?0:8) + ty,2,up) | |
| 16044 | 12557 | || walkflag(x+15,(bigHitbox?0:8) + ty,1,up); | |
| 16045 | |||
| 16046 |
3/4✓ Branch 0 taken 7 times.
✓ Branch 1 taken 12550 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7 times.
|
12557 | if (ty < 0 && !bigHitbox) //sanity check for up scroll |
| 16047 | { | ||
| 16048 | 7 | info = info || walkflag(x, 0_zf, 2, up); | |
| 16049 | 7 | info = info || walkflag(x+15, 0_zf, 1, up); | |
| 16050 | 7 | } | |
| 16051 | 12557 | info = info || walkflagMBlock(x+15, (bigHitbox?0:8) + ty); | |
| 16052 | |||
| 16053 | 12557 | execute(info); | |
| 16054 | |||
| 16055 |
2/2✓ Branch 0 taken 2472 times.
✓ Branch 1 taken 10085 times.
|
12557 | if(info.isUnwalkable()) |
| 16056 | { | ||
| 16057 |
2/2✓ Branch 0 taken 192 times.
✓ Branch 1 taken 2280 times.
|
2472 | if(y != y.getInt()) |
| 16058 | { | ||
| 16059 | 192 | y.doRound(); | |
| 16060 | 192 | } | |
| 16061 |
2/2✓ Branch 0 taken 1140 times.
✓ Branch 1 taken 1140 times.
|
2280 | else if(hero_newstep_diag > 1) |
| 16062 | { | ||
| 16063 |
1/2✓ Branch 0 taken 1140 times.
✗ Branch 1 not taken.
|
1140 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 16064 | 1140 | hero_newstep_diag.doFloor(); | |
| 16065 | ✗ | else --hero_newstep_diag; | |
| 16066 | 1140 | } | |
| 16067 | else | ||
| 16068 | 1140 | shiftdir = -1; | |
| 16069 | 2472 | } | |
| 16070 |
2/2✓ Branch 0 taken 8780 times.
✓ Branch 1 taken 1305 times.
|
10085 | else if(walkable) |
| 16071 | { | ||
| 16072 | 8780 | do | |
| 16073 | { | ||
| 16074 | 8828 | zfix tx = x+hero_newstep, ty = y-hero_newstep_diag; | |
| 16075 | 8828 | info = walkflag(tx+15,(bigHitbox?0:8)+ty,1,up); | |
| 16076 | |||
| 16077 |
3/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 8823 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
|
8828 | if (ty < 0 && !bigHitbox) //sanity check for up scroll |
| 16078 | { | ||
| 16079 | 5 | info = info || walkflag(tx, 0_zf, 1, up); | |
| 16080 | 5 | info = info || walkflag(tx+15, 0_zf, 1, up); | |
| 16081 | 5 | } | |
| 16082 | 8828 | info = info || walkflagMBlock(tx+15, (bigHitbox?0:8) + ty); | |
| 16083 | 8828 | execute(info); | |
| 16084 |
2/2✓ Branch 0 taken 75 times.
✓ Branch 1 taken 8753 times.
|
8828 | if(info.isUnwalkable()) |
| 16085 | { | ||
| 16086 |
2/2✓ Branch 0 taken 21 times.
✓ Branch 1 taken 54 times.
|
75 | if(y != y.getInt()) |
| 16087 | { | ||
| 16088 | 21 | y.doRound(); | |
| 16089 | 21 | } | |
| 16090 |
2/2✓ Branch 0 taken 27 times.
✓ Branch 1 taken 27 times.
|
54 | else if(hero_newstep_diag > 1) |
| 16091 | { | ||
| 16092 |
1/2✓ Branch 0 taken 27 times.
✗ Branch 1 not taken.
|
27 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 16093 | 27 | hero_newstep_diag.doFloor(); | |
| 16094 | ✗ | else --hero_newstep_diag; | |
| 16095 | 27 | } | |
| 16096 | else | ||
| 16097 | 27 | shiftdir = -1; | |
| 16098 | 75 | } | |
| 16099 | 8753 | else break; | |
| 16100 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 27 times.
|
75 | } |
| 16101 | 75 | while(shiftdir != -1); | |
| 16102 | 8780 | break; | |
| 16103 | } | ||
| 16104 | 1305 | else break; | |
| 16105 |
2/2✓ Branch 0 taken 1332 times.
✓ Branch 1 taken 1140 times.
|
2472 | } |
| 16106 | 2472 | while(shiftdir != -1); | |
| 16107 | 11225 | } | |
| 16108 |
2/2✓ Branch 0 taken 72903 times.
✓ Branch 1 taken 9749 times.
|
82652 | else if(s==down) |
| 16109 | { | ||
| 16110 | 9749 | do | |
| 16111 | { | ||
| 16112 | 11446 | info = walkflag(x,y+15+hero_newstep_diag,2,down)||walkflag(x+15,y+15+hero_newstep_diag,1,down); | |
| 16113 | |||
| 16114 | 11446 | execute(info); | |
| 16115 | |||
| 16116 |
2/2✓ Branch 0 taken 3151 times.
✓ Branch 1 taken 8295 times.
|
11446 | if(info.isUnwalkable()) |
| 16117 | { | ||
| 16118 |
2/2✓ Branch 0 taken 201 times.
✓ Branch 1 taken 2950 times.
|
3151 | if(y != y.getInt()) |
| 16119 | { | ||
| 16120 | 201 | y.doRound(); | |
| 16121 | 201 | } | |
| 16122 |
2/2✓ Branch 0 taken 1496 times.
✓ Branch 1 taken 1454 times.
|
2950 | else if(hero_newstep_diag > 1) |
| 16123 | { | ||
| 16124 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1496 times.
|
1496 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 16125 | 1496 | hero_newstep_diag.doFloor(); | |
| 16126 | ✗ | else --hero_newstep_diag; | |
| 16127 | 1496 | } | |
| 16128 | else | ||
| 16129 | 1454 | shiftdir = -1; | |
| 16130 | 3151 | } | |
| 16131 |
2/2✓ Branch 0 taken 6964 times.
✓ Branch 1 taken 1331 times.
|
8295 | else if(walkable) |
| 16132 | { | ||
| 16133 | 6964 | do | |
| 16134 | { | ||
| 16135 | 6997 | info = walkflag(x+15+hero_newstep,y+15+hero_newstep_diag,1,down); | |
| 16136 | 6997 | execute(info); | |
| 16137 |
2/2✓ Branch 0 taken 54 times.
✓ Branch 1 taken 6943 times.
|
6997 | if(info.isUnwalkable()) |
| 16138 | { | ||
| 16139 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 44 times.
|
54 | if(y != y.getInt()) |
| 16140 | { | ||
| 16141 | 10 | y.doRound(); | |
| 16142 | 10 | } | |
| 16143 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 21 times.
|
44 | else if(hero_newstep_diag > 1) |
| 16144 | { | ||
| 16145 |
1/2✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
|
23 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 16146 | 23 | hero_newstep_diag.doFloor(); | |
| 16147 | ✗ | else --hero_newstep_diag; | |
| 16148 | 23 | } | |
| 16149 | else | ||
| 16150 | 21 | shiftdir = -1; | |
| 16151 | 54 | } | |
| 16152 | 6943 | else break; | |
| 16153 |
2/2✓ Branch 0 taken 33 times.
✓ Branch 1 taken 21 times.
|
54 | } |
| 16154 | 54 | while(shiftdir != -1); | |
| 16155 | 6964 | break; | |
| 16156 | } | ||
| 16157 | 1331 | else break; | |
| 16158 |
2/2✓ Branch 0 taken 1697 times.
✓ Branch 1 taken 1454 times.
|
3151 | } |
| 16159 | 3151 | while(shiftdir != -1); | |
| 16160 | 9749 | } | |
| 16161 | } | ||
| 16162 | |||
| 16163 | 95437 | moveOld2(right); | |
| 16164 | 95437 | shiftdir=s; | |
| 16165 | |||
| 16166 |
2/2✓ Branch 0 taken 85819 times.
✓ Branch 1 taken 9618 times.
|
95437 | if(!walkable) |
| 16167 | { | ||
| 16168 |
2/2✓ Branch 0 taken 2861 times.
✓ Branch 1 taken 6757 times.
|
9618 | if(shiftdir==-1) //Corner-shove; prevent being stuck on corners -V |
| 16169 | { | ||
| 16170 | 6757 | x = x.getInt(); | |
| 16171 | 6757 | y = y.getInt(); | |
| 16172 | 6757 | int32_t v1=bigHitbox?0:8; | |
| 16173 | 6757 | int32_t v2=bigHitbox?8:12; | |
| 16174 | |||
| 16175 |
6/8✗ Branch 0 not taken.
✓ Branch 1 taken 6757 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6757 times.
✓ Branch 4 taken 5880 times.
✓ Branch 5 taken 877 times.
✓ Branch 6 taken 210 times.
✓ Branch 7 taken 6547 times.
|
7634 | if(!_walkflag(x+16,y+v1,1,SWITCHBLOCK_STATE)&& |
| 16176 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 877 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 877 times.
✓ Branch 4 taken 645 times.
✓ Branch 5 taken 232 times.
|
877 | !_walkflag(x+16,y+v2,1,SWITCHBLOCK_STATE)&& |
| 16177 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 232 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 232 times.
|
232 | _walkflag(x+16,y+15,1,SWITCHBLOCK_STATE)) |
| 16178 | { | ||
| 16179 |
7/12✓ Branch 0 taken 203 times.
✓ Branch 1 taken 7 times.
✓ Branch 2 taken 203 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 203 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 203 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 203 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 210 times.
|
210 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+16,y+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11))) |
| 16180 | 210 | sprite::move((zfix)0,(zfix)-1); | |
| 16181 | 210 | } | |
| 16182 |
6/8✗ Branch 0 not taken.
✓ Branch 1 taken 6547 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6547 times.
✓ Branch 4 taken 667 times.
✓ Branch 5 taken 5880 times.
✓ Branch 6 taken 188 times.
✓ Branch 7 taken 6359 times.
|
12427 | else if(_walkflag(x+16,y+v1,1,SWITCHBLOCK_STATE)&& |
| 16183 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 5880 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5880 times.
✓ Branch 4 taken 5692 times.
✓ Branch 5 taken 188 times.
|
5880 | !_walkflag(x+16,y+v2-1,1,SWITCHBLOCK_STATE)&& |
| 16184 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 188 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 188 times.
|
188 | !_walkflag(x+16,y+15,1,SWITCHBLOCK_STATE)) |
| 16185 | { | ||
| 16186 |
9/12✓ Branch 0 taken 187 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 187 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 187 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 184 times.
✓ Branch 7 taken 3 times.
✓ Branch 8 taken 184 times.
✓ Branch 9 taken 3 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 188 times.
|
188 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+16,y+v1+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4))) |
| 16187 | 188 | sprite::move((zfix)0,(zfix)1); | |
| 16188 | 188 | } | |
| 16189 | else | ||
| 16190 | { | ||
| 16191 | 6359 | pushing=push+1; | |
| 16192 | 6359 | z3step=2; | |
| 16193 | } | ||
| 16194 | 6757 | } | |
| 16195 | else | ||
| 16196 | { | ||
| 16197 | 2861 | pushing=push+1; // L: This makes solid damage combos and diagonal-triggered Armoses work. | |
| 16198 | |||
| 16199 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2861 times.
|
2861 | if(action!=swimming) |
| 16200 | { | ||
| 16201 | 2861 | } | |
| 16202 | } | ||
| 16203 | 9618 | } | |
| 16204 | |||
| 16205 | 95437 | return; | |
| 16206 | } | ||
| 16207 | ✗ | } | |
| 16208 | 181111 | } | |
| 16209 | else | ||
| 16210 | { | ||
| 16211 |
6/6✓ Branch 0 taken 597562 times.
✓ Branch 1 taken 2419487 times.
✓ Branch 2 taken 583896 times.
✓ Branch 3 taken 13666 times.
✓ Branch 4 taken 127211 times.
✓ Branch 5 taken 456685 times.
|
3017049 | if(DrunkUp()&&(holddir==-1||holddir==up)) |
| 16212 | { | ||
| 16213 |
5/8✓ Branch 0 taken 3903 times.
✓ Branch 1 taken 466448 times.
✓ Branch 2 taken 3899 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 3903 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
470351 | if(isdungeon() && (x<=26 || x>=214) && !get_qr(qr_FREEFORM) && !toogam) |
| 16214 | { | ||
| 16215 | ✗ | } | |
| 16216 | else | ||
| 16217 | { | ||
| 16218 |
3/4✓ Branch 0 taken 434123 times.
✓ Branch 1 taken 36228 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 434123 times.
|
470351 | if(charging==0 && spins==0) |
| 16219 | { | ||
| 16220 | 434123 | dir=up; | |
| 16221 | 434123 | } | |
| 16222 | |||
| 16223 | 470351 | holddir=up; | |
| 16224 | |||
| 16225 |
4/4✓ Branch 0 taken 63518 times.
✓ Branch 1 taken 343433 times.
✓ Branch 2 taken 110 times.
✓ Branch 3 taken 63408 times.
|
470351 | if(DrunkRight()&&shiftdir!=left) |
| 16226 | { | ||
| 16227 | 63408 | shiftdir=right; | |
| 16228 | 63408 | } | |
| 16229 |
4/4✓ Branch 0 taken 52611 times.
✓ Branch 1 taken 290932 times.
✓ Branch 2 taken 80 times.
✓ Branch 3 taken 52531 times.
|
343543 | else if(DrunkLeft()&&shiftdir!=right) |
| 16230 | { | ||
| 16231 | 52531 | shiftdir=left; | |
| 16232 | 52531 | } | |
| 16233 | else | ||
| 16234 | { | ||
| 16235 | 291012 | shiftdir=-1; | |
| 16236 | } | ||
| 16237 | |||
| 16238 | //walkable if Ladder can be placed or is already placed vertically | ||
| 16239 |
10/18✓ Branch 0 taken 16485 times.
✓ Branch 1 taken 390466 times.
✓ Branch 2 taken 16485 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 16485 times.
✓ Branch 6 taken 16485 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 16354 times.
✓ Branch 11 taken 16354 times.
✓ Branch 12 taken 16354 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 16354 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 16354 times.
|
406951 | if(isSideViewHero() && !toogam && !(((replay_version_check(0, 23) || get_qr(qr_OLD_LADDER_ITEM_SIDEVIEW)) && can_deploy_ladder()) || (ladderx && laddery && ladderdir==up)) && !getOnSideviewLadder() && action != sideswimming && action != sideswimhit && action != sideswimattacking) |
| 16240 | { | ||
| 16241 | 16354 | walkable=false; | |
| 16242 | 16354 | } | |
| 16243 | else | ||
| 16244 | { | ||
| 16245 |
7/8✓ Branch 0 taken 57465 times.
✓ Branch 1 taken 365840 times.
✓ Branch 2 taken 787 times.
✓ Branch 3 taken 56678 times.
✓ Branch 4 taken 963 times.
✓ Branch 5 taken 421555 times.
✓ Branch 6 taken 963 times.
✗ Branch 7 not taken.
|
423305 | if ((can_deploy_ladder() && get_qr(qr_OLD_LADDER_ITEM_SIDEVIEW)) || (ladderx && laddery && ladderdir==up)) justmoved = 2; |
| 16246 | 423305 | info = walkflag(x,y+(bigHitbox?0:8)-z3step,2,up); | |
| 16247 | |||
| 16248 |
2/2✓ Branch 0 taken 230269 times.
✓ Branch 1 taken 193036 times.
|
423305 | if(x.getInt() & 7) |
| 16249 | 230269 | info = info || walkflag(x+16,y+(bigHitbox?0:8)-z3step,1,up); | |
| 16250 | else | ||
| 16251 | 193036 | info = info || walkflagMBlock(x+16, y+(bigHitbox?0:8)-z3step); | |
| 16252 | |||
| 16253 | 423305 | execute(info); | |
| 16254 | |||
| 16255 |
2/2✓ Branch 0 taken 66757 times.
✓ Branch 1 taken 356548 times.
|
423305 | if(info.isUnwalkable()) |
| 16256 | { | ||
| 16257 |
2/2✓ Branch 0 taken 65419 times.
✓ Branch 1 taken 1338 times.
|
66757 | if(z3step==2) |
| 16258 | { | ||
| 16259 | 65419 | z3step=1; | |
| 16260 | 65419 | info = walkflag(x,y+(bigHitbox?0:8)-z3step,2,up); | |
| 16261 | |||
| 16262 |
2/2✓ Branch 0 taken 37473 times.
✓ Branch 1 taken 27946 times.
|
65419 | if(x.getInt()&7) |
| 16263 | 37473 | info = info || walkflag(x+16,y+(bigHitbox?0:8)-z3step,1,up); | |
| 16264 | else | ||
| 16265 | 27946 | info = info || walkflagMBlock(x+16, y+(bigHitbox?0:8)-z3step); | |
| 16266 | |||
| 16267 | 65419 | execute(info); | |
| 16268 | |||
| 16269 |
2/2✓ Branch 0 taken 60321 times.
✓ Branch 1 taken 5098 times.
|
65419 | if(info.isUnwalkable()) |
| 16270 | { | ||
| 16271 | 60321 | walkable = false; | |
| 16272 | 60321 | } | |
| 16273 | else | ||
| 16274 | { | ||
| 16275 | 5098 | walkable=true; | |
| 16276 | } | ||
| 16277 | 65419 | } | |
| 16278 | else | ||
| 16279 | { | ||
| 16280 | 1338 | walkable=false; | |
| 16281 | } | ||
| 16282 | 66757 | } | |
| 16283 | else | ||
| 16284 | { | ||
| 16285 | 356548 | walkable = true; | |
| 16286 | } | ||
| 16287 | } | ||
| 16288 | |||
| 16289 | 439659 | int32_t s=shiftdir; | |
| 16290 | |||
| 16291 |
5/6✓ Branch 0 taken 3903 times.
✓ Branch 1 taken 435756 times.
✓ Branch 2 taken 3784 times.
✓ Branch 3 taken 119 times.
✓ Branch 4 taken 3903 times.
✗ Branch 5 not taken.
|
439659 | if(isdungeon() && (y<=26 || y>=134) && !get_qr(qr_FREEFORM)) |
| 16292 | { | ||
| 16293 | ✗ | shiftdir=-1; | |
| 16294 | ✗ | } | |
| 16295 | else | ||
| 16296 | { | ||
| 16297 |
2/2✓ Branch 0 taken 52531 times.
✓ Branch 1 taken 387128 times.
|
439659 | if(s==left) |
| 16298 | { | ||
| 16299 | 52531 | info = (walkflag(x-1,y+(bigHitbox?0:8),1,left)||walkflag(x-1,y+15,1,left)); | |
| 16300 | 52531 | execute(info); | |
| 16301 | |||
| 16302 |
2/2✓ Branch 0 taken 7219 times.
✓ Branch 1 taken 45312 times.
|
52531 | if(info.isUnwalkable()) |
| 16303 | { | ||
| 16304 | 7219 | shiftdir=-1; | |
| 16305 | 7219 | } | |
| 16306 |
2/2✓ Branch 0 taken 9326 times.
✓ Branch 1 taken 35986 times.
|
45312 | else if(walkable) |
| 16307 | { | ||
| 16308 | 35986 | info = walkflag(x-1,y+(bigHitbox?0:8)-1,1,left); | |
| 16309 | 35986 | execute(info); | |
| 16310 |
2/2✓ Branch 0 taken 35905 times.
✓ Branch 1 taken 81 times.
|
35986 | if(info.isUnwalkable()) |
| 16311 | { | ||
| 16312 | 81 | shiftdir=-1; | |
| 16313 | 81 | } | |
| 16314 | 35986 | } | |
| 16315 | 52531 | } | |
| 16316 |
2/2✓ Branch 0 taken 323720 times.
✓ Branch 1 taken 63408 times.
|
387128 | else if(s==right) |
| 16317 | { | ||
| 16318 | 63408 | info = walkflag(x+16,y+(bigHitbox?0:8),1,right)||walkflag(x+16,y+15,1,right); | |
| 16319 | 63408 | execute(info); | |
| 16320 | |||
| 16321 |
2/2✓ Branch 0 taken 9185 times.
✓ Branch 1 taken 54223 times.
|
63408 | if(info.isUnwalkable()) |
| 16322 | { | ||
| 16323 | 9185 | shiftdir=-1; | |
| 16324 | 9185 | } | |
| 16325 |
2/2✓ Branch 0 taken 10699 times.
✓ Branch 1 taken 43524 times.
|
54223 | else if(walkable) |
| 16326 | { | ||
| 16327 | 43524 | info = walkflag(x+16,y+(bigHitbox?0:8)-1,1,right); | |
| 16328 | 43524 | execute(info); | |
| 16329 | |||
| 16330 |
2/2✓ Branch 0 taken 43438 times.
✓ Branch 1 taken 86 times.
|
43524 | if(info.isUnwalkable()) |
| 16331 | { | ||
| 16332 | 86 | shiftdir=-1; | |
| 16333 | 86 | } | |
| 16334 | 43524 | } | |
| 16335 | 63408 | } | |
| 16336 | } | ||
| 16337 | |||
| 16338 | 439659 | moveOld2(up); | |
| 16339 | 439659 | shiftdir=s; | |
| 16340 | |||
| 16341 |
2/2✓ Branch 0 taken 361646 times.
✓ Branch 1 taken 78013 times.
|
439659 | if(!walkable) |
| 16342 | { | ||
| 16343 |
2/2✓ Branch 0 taken 24276 times.
✓ Branch 1 taken 53737 times.
|
78013 | if(shiftdir==-1) //Corner-shove; prevent being stuck on corners -V |
| 16344 | { | ||
| 16345 |
6/8✗ Branch 0 not taken.
✓ Branch 1 taken 53737 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 53737 times.
✓ Branch 4 taken 29195 times.
✓ Branch 5 taken 24542 times.
✓ Branch 6 taken 2466 times.
✓ Branch 7 taken 51271 times.
|
78279 | if(!_walkflag(x, y+(bigHitbox?0:8)-1,1,SWITCHBLOCK_STATE) && |
| 16346 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 24542 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 24542 times.
✓ Branch 4 taken 5838 times.
✓ Branch 5 taken 18704 times.
|
24542 | !_walkflag(x+8, y+(bigHitbox?0:8)-1,1,SWITCHBLOCK_STATE) && |
| 16347 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 18704 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 18704 times.
|
18704 | _walkflag(x+15,y+(bigHitbox?0:8)-1,1,SWITCHBLOCK_STATE)) |
| 16348 | { | ||
| 16349 |
9/12✓ Branch 0 taken 2397 times.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 2397 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2397 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2369 times.
✓ Branch 7 taken 28 times.
✓ Branch 8 taken 2369 times.
✓ Branch 9 taken 28 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 2466 times.
|
2466 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11),y+(bigHitbox?0:8)-1)) |
| 16350 | 2466 | sprite::move((zfix)-1,(zfix)0); | |
| 16351 | 2466 | } | |
| 16352 | else | ||
| 16353 | { | ||
| 16354 |
6/8✗ Branch 0 not taken.
✓ Branch 1 taken 51271 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 51271 times.
✓ Branch 4 taken 22076 times.
✓ Branch 5 taken 29195 times.
✓ Branch 6 taken 2457 times.
✓ Branch 7 taken 48814 times.
|
80466 | if(_walkflag(x, y+(bigHitbox?0:8)-1,1,SWITCHBLOCK_STATE) && |
| 16355 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 29195 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 29195 times.
✓ Branch 4 taken 26738 times.
✓ Branch 5 taken 2457 times.
|
29195 | !_walkflag(x+7, y+(bigHitbox?0:8)-1,1,SWITCHBLOCK_STATE) && |
| 16356 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 2457 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2457 times.
|
2457 | !_walkflag(x+15,y+(bigHitbox?0:8)-1,1,SWITCHBLOCK_STATE)) |
| 16357 | { | ||
| 16358 |
10/12✓ Branch 0 taken 2368 times.
✓ Branch 1 taken 89 times.
✓ Branch 2 taken 2368 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2368 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2355 times.
✓ Branch 7 taken 13 times.
✓ Branch 8 taken 2355 times.
✓ Branch 9 taken 13 times.
✓ Branch 10 taken 2 times.
✓ Branch 11 taken 2455 times.
|
2457 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4),y+(bigHitbox?0:8)-1)) |
| 16359 | 2455 | sprite::move((zfix)1,(zfix)0); | |
| 16360 | 2457 | } | |
| 16361 | else | ||
| 16362 | { | ||
| 16363 | 48814 | pushing=push+1; | |
| 16364 | } | ||
| 16365 | } | ||
| 16366 | |||
| 16367 | 53737 | z3step=2; | |
| 16368 | 53737 | } | |
| 16369 | else | ||
| 16370 | { | ||
| 16371 | 24276 | pushing=push+1; // L: This makes solid damage combos and diagonal-triggered Armoses work. | |
| 16372 | 24276 | z3step=2; | |
| 16373 | } | ||
| 16374 | 78013 | } | |
| 16375 | |||
| 16376 | 439659 | return; | |
| 16377 | } | ||
| 16378 | ✗ | } | |
| 16379 | |||
| 16380 |
6/6✓ Branch 0 taken 499884 times.
✓ Branch 1 taken 2046814 times.
✓ Branch 2 taken 487995 times.
✓ Branch 3 taken 11889 times.
✓ Branch 4 taken 360920 times.
✓ Branch 5 taken 127075 times.
|
2546698 | if(DrunkDown()&&(holddir==-1||holddir==down)) |
| 16381 | { | ||
| 16382 |
4/8✓ Branch 0 taken 2675 times.
✓ Branch 1 taken 370134 times.
✓ Branch 2 taken 2675 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2675 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
372809 | if(isdungeon() && (x<=26 || x>=214) && !get_qr(qr_FREEFORM) && !toogam) |
| 16383 | { | ||
| 16384 | ✗ | } | |
| 16385 | else | ||
| 16386 | { | ||
| 16387 |
3/4✓ Branch 0 taken 367793 times.
✓ Branch 1 taken 5016 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 367793 times.
|
372809 | if(charging==0 && spins==0) |
| 16388 | { | ||
| 16389 | 367793 | dir=down; | |
| 16390 | 367793 | } | |
| 16391 | |||
| 16392 | 372809 | holddir=down; | |
| 16393 | |||
| 16394 |
4/4✓ Branch 0 taken 62336 times.
✓ Branch 1 taken 310473 times.
✓ Branch 2 taken 298 times.
✓ Branch 3 taken 62038 times.
|
372809 | if(DrunkRight()&&shiftdir!=left) |
| 16395 | { | ||
| 16396 | 62038 | shiftdir=right; | |
| 16397 | 62038 | } | |
| 16398 |
4/4✓ Branch 0 taken 57786 times.
✓ Branch 1 taken 252985 times.
✓ Branch 2 taken 84 times.
✓ Branch 3 taken 57702 times.
|
310771 | else if(DrunkLeft()&&shiftdir!=right) |
| 16399 | { | ||
| 16400 | 57702 | shiftdir=left; | |
| 16401 | 57702 | } | |
| 16402 | else | ||
| 16403 | { | ||
| 16404 | 253069 | shiftdir=-1; | |
| 16405 | } | ||
| 16406 | |||
| 16407 | //bool walkable; | ||
| 16408 |
7/12✓ Branch 0 taken 9145 times.
✓ Branch 1 taken 363664 times.
✓ Branch 2 taken 9145 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 9145 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 9145 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 9145 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 9145 times.
|
372809 | if(isSideViewHero() && !toogam && !getOnSideviewLadder() && action != sideswimming && action != sideswimhit && action != sideswimattacking) |
| 16409 | { | ||
| 16410 | 9145 | walkable=false; | |
| 16411 | 9145 | } | |
| 16412 | else | ||
| 16413 | { | ||
| 16414 | 363664 | info = walkflag(x,y+15+z3step,2,down); | |
| 16415 | |||
| 16416 |
2/2✓ Branch 0 taken 201187 times.
✓ Branch 1 taken 162477 times.
|
363664 | if(x.getInt()&7) |
| 16417 | 201187 | info = info || walkflag(x+16,y+15+z3step,1,down); | |
| 16418 | else | ||
| 16419 | 162477 | info = info || walkflagMBlock(x+16, y+15+z3step); | |
| 16420 | |||
| 16421 | 363664 | execute(info); | |
| 16422 | |||
| 16423 |
2/2✓ Branch 0 taken 64733 times.
✓ Branch 1 taken 298931 times.
|
363664 | if(info.isUnwalkable()) |
| 16424 | { | ||
| 16425 |
2/2✓ Branch 0 taken 63561 times.
✓ Branch 1 taken 1172 times.
|
64733 | if(z3step==2) |
| 16426 | { | ||
| 16427 | 63561 | z3step=1; | |
| 16428 | 63561 | info = walkflag(x,y+15+z3step,2,down); | |
| 16429 | |||
| 16430 |
2/2✓ Branch 0 taken 38657 times.
✓ Branch 1 taken 24904 times.
|
63561 | if(x.getInt()&7) |
| 16431 | 38657 | info = info || walkflag(x+16,y+15+z3step,1,down); | |
| 16432 | else | ||
| 16433 | 24904 | info = info || walkflagMBlock(x+16, y+15+z3step); | |
| 16434 | |||
| 16435 | 63561 | execute(info); | |
| 16436 | |||
| 16437 |
2/2✓ Branch 0 taken 59065 times.
✓ Branch 1 taken 4496 times.
|
63561 | if(info.isUnwalkable()) |
| 16438 | { | ||
| 16439 | 59065 | walkable = false; | |
| 16440 | 59065 | } | |
| 16441 | else | ||
| 16442 | { | ||
| 16443 | 4496 | walkable=true; | |
| 16444 | } | ||
| 16445 | 63561 | } | |
| 16446 | else | ||
| 16447 | { | ||
| 16448 | 1172 | walkable=false; | |
| 16449 | } | ||
| 16450 | 64733 | } | |
| 16451 | else | ||
| 16452 | { | ||
| 16453 | 298931 | walkable = true; | |
| 16454 | } | ||
| 16455 | } | ||
| 16456 | |||
| 16457 | 372809 | int32_t s=shiftdir; | |
| 16458 | |||
| 16459 |
5/6✓ Branch 0 taken 2675 times.
✓ Branch 1 taken 370134 times.
✓ Branch 2 taken 2670 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 2675 times.
✗ Branch 5 not taken.
|
372809 | if(isdungeon() && (y<=26 || y>=134) && !get_qr(qr_FREEFORM)) |
| 16460 | { | ||
| 16461 | ✗ | shiftdir=-1; | |
| 16462 | ✗ | } | |
| 16463 | else | ||
| 16464 | { | ||
| 16465 |
2/2✓ Branch 0 taken 57702 times.
✓ Branch 1 taken 315107 times.
|
372809 | if(s==left) |
| 16466 | { | ||
| 16467 | 57702 | info = walkflag(x-1,y+(bigHitbox?0:8),1,left)||walkflag(x-1,y+15,1,left); | |
| 16468 | 57702 | execute(info); | |
| 16469 | |||
| 16470 |
2/2✓ Branch 0 taken 6885 times.
✓ Branch 1 taken 50817 times.
|
57702 | if(info.isUnwalkable()) |
| 16471 | { | ||
| 16472 | 6885 | shiftdir=-1; | |
| 16473 | 6885 | } | |
| 16474 |
2/2✓ Branch 0 taken 12264 times.
✓ Branch 1 taken 38553 times.
|
50817 | else if(walkable) |
| 16475 | { | ||
| 16476 | 38553 | info = walkflag(x-1,y+16,1,left); | |
| 16477 | 38553 | execute(info); | |
| 16478 | |||
| 16479 |
2/2✓ Branch 0 taken 38473 times.
✓ Branch 1 taken 80 times.
|
38553 | if(info.isUnwalkable()) |
| 16480 | { | ||
| 16481 | 80 | shiftdir=-1; | |
| 16482 | 80 | } | |
| 16483 | 38553 | } | |
| 16484 | 57702 | } | |
| 16485 |
2/2✓ Branch 0 taken 253069 times.
✓ Branch 1 taken 62038 times.
|
315107 | else if(s==right) |
| 16486 | { | ||
| 16487 | 62038 | info = walkflag(x+16,y+(bigHitbox?0:8),1,right)||walkflag(x+16,y+15,1,right); | |
| 16488 | 62038 | execute(info); | |
| 16489 | |||
| 16490 |
2/2✓ Branch 0 taken 9997 times.
✓ Branch 1 taken 52041 times.
|
62038 | if(info.isUnwalkable()) |
| 16491 | { | ||
| 16492 | 9997 | shiftdir=-1; | |
| 16493 | 9997 | } | |
| 16494 |
2/2✓ Branch 0 taken 12280 times.
✓ Branch 1 taken 39761 times.
|
52041 | else if(walkable) |
| 16495 | { | ||
| 16496 | 39761 | info = walkflag(x+16,y+16,1,right); | |
| 16497 | 39761 | execute(info); | |
| 16498 | |||
| 16499 |
2/2✓ Branch 0 taken 39675 times.
✓ Branch 1 taken 86 times.
|
39761 | if(info.isUnwalkable()) |
| 16500 | { | ||
| 16501 | 86 | shiftdir=-1; | |
| 16502 | 86 | } | |
| 16503 | 39761 | } | |
| 16504 | 62038 | } | |
| 16505 | } | ||
| 16506 | |||
| 16507 | 372809 | moveOld2(down); | |
| 16508 | 372809 | shiftdir=s; | |
| 16509 | |||
| 16510 |
2/2✓ Branch 0 taken 303427 times.
✓ Branch 1 taken 69382 times.
|
372809 | if(!walkable) |
| 16511 | { | ||
| 16512 |
2/2✓ Branch 0 taken 30578 times.
✓ Branch 1 taken 38804 times.
|
69382 | if(shiftdir==-1) //Corner-shove; prevent being stuck on corners -V |
| 16513 | { | ||
| 16514 |
6/8✗ Branch 0 not taken.
✓ Branch 1 taken 38804 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 38804 times.
✓ Branch 4 taken 23792 times.
✓ Branch 5 taken 15012 times.
✓ Branch 6 taken 1959 times.
✓ Branch 7 taken 36845 times.
|
53816 | if(!_walkflag(x, y+15+1,1,SWITCHBLOCK_STATE)&& |
| 16515 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 15012 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 15012 times.
✓ Branch 4 taken 5754 times.
✓ Branch 5 taken 9258 times.
|
15012 | !_walkflag(x+8, y+15+1,1,SWITCHBLOCK_STATE)&& |
| 16516 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 9258 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 9258 times.
|
9258 | _walkflag(x+15,y+15+1,1,SWITCHBLOCK_STATE)) |
| 16517 | { | ||
| 16518 |
9/12✓ Branch 0 taken 1840 times.
✓ Branch 1 taken 119 times.
✓ Branch 2 taken 1840 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1840 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1832 times.
✓ Branch 7 taken 8 times.
✓ Branch 8 taken 1832 times.
✓ Branch 9 taken 8 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 1959 times.
|
1959 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11),y+15+1)) |
| 16519 | 1959 | sprite::move((zfix)-1,(zfix)0); | |
| 16520 | 1959 | } | |
| 16521 |
6/8✗ Branch 0 not taken.
✓ Branch 1 taken 36845 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 36845 times.
✓ Branch 4 taken 13053 times.
✓ Branch 5 taken 23792 times.
✓ Branch 6 taken 1790 times.
✓ Branch 7 taken 35055 times.
|
60637 | else if(_walkflag(x, y+15+1,1,SWITCHBLOCK_STATE)&& |
| 16522 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 23792 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 23792 times.
✓ Branch 4 taken 21980 times.
✓ Branch 5 taken 1812 times.
|
23792 | !_walkflag(x+7, y+15+1,1,SWITCHBLOCK_STATE)&& |
| 16523 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 1812 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1812 times.
|
1812 | !_walkflag(x+15,y+15+1,1,SWITCHBLOCK_STATE)) |
| 16524 | { | ||
| 16525 |
9/12✓ Branch 0 taken 1711 times.
✓ Branch 1 taken 79 times.
✓ Branch 2 taken 1711 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1711 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1705 times.
✓ Branch 7 taken 6 times.
✓ Branch 8 taken 1705 times.
✓ Branch 9 taken 6 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 1790 times.
|
1790 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4),y+15+1)) |
| 16526 | 1790 | sprite::move((zfix)1,(zfix)0); | |
| 16527 | 1790 | } | |
| 16528 | else //if(shiftdir==-1) | ||
| 16529 | { | ||
| 16530 | 35055 | pushing=push+1; | |
| 16531 | |||
| 16532 |
2/2✓ Branch 0 taken 85 times.
✓ Branch 1 taken 34970 times.
|
35055 | if(action!=swimming) |
| 16533 | { | ||
| 16534 | 34970 | } | |
| 16535 | } | ||
| 16536 | |||
| 16537 | 38804 | z3step=2; | |
| 16538 | 38804 | } | |
| 16539 | else | ||
| 16540 | { | ||
| 16541 | 30578 | pushing=push+1; // L: This makes solid damage combos and diagonal-triggered Armoses work. | |
| 16542 | |||
| 16543 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 30578 times.
|
30578 | if(action!=swimming) |
| 16544 | { | ||
| 16545 | 30578 | } | |
| 16546 | |||
| 16547 | 30578 | z3step=2; | |
| 16548 | } | ||
| 16549 | 69382 | } | |
| 16550 | |||
| 16551 | 372809 | return; | |
| 16552 | } | ||
| 16553 | ✗ | } | |
| 16554 | |||
| 16555 |
6/6✓ Branch 0 taken 584478 times.
✓ Branch 1 taken 1589411 times.
✓ Branch 2 taken 567982 times.
✓ Branch 3 taken 16496 times.
✓ Branch 4 taken 566377 times.
✓ Branch 5 taken 1605 times.
|
2173889 | if(DrunkLeft()&&(holddir==-1||holddir==left)) |
| 16556 | { | ||
| 16557 |
5/8✓ Branch 0 taken 4662 times.
✓ Branch 1 taken 578211 times.
✓ Branch 2 taken 4511 times.
✓ Branch 3 taken 151 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 4662 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
582873 | if(isdungeon() && (y<=26 || y>=134) && !get_qr(qr_FREEFORM) && !toogam) |
| 16558 | { | ||
| 16559 | ✗ | } | |
| 16560 | else | ||
| 16561 | { | ||
| 16562 |
3/4✓ Branch 0 taken 576327 times.
✓ Branch 1 taken 6546 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 576327 times.
|
582873 | if(charging==0 && spins==0) |
| 16563 | { | ||
| 16564 | 576327 | dir=left; | |
| 16565 | 576327 | } | |
| 16566 | |||
| 16567 | 582873 | holddir=left; | |
| 16568 | |||
| 16569 |
4/4✓ Branch 0 taken 75537 times.
✓ Branch 1 taken 507336 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 75534 times.
|
582873 | if(DrunkUp()&&shiftdir!=down) |
| 16570 | { | ||
| 16571 | 75534 | shiftdir=up; | |
| 16572 | 75534 | } | |
| 16573 |
4/4✓ Branch 0 taken 60725 times.
✓ Branch 1 taken 446614 times.
✓ Branch 2 taken 12 times.
✓ Branch 3 taken 60713 times.
|
507339 | else if(DrunkDown()&&shiftdir!=up) |
| 16574 | { | ||
| 16575 | 60713 | shiftdir=down; | |
| 16576 | 60713 | } | |
| 16577 | else | ||
| 16578 | { | ||
| 16579 | 446626 | shiftdir=-1; | |
| 16580 | } | ||
| 16581 | |||
| 16582 | //bool walkable; | ||
| 16583 | 582873 | info = walkflag(x-z3step,y+(bigHitbox?0:8),1,left)||walkflag(x-z3step,y+8,1,left); | |
| 16584 | |||
| 16585 |
2/2✓ Branch 0 taken 337485 times.
✓ Branch 1 taken 245388 times.
|
582873 | if(y.getInt()&7) |
| 16586 | 337485 | info = info || walkflag(x-z3step,y+16,1,left); | |
| 16587 | |||
| 16588 | 582873 | execute(info); | |
| 16589 | |||
| 16590 |
2/2✓ Branch 0 taken 72078 times.
✓ Branch 1 taken 510795 times.
|
582873 | if(info.isUnwalkable()) |
| 16591 | { | ||
| 16592 |
2/2✓ Branch 0 taken 70708 times.
✓ Branch 1 taken 1370 times.
|
72078 | if(z3step==2) |
| 16593 | { | ||
| 16594 | 70708 | z3step=1; | |
| 16595 | 70708 | info = walkflag(x-z3step,y+(bigHitbox?0:8),1,left)||walkflag(x-z3step,y+8,1,left); | |
| 16596 | |||
| 16597 |
2/2✓ Branch 0 taken 27017 times.
✓ Branch 1 taken 43691 times.
|
70708 | if(y.getInt()&7) |
| 16598 | 43691 | info = info || walkflag(x-z3step,y+16,1,left); | |
| 16599 | |||
| 16600 | 70708 | execute(info); | |
| 16601 | |||
| 16602 |
2/2✓ Branch 0 taken 65885 times.
✓ Branch 1 taken 4823 times.
|
70708 | if(info.isUnwalkable()) |
| 16603 | { | ||
| 16604 | 65885 | walkable = false; | |
| 16605 | 65885 | } | |
| 16606 | else | ||
| 16607 | { | ||
| 16608 | 4823 | walkable=true; | |
| 16609 | } | ||
| 16610 | 70708 | } | |
| 16611 | else | ||
| 16612 | { | ||
| 16613 | 1370 | walkable=false; | |
| 16614 | } | ||
| 16615 | 72078 | } | |
| 16616 | else | ||
| 16617 | { | ||
| 16618 | 510795 | walkable = true; | |
| 16619 | } | ||
| 16620 | |||
| 16621 | 582873 | int32_t s=shiftdir; | |
| 16622 | |||
| 16623 |
10/14✓ Branch 0 taken 4662 times.
✓ Branch 1 taken 578211 times.
✓ Branch 2 taken 4595 times.
✓ Branch 3 taken 67 times.
✓ Branch 4 taken 4662 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 56334 times.
✓ Branch 7 taken 526539 times.
✓ Branch 8 taken 56334 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 56334 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 56334 times.
✗ Branch 13 not taken.
|
582873 | if((isdungeon() && (x<=26 || x>=214) && !get_qr(qr_FREEFORM)) || (isSideViewHero() && !getOnSideviewLadder() && action != sideswimming && action != sideswimhit && action != sideswimattacking)) |
| 16624 | { | ||
| 16625 | 56334 | shiftdir=-1; | |
| 16626 | 56334 | } | |
| 16627 | else | ||
| 16628 | { | ||
| 16629 |
2/2✓ Branch 0 taken 452296 times.
✓ Branch 1 taken 74243 times.
|
526539 | if(s==up) |
| 16630 | { | ||
| 16631 | 74243 | info = walkflag(x,y+(bigHitbox?0:8)-1,2,up)||walkflag(x+15,y+(bigHitbox?0:8)-1,1,up); | |
| 16632 | 74243 | execute(info); | |
| 16633 | |||
| 16634 |
2/2✓ Branch 0 taken 8595 times.
✓ Branch 1 taken 65648 times.
|
74243 | if(info.isUnwalkable()) |
| 16635 | { | ||
| 16636 | 8595 | shiftdir=-1; | |
| 16637 | 8595 | } | |
| 16638 |
2/2✓ Branch 0 taken 9976 times.
✓ Branch 1 taken 55672 times.
|
65648 | else if(walkable) |
| 16639 | { | ||
| 16640 | 55672 | info = walkflag(x-1,y+(bigHitbox?0:8)-1,1,up); | |
| 16641 | 55672 | execute(info); | |
| 16642 | |||
| 16643 |
2/2✓ Branch 0 taken 55591 times.
✓ Branch 1 taken 81 times.
|
55672 | if(info.isUnwalkable()) |
| 16644 | { | ||
| 16645 | 81 | shiftdir=-1; | |
| 16646 | 81 | } | |
| 16647 | 55672 | } | |
| 16648 | 74243 | } | |
| 16649 |
2/2✓ Branch 0 taken 392144 times.
✓ Branch 1 taken 60152 times.
|
452296 | else if(s==down) |
| 16650 | { | ||
| 16651 | 60152 | info = walkflag(x,y+16,2,down)||walkflag(x+15,y+16,1,down); | |
| 16652 | 60152 | execute(info); | |
| 16653 | |||
| 16654 |
2/2✓ Branch 0 taken 9543 times.
✓ Branch 1 taken 50609 times.
|
60152 | if(info.isUnwalkable()) |
| 16655 | { | ||
| 16656 | 9543 | shiftdir=-1; | |
| 16657 | 9543 | } | |
| 16658 |
2/2✓ Branch 0 taken 7944 times.
✓ Branch 1 taken 42665 times.
|
50609 | else if(walkable) |
| 16659 | { | ||
| 16660 | 42665 | info = walkflag(x-1,y+16,1,down); | |
| 16661 | 42665 | execute(info); | |
| 16662 | |||
| 16663 |
2/2✓ Branch 0 taken 42594 times.
✓ Branch 1 taken 71 times.
|
42665 | if(info.isUnwalkable()) |
| 16664 | { | ||
| 16665 | 71 | shiftdir=-1; | |
| 16666 | 71 | } | |
| 16667 | 42665 | } | |
| 16668 | 60152 | } | |
| 16669 | } | ||
| 16670 | |||
| 16671 | 582873 | moveOld2(left); | |
| 16672 | 582873 | shiftdir=s; | |
| 16673 | |||
| 16674 |
2/2✓ Branch 0 taken 515618 times.
✓ Branch 1 taken 67255 times.
|
582873 | if(!walkable) |
| 16675 | { | ||
| 16676 |
2/2✓ Branch 0 taken 22472 times.
✓ Branch 1 taken 44783 times.
|
67255 | if(shiftdir==-1) //Corner-shove; prevent being stuck on corners -V |
| 16677 | { | ||
| 16678 | 44783 | int32_t v1=bigHitbox?0:8; | |
| 16679 | 44783 | int32_t v2=bigHitbox?8:12; | |
| 16680 | |||
| 16681 |
6/8✗ Branch 0 not taken.
✓ Branch 1 taken 44783 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 44783 times.
✓ Branch 4 taken 36942 times.
✓ Branch 5 taken 7841 times.
✓ Branch 6 taken 1401 times.
✓ Branch 7 taken 43382 times.
|
52624 | if(!_walkflag(x-1,y+v1,1,SWITCHBLOCK_STATE)&& |
| 16682 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 7841 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7841 times.
✓ Branch 4 taken 3911 times.
✓ Branch 5 taken 3930 times.
|
7841 | !_walkflag(x-1,y+v2,1,SWITCHBLOCK_STATE)&& |
| 16683 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 3930 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3930 times.
|
3930 | _walkflag(x-1,y+15,1,SWITCHBLOCK_STATE)) |
| 16684 | { | ||
| 16685 |
9/12✓ Branch 0 taken 1302 times.
✓ Branch 1 taken 99 times.
✓ Branch 2 taken 1302 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1302 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1298 times.
✓ Branch 7 taken 4 times.
✓ Branch 8 taken 1298 times.
✓ Branch 9 taken 4 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 1401 times.
|
1401 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x-1,y+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11))) |
| 16686 | 1401 | sprite::move((zfix)0,(zfix)-1); | |
| 16687 | 1401 | } | |
| 16688 |
6/8✗ Branch 0 not taken.
✓ Branch 1 taken 43382 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 43382 times.
✓ Branch 4 taken 6440 times.
✓ Branch 5 taken 36942 times.
✓ Branch 6 taken 760 times.
✓ Branch 7 taken 42622 times.
|
80324 | else if(_walkflag(x-1,y+v1, 1,SWITCHBLOCK_STATE)&& |
| 16689 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 36942 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 36942 times.
✓ Branch 4 taken 36182 times.
✓ Branch 5 taken 760 times.
|
36942 | !_walkflag(x-1,y+v2-1,1,SWITCHBLOCK_STATE)&& |
| 16690 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 760 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 760 times.
|
760 | !_walkflag(x-1,y+15, 1,SWITCHBLOCK_STATE)) |
| 16691 | { | ||
| 16692 |
8/12✓ Branch 0 taken 708 times.
✓ Branch 1 taken 52 times.
✓ Branch 2 taken 708 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 708 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 708 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 708 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✓ Branch 11 taken 759 times.
|
760 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x-1,y+v1+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4))) |
| 16693 | 759 | sprite::move((zfix)0,(zfix)1); | |
| 16694 | 760 | } | |
| 16695 | else //if(shiftdir==-1) | ||
| 16696 | { | ||
| 16697 | 42622 | pushing=push+1; | |
| 16698 | |||
| 16699 |
2/2✓ Branch 0 taken 205 times.
✓ Branch 1 taken 42417 times.
|
42622 | if(action!=swimming) |
| 16700 | { | ||
| 16701 | 42417 | } | |
| 16702 | } | ||
| 16703 | |||
| 16704 | 44783 | z3step=2; | |
| 16705 | 44783 | } | |
| 16706 | else | ||
| 16707 | { | ||
| 16708 | 22472 | pushing=push+1; // L: This makes solid damage combos and diagonal-triggered Armoses work. | |
| 16709 | |||
| 16710 |
2/2✓ Branch 0 taken 43 times.
✓ Branch 1 taken 22429 times.
|
22472 | if(action!=swimming) |
| 16711 | { | ||
| 16712 | 22429 | } | |
| 16713 | |||
| 16714 | 22472 | z3step=2; | |
| 16715 | } | ||
| 16716 | 67255 | } | |
| 16717 | |||
| 16718 | 582873 | return; | |
| 16719 | } | ||
| 16720 | ✗ | } | |
| 16721 | |||
| 16722 |
5/6✓ Branch 0 taken 640645 times.
✓ Branch 1 taken 950371 times.
✓ Branch 2 taken 623565 times.
✓ Branch 3 taken 17080 times.
✓ Branch 4 taken 623565 times.
✗ Branch 5 not taken.
|
1591016 | if(DrunkRight()&&(holddir==-1||holddir==right)) |
| 16723 | { | ||
| 16724 |
5/8✓ Branch 0 taken 4663 times.
✓ Branch 1 taken 635982 times.
✓ Branch 2 taken 4484 times.
✓ Branch 3 taken 179 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 4663 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
640645 | if(isdungeon() && (y<=26 || y>=134) && !get_qr(qr_FREEFORM) && !toogam) |
| 16725 | { | ||
| 16726 | ✗ | } | |
| 16727 | else | ||
| 16728 | { | ||
| 16729 |
3/4✓ Branch 0 taken 632514 times.
✓ Branch 1 taken 8131 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 632514 times.
|
640645 | if(charging==0 && spins==0) |
| 16730 | { | ||
| 16731 | 632514 | dir=right; | |
| 16732 | 632514 | } | |
| 16733 | |||
| 16734 | 640645 | holddir=right; | |
| 16735 | |||
| 16736 |
4/4✓ Branch 0 taken 82021 times.
✓ Branch 1 taken 558624 times.
✓ Branch 2 taken 31 times.
✓ Branch 3 taken 81990 times.
|
640645 | if(DrunkUp()&&shiftdir!=down) |
| 16737 | { | ||
| 16738 | 81990 | shiftdir=up; | |
| 16739 | 81990 | } | |
| 16740 |
4/4✓ Branch 0 taken 66269 times.
✓ Branch 1 taken 492386 times.
✓ Branch 2 taken 13 times.
✓ Branch 3 taken 66256 times.
|
558655 | else if(DrunkDown()&&shiftdir!=up) |
| 16741 | { | ||
| 16742 | 66256 | shiftdir=down; | |
| 16743 | 66256 | } | |
| 16744 | else | ||
| 16745 | { | ||
| 16746 | 492399 | shiftdir=-1; | |
| 16747 | } | ||
| 16748 | |||
| 16749 | //bool walkable; | ||
| 16750 | 640645 | info = walkflag(x+15+z3step,y+(bigHitbox?0:8),1,right)||walkflag(x+15+z3step,y+8,1,right); | |
| 16751 | |||
| 16752 |
2/2✓ Branch 0 taken 276495 times.
✓ Branch 1 taken 364150 times.
|
640645 | if(y.getInt()&7) |
| 16753 | 364150 | info = info || walkflag(x+15+z3step,y+16,1,right); | |
| 16754 | |||
| 16755 | 640645 | execute(info); | |
| 16756 | |||
| 16757 |
2/2✓ Branch 0 taken 88326 times.
✓ Branch 1 taken 552319 times.
|
640645 | if(info.isUnwalkable()) |
| 16758 | { | ||
| 16759 |
2/2✓ Branch 0 taken 86901 times.
✓ Branch 1 taken 1425 times.
|
88326 | if(z3step==2) |
| 16760 | { | ||
| 16761 | 86901 | z3step=1; | |
| 16762 | 86901 | info = walkflag(x+15+z3step,y+(bigHitbox?0:8),1,right)||walkflag(x+15+z3step,y+8,1,right); | |
| 16763 | |||
| 16764 |
2/2✓ Branch 0 taken 33022 times.
✓ Branch 1 taken 53879 times.
|
86901 | if(y.getInt()&7) |
| 16765 | 53879 | info = info || walkflag(x+15+z3step,y+16,1,right); | |
| 16766 | |||
| 16767 | 86901 | execute(info); | |
| 16768 | |||
| 16769 |
2/2✓ Branch 0 taken 79538 times.
✓ Branch 1 taken 7363 times.
|
86901 | if(info.isUnwalkable()) |
| 16770 | { | ||
| 16771 | 79538 | walkable = false; | |
| 16772 | 79538 | } | |
| 16773 | else | ||
| 16774 | { | ||
| 16775 | 7363 | walkable=true; | |
| 16776 | } | ||
| 16777 | 86901 | } | |
| 16778 | else | ||
| 16779 | { | ||
| 16780 | 1425 | walkable=false; | |
| 16781 | } | ||
| 16782 | 88326 | } | |
| 16783 | else | ||
| 16784 | { | ||
| 16785 | 552319 | walkable = true; | |
| 16786 | } | ||
| 16787 | |||
| 16788 | 640645 | int32_t s=shiftdir; | |
| 16789 | |||
| 16790 |
10/14✓ Branch 0 taken 4663 times.
✓ Branch 1 taken 635982 times.
✓ Branch 2 taken 4647 times.
✓ Branch 3 taken 16 times.
✓ Branch 4 taken 4663 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 65926 times.
✓ Branch 7 taken 574719 times.
✓ Branch 8 taken 65926 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 65926 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 65926 times.
✗ Branch 13 not taken.
|
640645 | if((isdungeon() && (x<=26 || x>=214) && !get_qr(qr_FREEFORM)) || (isSideViewHero() && !getOnSideviewLadder() && action != sideswimming && action != sideswimhit && action != sideswimattacking)) |
| 16791 | { | ||
| 16792 | 65926 | shiftdir=-1; | |
| 16793 | 65926 | } | |
| 16794 | else | ||
| 16795 | { | ||
| 16796 |
2/2✓ Branch 0 taken 494491 times.
✓ Branch 1 taken 80228 times.
|
574719 | if(s==up) |
| 16797 | { | ||
| 16798 | 80228 | info = walkflag(x,y+(bigHitbox?0:8)-1,2,up)||walkflag(x+15,y+(bigHitbox?0:8)-1,1,up); | |
| 16799 | 80228 | execute(info); | |
| 16800 | |||
| 16801 |
2/2✓ Branch 0 taken 10529 times.
✓ Branch 1 taken 69699 times.
|
80228 | if(info.isUnwalkable()) |
| 16802 | { | ||
| 16803 | 10529 | shiftdir=-1; | |
| 16804 | 10529 | } | |
| 16805 |
2/2✓ Branch 0 taken 11746 times.
✓ Branch 1 taken 57953 times.
|
69699 | else if(walkable) |
| 16806 | { | ||
| 16807 | 57953 | info = walkflag(x+16,y+(bigHitbox?0:8)-1,1,up); | |
| 16808 | 57953 | execute(info); | |
| 16809 | |||
| 16810 |
2/2✓ Branch 0 taken 57862 times.
✓ Branch 1 taken 91 times.
|
57953 | if(info.isUnwalkable()) |
| 16811 | { | ||
| 16812 | 91 | shiftdir=-1; | |
| 16813 | 91 | } | |
| 16814 | 57953 | } | |
| 16815 | 80228 | } | |
| 16816 |
2/2✓ Branch 0 taken 428712 times.
✓ Branch 1 taken 65779 times.
|
494491 | else if(s==down) |
| 16817 | { | ||
| 16818 | 65779 | info = walkflag(x,y+16,2,down)||walkflag(x+15,y+16,1,down); | |
| 16819 | 65779 | execute(info); | |
| 16820 | |||
| 16821 |
2/2✓ Branch 0 taken 11429 times.
✓ Branch 1 taken 54350 times.
|
65779 | if(info.isUnwalkable()) |
| 16822 | { | ||
| 16823 | 11429 | shiftdir=-1; | |
| 16824 | 11429 | } | |
| 16825 |
2/2✓ Branch 0 taken 9297 times.
✓ Branch 1 taken 45053 times.
|
54350 | else if(walkable) |
| 16826 | { | ||
| 16827 | 45053 | info = walkflag(x+16,y+16,1,down); | |
| 16828 | 45053 | execute(info); | |
| 16829 | |||
| 16830 |
2/2✓ Branch 0 taken 44973 times.
✓ Branch 1 taken 80 times.
|
45053 | if(info.isUnwalkable()) |
| 16831 | { | ||
| 16832 | 80 | shiftdir=-1; | |
| 16833 | 80 | } | |
| 16834 | 45053 | } | |
| 16835 | 65779 | } | |
| 16836 | } | ||
| 16837 | |||
| 16838 | 640645 | moveOld2(right); | |
| 16839 | 640645 | shiftdir=s; | |
| 16840 | |||
| 16841 |
2/2✓ Branch 0 taken 559682 times.
✓ Branch 1 taken 80963 times.
|
640645 | if(!walkable) |
| 16842 | { | ||
| 16843 |
2/2✓ Branch 0 taken 27206 times.
✓ Branch 1 taken 53757 times.
|
80963 | if(shiftdir==-1) //Corner-shove; prevent being stuck on corners -V |
| 16844 | { | ||
| 16845 | 53757 | int32_t v1=bigHitbox?0:8; | |
| 16846 | 53757 | int32_t v2=bigHitbox?8:12; | |
| 16847 | |||
| 16848 | 161271 | info = !walkflag(x+16,y+v1,1,right)&& | |
| 16849 | 107514 | !walkflag(x+16,y+v2,1,right)&& | |
| 16850 | 53757 | walkflag(x+16,y+15,1,right); | |
| 16851 | |||
| 16852 | //do NOT execute these | ||
| 16853 |
2/2✓ Branch 0 taken 1675 times.
✓ Branch 1 taken 52082 times.
|
53757 | if(info.isUnwalkable()) |
| 16854 | { | ||
| 16855 |
10/12✓ Branch 0 taken 1578 times.
✓ Branch 1 taken 97 times.
✓ Branch 2 taken 1578 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1578 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1577 times.
✓ Branch 7 taken 1 times.
✓ Branch 8 taken 1577 times.
✓ Branch 9 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 11 taken 1674 times.
|
1675 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+16,y+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11))) |
| 16856 | 1674 | sprite::move((zfix)0,(zfix)-1); | |
| 16857 | 1675 | } | |
| 16858 | else | ||
| 16859 | { | ||
| 16860 | 156246 | info = walkflag(x+16,y+v1, 1,right)&& | |
| 16861 | 104164 | !walkflag(x+16,y+v2-1,1,right)&& | |
| 16862 | 52082 | !walkflag(x+16,y+15, 1,right); | |
| 16863 | |||
| 16864 |
2/2✓ Branch 0 taken 872 times.
✓ Branch 1 taken 51210 times.
|
52082 | if(info.isUnwalkable()) |
| 16865 | { | ||
| 16866 |
7/12✓ Branch 0 taken 832 times.
✓ Branch 1 taken 40 times.
✓ Branch 2 taken 832 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 832 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 832 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 832 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 872 times.
|
872 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+16,y+v1+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4))) |
| 16867 | 872 | sprite::move((zfix)0,(zfix)1); | |
| 16868 | 872 | } | |
| 16869 | else //if(shiftdir==-1) | ||
| 16870 | { | ||
| 16871 | 51210 | pushing=push+1; | |
| 16872 | 51210 | z3step=2; | |
| 16873 | |||
| 16874 |
2/2✓ Branch 0 taken 66 times.
✓ Branch 1 taken 51144 times.
|
51210 | if(action!=swimming) |
| 16875 | { | ||
| 16876 | 51144 | } | |
| 16877 | } | ||
| 16878 | } | ||
| 16879 | |||
| 16880 | 53757 | z3step=2; | |
| 16881 | 53757 | } | |
| 16882 | else | ||
| 16883 | { | ||
| 16884 | 27206 | pushing=push+1; // L: This makes solid damage combos and diagonal-triggered Armoses work. | |
| 16885 | |||
| 16886 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 27196 times.
|
27206 | if(action!=swimming) |
| 16887 | { | ||
| 16888 | 27196 | } | |
| 16889 | |||
| 16890 | 27206 | z3step=2; | |
| 16891 | } | ||
| 16892 | 80963 | } | |
| 16893 | |||
| 16894 | 640645 | return; | |
| 16895 | } | ||
| 16896 | ✗ | } | |
| 16897 | } | ||
| 16898 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1131482 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1131482 | if(shield_forcedir > -1 && action != rafting) |
| 16899 | ✗ | dir = shield_forcedir; | |
| 16900 | 1131482 | int32_t wtry = iswaterex(MAPCOMBO(x,y+15), currmap, currscr, -1, x,y+15, true, false); | |
| 16901 | 1131482 | int32_t wtry8 = iswaterex(MAPCOMBO(x+15,y+15), currmap, currscr, -1, x+15,y+15, true, false); | |
| 16902 | 1131482 | int32_t wtrx = iswaterex(MAPCOMBO(x,y+(bigHitbox?0:8)), currmap, currscr, -1, x,y+(bigHitbox?0:8), true, false); | |
| 16903 | 1131482 | int32_t wtrx8 = iswaterex(MAPCOMBO(x+15,y+(bigHitbox?0:8)), currmap, currscr, -1, x+15,y+(bigHitbox?0:8), true, false); | |
| 16904 | 1131482 | int32_t wtrc = iswaterex(MAPCOMBO(x+8,y+(bigHitbox?8:12)), currmap, currscr, -1, x+8,y+(bigHitbox?8:12), true, false); | |
| 16905 | |||
| 16906 |
8/12✓ Branch 0 taken 151196 times.
✓ Branch 1 taken 980286 times.
✓ Branch 2 taken 151196 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 151196 times.
✓ Branch 6 taken 151196 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 148387 times.
✓ Branch 9 taken 2809 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 148387 times.
|
1131482 | if(can_use_item(itype_flippers,i_flippers)&¤t_item(itype_flippers) >= combobuf[wtrc].attribytes[0]&&(!(combobuf[wtrc].usrflags&cflag1) || (itemsbuf[current_item_id(itype_flippers)].flags & item_flag3))&&!(ladderx+laddery)&&z==0&&fakez==0) |
| 16907 | { | ||
| 16908 |
8/12✓ Branch 0 taken 571 times.
✓ Branch 1 taken 147816 times.
✓ Branch 2 taken 526 times.
✓ Branch 3 taken 45 times.
✓ Branch 4 taken 479 times.
✓ Branch 5 taken 47 times.
✓ Branch 6 taken 479 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 479 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
148387 | if(wtrx&&wtrx8&&wtry&&wtry8 && !DRIEDLAKE) |
| 16909 | { | ||
| 16910 | //action=swimming; | ||
| 16911 |
3/12✓ Branch 0 taken 360 times.
✓ Branch 1 taken 119 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 360 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
479 | if(action !=none && action != swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking && !isSideViewHero()) |
| 16912 | { | ||
| 16913 | ✗ | hopclk = 0xFF; | |
| 16914 | ✗ | } | |
| 16915 | 479 | } | |
| 16916 | 148387 | } | |
| 16917 | |||
| 16918 | 1131482 | return; | |
| 16919 | } //endif (LTTPWALK) | ||
| 16920 | 3778067 | temp_step = hero_newstep; | |
| 16921 | 3778067 | temp_x = x; | |
| 16922 | 3778067 | temp_y = y; | |
| 16923 | |||
| 16924 |
7/8✓ Branch 0 taken 2471672 times.
✓ Branch 1 taken 1306395 times.
✓ Branch 2 taken 2420142 times.
✓ Branch 3 taken 51530 times.
✓ Branch 4 taken 59406 times.
✓ Branch 5 taken 2412266 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 59406 times.
|
3778067 | if(isdungeon() && (x<=26 || x>=214) && !get_qr(qr_FREEFORM) && !toogam) |
| 16925 | { | ||
| 16926 |
2/4✓ Branch 0 taken 59406 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 59406 times.
|
59406 | if(get_qr(qr_NEW_HERO_MOVEMENT) || IsSideSwim()) |
| 16927 | ✗ | goto LEFTRIGHT_NEWMOVE; | |
| 16928 | 59406 | else goto LEFTRIGHT_OLDMOVE; | |
| 16929 | } | ||
| 16930 | |||
| 16931 | // make it easier to get in left & right doors | ||
| 16932 | |||
| 16933 | //ignore ladder for this part. sigh sigh sigh -DD | ||
| 16934 | 3718661 | oldladderx = ladderx; | |
| 16935 | 3718661 | oldladdery = laddery; | |
| 16936 |
2/4✓ Branch 0 taken 3718661 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3718661 times.
|
3718661 | if(get_qr(qr_NEW_HERO_MOVEMENT) || IsSideSwim()) |
| 16937 | { | ||
| 16938 | ✗ | if(isdungeon() && DrunkLeft() && (temp_x==32 && temp_y==80)) | |
| 16939 | { | ||
| 16940 | ✗ | do | |
| 16941 | { | ||
| 16942 | ✗ | info = walkflag(temp_x,temp_y+(bigHitbox?0:8),1,left) || | |
| 16943 | ✗ | walkflag(temp_x-temp_step,temp_y+(bigHitbox?0:8),1,left); | |
| 16944 | |||
| 16945 | ✗ | if(info.isUnwalkable()) | |
| 16946 | { | ||
| 16947 | ✗ | if(temp_x != int32_t(temp_x)) | |
| 16948 | { | ||
| 16949 | ✗ | temp_x = floor((double)temp_x); | |
| 16950 | ✗ | } | |
| 16951 | ✗ | else if(temp_step > 1) | |
| 16952 | { | ||
| 16953 | ✗ | if(temp_step != int32_t(temp_step)) //floor | |
| 16954 | ✗ | temp_step = floor((double)temp_step); | |
| 16955 | ✗ | else --temp_step; | |
| 16956 | ✗ | } | |
| 16957 | else | ||
| 16958 | ✗ | break; | |
| 16959 | ✗ | } | |
| 16960 | ✗ | } | |
| 16961 | ✗ | while(info.isUnwalkable()); | |
| 16962 | |||
| 16963 | ✗ | if(!info.isUnwalkable()) | |
| 16964 | { | ||
| 16965 | ✗ | x = temp_x; | |
| 16966 | ✗ | y = temp_y; | |
| 16967 | ✗ | hero_newstep = temp_step; | |
| 16968 | //ONLY process the side-effects of the above walkflag if Hero will actually move | ||
| 16969 | //sigh sigh sigh... walkflag is a horrible mess :-/ -DD | ||
| 16970 | ✗ | execute(info); | |
| 16971 | ✗ | moveOld2(left); | |
| 16972 | ✗ | return; | |
| 16973 | } | ||
| 16974 | ✗ | temp_x = x; | |
| 16975 | ✗ | temp_y = y; | |
| 16976 | ✗ | temp_step = hero_newstep; | |
| 16977 | ✗ | } | |
| 16978 | |||
| 16979 | ✗ | if(isdungeon() && DrunkRight() && temp_x==208 && temp_y==80) | |
| 16980 | { | ||
| 16981 | ✗ | do | |
| 16982 | { | ||
| 16983 | ✗ | info = walkflag(temp_x+15+temp_step,temp_y+(bigHitbox?0:8),1,right) || | |
| 16984 | ✗ | walkflag(temp_x+15+temp_step,temp_y+8,1,right); | |
| 16985 | |||
| 16986 | ✗ | if(info.isUnwalkable()) | |
| 16987 | { | ||
| 16988 | ✗ | if(temp_x != int32_t(temp_x)) | |
| 16989 | { | ||
| 16990 | ✗ | temp_x = floor((double)temp_x); | |
| 16991 | ✗ | } | |
| 16992 | ✗ | else if(temp_step > 1) | |
| 16993 | { | ||
| 16994 | ✗ | if(temp_step != int32_t(temp_step)) //floor | |
| 16995 | ✗ | temp_step = floor((double)temp_step); | |
| 16996 | ✗ | else --temp_step; | |
| 16997 | ✗ | } | |
| 16998 | else | ||
| 16999 | ✗ | break; | |
| 17000 | ✗ | } | |
| 17001 | ✗ | } | |
| 17002 | ✗ | while(info.isUnwalkable()); | |
| 17003 | |||
| 17004 | ✗ | if(!info.isUnwalkable()) | |
| 17005 | { | ||
| 17006 | ✗ | x = temp_x; | |
| 17007 | ✗ | y = temp_y; | |
| 17008 | ✗ | hero_newstep = temp_step; | |
| 17009 | ✗ | execute(info); | |
| 17010 | ✗ | moveOld2(right); | |
| 17011 | ✗ | return; | |
| 17012 | } | ||
| 17013 | ✗ | temp_x = x; | |
| 17014 | ✗ | temp_y = y; | |
| 17015 | ✗ | temp_step = hero_newstep; | |
| 17016 | ✗ | } | |
| 17017 | |||
| 17018 | ✗ | ladderx = oldladderx; | |
| 17019 | ✗ | laddery = oldladdery; | |
| 17020 | |||
| 17021 | ✗ | if(DrunkUp()) | |
| 17022 | { | ||
| 17023 | ✗ | if(xoff && !is_on_conveyor && action != swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking && jumping<1) | |
| 17024 | { | ||
| 17025 | ✗ | if(dir!=up && dir!=down) | |
| 17026 | { | ||
| 17027 | ✗ | if(xoff>2&&xoff<6) | |
| 17028 | { | ||
| 17029 | ✗ | moveOld2(dir); | |
| 17030 | ✗ | } | |
| 17031 | ✗ | else if(xoff>=6) | |
| 17032 | { | ||
| 17033 | ✗ | moveOld2(right); | |
| 17034 | ✗ | } | |
| 17035 | ✗ | else if(xoff>=1) | |
| 17036 | { | ||
| 17037 | ✗ | moveOld2(left); | |
| 17038 | ✗ | } | |
| 17039 | ✗ | } | |
| 17040 | else | ||
| 17041 | { | ||
| 17042 | ✗ | if(xoff>=4) | |
| 17043 | { | ||
| 17044 | ✗ | moveOld2(right); | |
| 17045 | ✗ | } | |
| 17046 | ✗ | else if(xoff<4) | |
| 17047 | { | ||
| 17048 | ✗ | moveOld2(left); | |
| 17049 | ✗ | } | |
| 17050 | } | ||
| 17051 | ✗ | } | |
| 17052 | else | ||
| 17053 | { | ||
| 17054 | ✗ | do | |
| 17055 | { | ||
| 17056 | ✗ | if(action==swimming || IsSideSwim() || action == swimhit) | |
| 17057 | { | ||
| 17058 | ✗ | info = walkflag(temp_x,temp_y+(bigHitbox?0:8)-temp_step,2,up); | |
| 17059 | |||
| 17060 | ✗ | if(_walkflag(temp_x+15, temp_y+(bigHitbox?0:8)-temp_step, 1,SWITCHBLOCK_STATE) && | |
| 17061 | ✗ | !(iswaterex(MAPCOMBO(temp_x, temp_y+(bigHitbox?0:8)-temp_step), currmap, currscr, -1, temp_x, temp_y+(bigHitbox?0:8)-temp_step, true, false) && | |
| 17062 | ✗ | iswaterex(MAPCOMBO(temp_x+15, temp_y+(bigHitbox?0:8)-temp_step), currmap, currscr, -1, temp_x+15, temp_y+(bigHitbox?0:8)-temp_step, true, false))) | |
| 17063 | ✗ | info.setUnwalkable(true); | |
| 17064 | ✗ | } | |
| 17065 | else | ||
| 17066 | { | ||
| 17067 | ✗ | info = walkflag(temp_x,temp_y+(bigHitbox?0:8)-temp_step,2,up); | |
| 17068 | ✗ | if(x.getInt() & 7) | |
| 17069 | ✗ | info = info || walkflag(temp_x+16,temp_y+(bigHitbox?0:8)-temp_step,1,up); | |
| 17070 | else | ||
| 17071 | ✗ | info = info || walkflagMBlock(temp_x+8,temp_y+(bigHitbox?0:8)-temp_step); | |
| 17072 | } | ||
| 17073 | |||
| 17074 | ✗ | if(info.isUnwalkable()) | |
| 17075 | { | ||
| 17076 | ✗ | if(temp_y != int32_t(temp_y)) | |
| 17077 | { | ||
| 17078 | ✗ | temp_y = floor((double)temp_y); | |
| 17079 | ✗ | } | |
| 17080 | ✗ | else if(temp_step > 1) | |
| 17081 | { | ||
| 17082 | ✗ | if(temp_step != int32_t(temp_step)) //floor | |
| 17083 | ✗ | temp_step = floor((double)temp_step); | |
| 17084 | ✗ | else --temp_step; | |
| 17085 | ✗ | } | |
| 17086 | else | ||
| 17087 | ✗ | break; | |
| 17088 | ✗ | } | |
| 17089 | ✗ | } | |
| 17090 | ✗ | while(info.isUnwalkable()); | |
| 17091 | |||
| 17092 | ✗ | execute(info); | |
| 17093 | |||
| 17094 | ✗ | if(!info.isUnwalkable()) | |
| 17095 | { | ||
| 17096 | ✗ | x = temp_x; | |
| 17097 | ✗ | y = temp_y; | |
| 17098 | ✗ | hero_newstep = temp_step; | |
| 17099 | ✗ | moveOld2(up); | |
| 17100 | ✗ | return; | |
| 17101 | } | ||
| 17102 | |||
| 17103 | ✗ | if(!DrunkLeft() && !DrunkRight()) | |
| 17104 | { | ||
| 17105 | ✗ | if(NO_GRIDLOCK) | |
| 17106 | { | ||
| 17107 | ✗ | x = x.getInt(); | |
| 17108 | ✗ | y = y.getInt(); | |
| 17109 | ✗ | if(!_walkflag(x,y+(bigHitbox?0:8)-1,1,SWITCHBLOCK_STATE) && | |
| 17110 | ✗ | !_walkflag(x+8, y+(bigHitbox?0:8)-1,1,SWITCHBLOCK_STATE) && | |
| 17111 | ✗ | _walkflag(x+15,y+(bigHitbox?0:8)-1,1,SWITCHBLOCK_STATE)) | |
| 17112 | { | ||
| 17113 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11),y+(bigHitbox?0:8)-1)) | |
| 17114 | ✗ | sprite::move((zfix)-1,(zfix)0); | |
| 17115 | ✗ | } | |
| 17116 | ✗ | else if(_walkflag(x,y+(bigHitbox?0:8)-1,1,SWITCHBLOCK_STATE) && | |
| 17117 | ✗ | !_walkflag(x+7, y+(bigHitbox?0:8)-1,1,SWITCHBLOCK_STATE) && | |
| 17118 | ✗ | !_walkflag(x+15,y+(bigHitbox?0:8)-1,1,SWITCHBLOCK_STATE)) | |
| 17119 | { | ||
| 17120 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4),y+(bigHitbox?0:8)-1)) | |
| 17121 | ✗ | sprite::move((zfix)1,(zfix)0); | |
| 17122 | ✗ | } | |
| 17123 | else | ||
| 17124 | { | ||
| 17125 | ✗ | pushing=push+1; | |
| 17126 | } | ||
| 17127 | ✗ | } | |
| 17128 | ✗ | else pushing=push+1; | |
| 17129 | |||
| 17130 | ✗ | if(charging==0 && spins==0) | |
| 17131 | { | ||
| 17132 | ✗ | dir=up; | |
| 17133 | ✗ | } | |
| 17134 | |||
| 17135 | ✗ | if(action!=swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking) | |
| 17136 | { | ||
| 17137 | ✗ | herostep(); | |
| 17138 | ✗ | } | |
| 17139 | |||
| 17140 | ✗ | return; | |
| 17141 | } | ||
| 17142 | else | ||
| 17143 | { | ||
| 17144 | ✗ | goto LEFTRIGHT_NEWMOVE; | |
| 17145 | } | ||
| 17146 | } | ||
| 17147 | |||
| 17148 | ✗ | return; | |
| 17149 | } | ||
| 17150 | |||
| 17151 | ✗ | if(DrunkDown()) | |
| 17152 | { | ||
| 17153 | ✗ | if(xoff && !is_on_conveyor && action != swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking && jumping<1) | |
| 17154 | { | ||
| 17155 | ✗ | if(dir!=up && dir!=down) | |
| 17156 | { | ||
| 17157 | ✗ | if(xoff>2&&xoff<6) | |
| 17158 | { | ||
| 17159 | ✗ | moveOld2(dir); | |
| 17160 | ✗ | } | |
| 17161 | ✗ | else if(xoff>=6) | |
| 17162 | { | ||
| 17163 | ✗ | moveOld2(right); | |
| 17164 | ✗ | } | |
| 17165 | ✗ | else if(xoff>=1) | |
| 17166 | { | ||
| 17167 | ✗ | moveOld2(left); | |
| 17168 | ✗ | } | |
| 17169 | ✗ | } | |
| 17170 | else | ||
| 17171 | { | ||
| 17172 | ✗ | if(xoff>=4) | |
| 17173 | { | ||
| 17174 | ✗ | moveOld2(right); | |
| 17175 | ✗ | } | |
| 17176 | ✗ | else if(xoff<4) | |
| 17177 | { | ||
| 17178 | ✗ | moveOld2(left); | |
| 17179 | ✗ | } | |
| 17180 | } | ||
| 17181 | ✗ | } | |
| 17182 | else | ||
| 17183 | { | ||
| 17184 | ✗ | do | |
| 17185 | { | ||
| 17186 | ✗ | if(action==swimming || IsSideSwim() || action == swimhit) | |
| 17187 | { | ||
| 17188 | ✗ | info=walkflag(temp_x,temp_y+15+temp_step,2,down); | |
| 17189 | |||
| 17190 | ✗ | if(_walkflag(temp_x+15, temp_y+15+temp_step, 1,SWITCHBLOCK_STATE) && | |
| 17191 | ✗ | !(iswaterex(MAPCOMBO(temp_x, temp_y+15+temp_step), currmap, currscr, -1, temp_x, temp_y+15+temp_step, true, false) && | |
| 17192 | ✗ | iswaterex(MAPCOMBO(temp_x+15, temp_y+15+temp_step), currmap, currscr, -1, temp_x+15, temp_y+15+temp_step, true, false))) | |
| 17193 | ✗ | info.setUnwalkable(true); | |
| 17194 | ✗ | } | |
| 17195 | else | ||
| 17196 | { | ||
| 17197 | ✗ | info=walkflag(temp_x,temp_y+15+temp_step,2,down); | |
| 17198 | ✗ | if(x.getInt() & 7) | |
| 17199 | ✗ | info = info || walkflag(temp_x+16,temp_y+15+temp_step,1,down); | |
| 17200 | else | ||
| 17201 | ✗ | info = info || walkflagMBlock(temp_x+8,temp_y+15+temp_step); | |
| 17202 | } | ||
| 17203 | |||
| 17204 | ✗ | if(info.isUnwalkable()) | |
| 17205 | { | ||
| 17206 | ✗ | if(temp_y != int32_t(temp_y)) | |
| 17207 | { | ||
| 17208 | ✗ | temp_y = floor((double)temp_y); | |
| 17209 | ✗ | } | |
| 17210 | ✗ | else if(temp_step > 1) | |
| 17211 | { | ||
| 17212 | ✗ | if(temp_step != int32_t(temp_step)) //floor | |
| 17213 | ✗ | temp_step = floor((double)temp_step); | |
| 17214 | ✗ | else --temp_step; | |
| 17215 | ✗ | } | |
| 17216 | else | ||
| 17217 | ✗ | break; | |
| 17218 | ✗ | } | |
| 17219 | ✗ | } | |
| 17220 | ✗ | while(info.isUnwalkable()); | |
| 17221 | |||
| 17222 | ✗ | execute(info); | |
| 17223 | |||
| 17224 | ✗ | if(!info.isUnwalkable()) | |
| 17225 | { | ||
| 17226 | ✗ | x = temp_x; | |
| 17227 | ✗ | y = temp_y; | |
| 17228 | ✗ | hero_newstep = temp_step; | |
| 17229 | ✗ | moveOld2(down); | |
| 17230 | ✗ | return; | |
| 17231 | } | ||
| 17232 | |||
| 17233 | ✗ | if(!DrunkLeft() && !DrunkRight()) | |
| 17234 | { | ||
| 17235 | ✗ | if(NO_GRIDLOCK) | |
| 17236 | { | ||
| 17237 | ✗ | x = x.getInt(); | |
| 17238 | ✗ | y = y.getInt(); | |
| 17239 | ✗ | if(!_walkflag(x, y+15+1,1,SWITCHBLOCK_STATE)&& | |
| 17240 | ✗ | !_walkflag(x+8, y+15+1,1,SWITCHBLOCK_STATE)&& | |
| 17241 | ✗ | _walkflag(x+15,y+15+1,1,SWITCHBLOCK_STATE)) | |
| 17242 | { | ||
| 17243 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11),y+15+1)) | |
| 17244 | ✗ | sprite::move((zfix)-1,(zfix)0); | |
| 17245 | ✗ | } | |
| 17246 | ✗ | else if(_walkflag(x, y+15+1,1,SWITCHBLOCK_STATE)&& | |
| 17247 | ✗ | !_walkflag(x+7, y+15+1,1,SWITCHBLOCK_STATE)&& | |
| 17248 | ✗ | !_walkflag(x+15,y+15+1,1,SWITCHBLOCK_STATE)) | |
| 17249 | { | ||
| 17250 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4),y+15+1)) | |
| 17251 | ✗ | sprite::move((zfix)1,(zfix)0); | |
| 17252 | ✗ | } | |
| 17253 | else | ||
| 17254 | { | ||
| 17255 | ✗ | pushing=push+1; | |
| 17256 | } | ||
| 17257 | ✗ | } | |
| 17258 | ✗ | else pushing=push+1; | |
| 17259 | |||
| 17260 | ✗ | if(charging==0 && spins==0) | |
| 17261 | { | ||
| 17262 | ✗ | dir=down; | |
| 17263 | ✗ | } | |
| 17264 | |||
| 17265 | ✗ | if(action!=swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking) | |
| 17266 | { | ||
| 17267 | ✗ | herostep(); | |
| 17268 | ✗ | } | |
| 17269 | |||
| 17270 | ✗ | return; | |
| 17271 | } | ||
| 17272 | ✗ | else goto LEFTRIGHT_NEWMOVE; | |
| 17273 | } | ||
| 17274 | |||
| 17275 | ✗ | return; | |
| 17276 | } | ||
| 17277 | |||
| 17278 | LEFTRIGHT_NEWMOVE: | ||
| 17279 | ✗ | temp_x = x; | |
| 17280 | ✗ | temp_y = y; | |
| 17281 | ✗ | temp_step = hero_newstep; | |
| 17282 | ✗ | if(isdungeon() && (temp_y<=26 || temp_y>=134) && !get_qr(qr_FREEFORM) && !toogam) | |
| 17283 | { | ||
| 17284 | ✗ | return; | |
| 17285 | } | ||
| 17286 | |||
| 17287 | ✗ | if(DrunkLeft()) | |
| 17288 | { | ||
| 17289 | ✗ | if(yoff && !is_on_conveyor && action != swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking && jumping<1) | |
| 17290 | { | ||
| 17291 | ✗ | if(dir!=left && dir!=right) | |
| 17292 | { | ||
| 17293 | ✗ | if(yoff>2&&yoff<6) | |
| 17294 | { | ||
| 17295 | ✗ | moveOld2(dir); | |
| 17296 | ✗ | } | |
| 17297 | ✗ | else if(yoff>=6) | |
| 17298 | { | ||
| 17299 | ✗ | moveOld2(down); | |
| 17300 | ✗ | } | |
| 17301 | ✗ | else if(yoff>=1) | |
| 17302 | { | ||
| 17303 | ✗ | moveOld2(up); | |
| 17304 | ✗ | } | |
| 17305 | ✗ | } | |
| 17306 | else | ||
| 17307 | { | ||
| 17308 | ✗ | if(yoff>=4) | |
| 17309 | { | ||
| 17310 | ✗ | moveOld2(down); | |
| 17311 | ✗ | } | |
| 17312 | ✗ | else if(yoff<4) | |
| 17313 | { | ||
| 17314 | ✗ | moveOld2(up); | |
| 17315 | ✗ | } | |
| 17316 | } | ||
| 17317 | ✗ | } | |
| 17318 | else | ||
| 17319 | { | ||
| 17320 | ✗ | do | |
| 17321 | { | ||
| 17322 | ✗ | info = walkflag(temp_x-temp_step,temp_y+(bigHitbox?0:8),1,left) || | |
| 17323 | ✗ | walkflag(temp_x-temp_step,temp_y+(isSideViewHero() ?0:8), 1,left); | |
| 17324 | |||
| 17325 | ✗ | if(y.getInt() & 7) | |
| 17326 | ✗ | info = info || walkflag(temp_x-temp_step,temp_y+16,1,left); | |
| 17327 | |||
| 17328 | ✗ | if(info.isUnwalkable()) | |
| 17329 | { | ||
| 17330 | ✗ | if(temp_x != int32_t(temp_x)) | |
| 17331 | { | ||
| 17332 | ✗ | temp_x = floor((double)temp_x); | |
| 17333 | ✗ | } | |
| 17334 | ✗ | else if(temp_step > 1) | |
| 17335 | { | ||
| 17336 | ✗ | if(temp_step != int32_t(temp_step)) //floor | |
| 17337 | ✗ | temp_step = floor((double)temp_step); | |
| 17338 | ✗ | else --temp_step; | |
| 17339 | ✗ | } | |
| 17340 | else | ||
| 17341 | ✗ | break; | |
| 17342 | ✗ | } | |
| 17343 | ✗ | } | |
| 17344 | ✗ | while(info.isUnwalkable()); | |
| 17345 | |||
| 17346 | ✗ | execute(info); | |
| 17347 | |||
| 17348 | ✗ | if(!info.isUnwalkable()) | |
| 17349 | { | ||
| 17350 | ✗ | x = temp_x; | |
| 17351 | ✗ | y = temp_y; | |
| 17352 | ✗ | hero_newstep = temp_step; | |
| 17353 | ✗ | moveOld2(left); | |
| 17354 | ✗ | return; | |
| 17355 | } | ||
| 17356 | |||
| 17357 | ✗ | if(!DrunkUp() && !DrunkDown()) | |
| 17358 | { | ||
| 17359 | ✗ | if(NO_GRIDLOCK) | |
| 17360 | { | ||
| 17361 | ✗ | x = x.getInt(); | |
| 17362 | ✗ | y = y.getInt(); | |
| 17363 | ✗ | int32_t v1=bigHitbox?0:8; | |
| 17364 | ✗ | int32_t v2=bigHitbox?8:12; | |
| 17365 | |||
| 17366 | ✗ | if(!_walkflag(x-1,y+v1,1,SWITCHBLOCK_STATE)&& | |
| 17367 | ✗ | !_walkflag(x-1,y+v2,1,SWITCHBLOCK_STATE)&& | |
| 17368 | ✗ | _walkflag(x-1,y+15,1,SWITCHBLOCK_STATE)) | |
| 17369 | { | ||
| 17370 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x-1,y+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11))) | |
| 17371 | ✗ | sprite::move((zfix)0,(zfix)-1); | |
| 17372 | ✗ | } | |
| 17373 | ✗ | else if(_walkflag(x-1,y+v1,1,SWITCHBLOCK_STATE)&& | |
| 17374 | ✗ | !_walkflag(x-1,y+v2-1,1,SWITCHBLOCK_STATE)&& | |
| 17375 | ✗ | !_walkflag(x-1,y+15, 1,SWITCHBLOCK_STATE)) | |
| 17376 | { | ||
| 17377 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x-1,y+v1+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4))) | |
| 17378 | ✗ | sprite::move((zfix)0,(zfix)1); | |
| 17379 | ✗ | } | |
| 17380 | else | ||
| 17381 | { | ||
| 17382 | ✗ | pushing=push+1; | |
| 17383 | } | ||
| 17384 | ✗ | } | |
| 17385 | ✗ | else pushing=push+1; | |
| 17386 | |||
| 17387 | ✗ | if(charging==0 && spins==0) | |
| 17388 | { | ||
| 17389 | ✗ | dir=left; | |
| 17390 | ✗ | } | |
| 17391 | |||
| 17392 | ✗ | if(action!=swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking) | |
| 17393 | { | ||
| 17394 | ✗ | herostep(); | |
| 17395 | ✗ | } | |
| 17396 | |||
| 17397 | ✗ | return; | |
| 17398 | } | ||
| 17399 | } | ||
| 17400 | |||
| 17401 | ✗ | return; | |
| 17402 | } | ||
| 17403 | |||
| 17404 | ✗ | if(DrunkRight()) | |
| 17405 | { | ||
| 17406 | ✗ | if(yoff && !is_on_conveyor && action != swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking && jumping<1) | |
| 17407 | { | ||
| 17408 | ✗ | if(dir!=left && dir!=right) | |
| 17409 | { | ||
| 17410 | ✗ | if(yoff>2&&yoff<6) | |
| 17411 | { | ||
| 17412 | ✗ | moveOld2(dir); | |
| 17413 | ✗ | } | |
| 17414 | ✗ | else if(yoff>=6) | |
| 17415 | { | ||
| 17416 | ✗ | moveOld2(down); | |
| 17417 | ✗ | } | |
| 17418 | ✗ | else if(yoff>=1) | |
| 17419 | { | ||
| 17420 | ✗ | moveOld2(up); | |
| 17421 | ✗ | } | |
| 17422 | ✗ | } | |
| 17423 | else | ||
| 17424 | { | ||
| 17425 | ✗ | if(yoff>=4) | |
| 17426 | { | ||
| 17427 | ✗ | moveOld2(down); | |
| 17428 | ✗ | } | |
| 17429 | ✗ | else if(yoff<4) | |
| 17430 | { | ||
| 17431 | ✗ | moveOld2(up); | |
| 17432 | ✗ | } | |
| 17433 | } | ||
| 17434 | ✗ | } | |
| 17435 | else | ||
| 17436 | { | ||
| 17437 | ✗ | do | |
| 17438 | { | ||
| 17439 | ✗ | info = walkflag(temp_x+15+temp_step,temp_y+(bigHitbox?0:8),1,right) || | |
| 17440 | ✗ | walkflag(temp_x+15+temp_step,temp_y+(isSideViewHero() ?0:8),1,right); | |
| 17441 | |||
| 17442 | ✗ | if(y.getInt() & 7) | |
| 17443 | ✗ | info = info || walkflag(temp_x+15+temp_step,y+16,1,right); | |
| 17444 | |||
| 17445 | ✗ | if(info.isUnwalkable()) | |
| 17446 | { | ||
| 17447 | ✗ | if(temp_x != int32_t(temp_x)) | |
| 17448 | { | ||
| 17449 | ✗ | temp_x = floor((double)temp_x); | |
| 17450 | ✗ | } | |
| 17451 | ✗ | else if(temp_step > 1) | |
| 17452 | { | ||
| 17453 | ✗ | if(temp_step != int32_t(temp_step)) //floor | |
| 17454 | ✗ | temp_step = floor((double)temp_step); | |
| 17455 | ✗ | else --temp_step; | |
| 17456 | ✗ | } | |
| 17457 | else | ||
| 17458 | ✗ | break; | |
| 17459 | ✗ | } | |
| 17460 | ✗ | } | |
| 17461 | ✗ | while(info.isUnwalkable()); | |
| 17462 | |||
| 17463 | ✗ | execute(info); | |
| 17464 | |||
| 17465 | ✗ | if(!info.isUnwalkable()) | |
| 17466 | { | ||
| 17467 | ✗ | x = temp_x; | |
| 17468 | ✗ | y = temp_y; | |
| 17469 | ✗ | hero_newstep = temp_step; | |
| 17470 | ✗ | moveOld2(right); | |
| 17471 | ✗ | return; | |
| 17472 | } | ||
| 17473 | |||
| 17474 | ✗ | if(!DrunkUp() && !DrunkDown()) | |
| 17475 | { | ||
| 17476 | ✗ | if(NO_GRIDLOCK) | |
| 17477 | { | ||
| 17478 | ✗ | x = x.getInt(); | |
| 17479 | ✗ | y = y.getInt(); | |
| 17480 | ✗ | int32_t v1=bigHitbox?0:8; | |
| 17481 | ✗ | int32_t v2=bigHitbox?8:12; | |
| 17482 | |||
| 17483 | ✗ | if(!_walkflag(x+16,y+v1,1,SWITCHBLOCK_STATE)&& | |
| 17484 | ✗ | !_walkflag(x+16,y+v2,1,SWITCHBLOCK_STATE)&& | |
| 17485 | ✗ | _walkflag(x+16,y+15,1,SWITCHBLOCK_STATE)) | |
| 17486 | { | ||
| 17487 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+16,y+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11))) | |
| 17488 | ✗ | sprite::move((zfix)0,(zfix)-1); | |
| 17489 | ✗ | } | |
| 17490 | ✗ | else if(_walkflag(x+16,y+v1,1,SWITCHBLOCK_STATE)&& | |
| 17491 | ✗ | !_walkflag(x+16,y+v2-1,1,SWITCHBLOCK_STATE)&& | |
| 17492 | ✗ | !_walkflag(x+16,y+15,1,SWITCHBLOCK_STATE)) | |
| 17493 | { | ||
| 17494 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+16,y+v1+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4))) | |
| 17495 | ✗ | sprite::move((zfix)0,(zfix)1); | |
| 17496 | ✗ | } | |
| 17497 | else | ||
| 17498 | { | ||
| 17499 | ✗ | pushing=push+1; | |
| 17500 | } | ||
| 17501 | ✗ | } | |
| 17502 | ✗ | else pushing=push+1; | |
| 17503 | |||
| 17504 | ✗ | if(charging==0 && spins==0) | |
| 17505 | { | ||
| 17506 | ✗ | dir=right; | |
| 17507 | ✗ | } | |
| 17508 | |||
| 17509 | ✗ | if(action!=swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking) | |
| 17510 | { | ||
| 17511 | ✗ | herostep(); | |
| 17512 | ✗ | } | |
| 17513 | |||
| 17514 | ✗ | return; | |
| 17515 | } | ||
| 17516 | } | ||
| 17517 | ✗ | } | |
| 17518 | ✗ | } | |
| 17519 | else | ||
| 17520 | { | ||
| 17521 | 7437322 | info = walkflag(x-int32_t(lsteps[x.getInt()&7]),y+(bigHitbox?0:8),1,left) || | |
| 17522 | 3718661 | walkflag(x-int32_t(lsteps[x.getInt()&7]),y+8,1,left); | |
| 17523 | |||
| 17524 |
10/10✓ Branch 0 taken 2412266 times.
✓ Branch 1 taken 1306395 times.
✓ Branch 2 taken 304260 times.
✓ Branch 3 taken 2108006 times.
✓ Branch 4 taken 186351 times.
✓ Branch 5 taken 117909 times.
✓ Branch 6 taken 1889 times.
✓ Branch 7 taken 184462 times.
✓ Branch 8 taken 358 times.
✓ Branch 9 taken 1531 times.
|
3718661 | if(isdungeon() && DrunkLeft() && !info.isUnwalkable() && (x==32 && y==80)) |
| 17525 | { | ||
| 17526 | //ONLY process the side-effects of the above walkflag if Hero will actually move | ||
| 17527 | //sigh sigh sigh... walkflag is a horrible mess :-/ -DD | ||
| 17528 | 1531 | execute(info); | |
| 17529 | 1531 | moveOld2(left); | |
| 17530 | 1531 | return; | |
| 17531 | } | ||
| 17532 | |||
| 17533 | 7434260 | info = walkflag(x+15+int32_t(lsteps[x.getInt()&7]),y+(bigHitbox?0:8),1,right) || | |
| 17534 | 3717130 | walkflag(x+15+int32_t(lsteps[x.getInt()&7]),y+8,1,right); | |
| 17535 | |||
| 17536 |
10/10✓ Branch 0 taken 2410735 times.
✓ Branch 1 taken 1306395 times.
✓ Branch 2 taken 337875 times.
✓ Branch 3 taken 2072860 times.
✓ Branch 4 taken 201206 times.
✓ Branch 5 taken 136669 times.
✓ Branch 6 taken 2221 times.
✓ Branch 7 taken 198985 times.
✓ Branch 8 taken 406 times.
✓ Branch 9 taken 1815 times.
|
3717130 | if(isdungeon() && DrunkRight() && !info.isUnwalkable() && x==208 && y==80) |
| 17537 | { | ||
| 17538 | 1815 | execute(info); | |
| 17539 | 1815 | moveOld2(right); | |
| 17540 | 1815 | return; | |
| 17541 | } | ||
| 17542 | |||
| 17543 | 3715315 | ladderx = oldladderx; | |
| 17544 | 3715315 | laddery = oldladdery; | |
| 17545 | |||
| 17546 |
2/2✓ Branch 0 taken 416012 times.
✓ Branch 1 taken 3299303 times.
|
3715315 | if(DrunkUp()) |
| 17547 | { | ||
| 17548 |
11/14✓ Branch 0 taken 11758 times.
✓ Branch 1 taken 404254 times.
✓ Branch 2 taken 10987 times.
✓ Branch 3 taken 771 times.
✓ Branch 4 taken 8232 times.
✓ Branch 5 taken 2755 times.
✓ Branch 6 taken 8232 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 8232 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 8232 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 3 times.
✓ Branch 13 taken 8229 times.
|
416012 | if(xoff && !is_on_conveyor && action != swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking && jumping<1) |
| 17549 | { | ||
| 17550 |
4/4✓ Branch 0 taken 8195 times.
✓ Branch 1 taken 34 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 8194 times.
|
8229 | if(dir!=up && dir!=down) |
| 17551 | { | ||
| 17552 |
4/4✓ Branch 0 taken 5693 times.
✓ Branch 1 taken 2501 times.
✓ Branch 2 taken 2427 times.
✓ Branch 3 taken 3266 times.
|
8194 | if(xoff>2&&xoff<6) |
| 17553 | { | ||
| 17554 | 3266 | moveOld2(dir); | |
| 17555 | 3266 | } | |
| 17556 |
2/2✓ Branch 0 taken 2427 times.
✓ Branch 1 taken 2501 times.
|
4928 | else if(xoff>=6) |
| 17557 | { | ||
| 17558 | 2427 | moveOld2(right); | |
| 17559 | 2427 | } | |
| 17560 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2501 times.
|
2501 | else if(xoff>=1) |
| 17561 | { | ||
| 17562 | 2501 | moveOld2(left); | |
| 17563 | 2501 | } | |
| 17564 | 8194 | } | |
| 17565 | else | ||
| 17566 | { | ||
| 17567 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 25 times.
|
35 | if(xoff>=4) |
| 17568 | { | ||
| 17569 | 10 | moveOld2(right); | |
| 17570 | 10 | } | |
| 17571 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 25 times.
|
25 | else if(xoff<4) |
| 17572 | { | ||
| 17573 | 25 | moveOld2(left); | |
| 17574 | 25 | } | |
| 17575 | } | ||
| 17576 | 8229 | } | |
| 17577 | else | ||
| 17578 | { | ||
| 17579 |
4/6✓ Branch 0 taken 381403 times.
✓ Branch 1 taken 26380 times.
✓ Branch 2 taken 381403 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 381403 times.
|
407783 | if(action==swimming || IsSideSwim() || action == swimhit) |
| 17580 | { | ||
| 17581 | 26380 | info = walkflag(x,y+(bigHitbox?0:8)-int32_t(lsteps[y.getInt()&7]),2,up); | |
| 17582 | |||
| 17583 |
6/8✗ Branch 0 not taken.
✓ Branch 1 taken 26380 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 26380 times.
✓ Branch 4 taken 2023 times.
✓ Branch 5 taken 24357 times.
✓ Branch 6 taken 21669 times.
✓ Branch 7 taken 4711 times.
|
50737 | if(_walkflag(x+15, y+(bigHitbox?0:8)-int32_t(lsteps[y.getInt()&7]), 1,SWITCHBLOCK_STATE) && |
| 17584 |
2/2✓ Branch 0 taken 4471 times.
✓ Branch 1 taken 19886 times.
|
44243 | !(iswaterex(MAPCOMBO(x, y+(bigHitbox?0:8)-int32_t(lsteps[y.getInt()&7])), currmap, currscr, -1, x, y+(bigHitbox?0:8)-int32_t(lsteps[y.getInt()&7])) && |
| 17585 | 19886 | iswaterex(MAPCOMBO(x+15, y+(bigHitbox?0:8)-int32_t(lsteps[y.getInt()&7])), currmap, currscr, -1, x+15, y+(bigHitbox?0:8)-int32_t(lsteps[y.getInt()&7])))) | |
| 17586 | 4711 | info.setUnwalkable(true); | |
| 17587 | 26380 | } | |
| 17588 | else | ||
| 17589 | { | ||
| 17590 | 381403 | info = walkflag(x,y+(bigHitbox?0:8)-int32_t(lsteps[y.getInt()&7]),2,up); | |
| 17591 |
2/2✓ Branch 0 taken 777 times.
✓ Branch 1 taken 380626 times.
|
381403 | if(x.getInt() & 7) |
| 17592 | 777 | info = info || walkflag(x+16,y+(bigHitbox?0:8)-int32_t(lsteps[y.getInt()&7]),1,up); | |
| 17593 | else | ||
| 17594 | 380626 | info = info || walkflagMBlock(x+8,y+(bigHitbox?0:8)-int32_t(lsteps[y.getInt()&7])); | |
| 17595 | } | ||
| 17596 | |||
| 17597 | 407783 | execute(info); | |
| 17598 | |||
| 17599 |
2/2✓ Branch 0 taken 169866 times.
✓ Branch 1 taken 237917 times.
|
407783 | if(!info.isUnwalkable()) |
| 17600 | { | ||
| 17601 | 237917 | moveOld2(up); | |
| 17602 | 237917 | return; | |
| 17603 | } | ||
| 17604 | |||
| 17605 |
4/4✓ Branch 0 taken 151084 times.
✓ Branch 1 taken 18782 times.
✓ Branch 2 taken 18777 times.
✓ Branch 3 taken 132307 times.
|
169866 | if(!DrunkLeft() && !DrunkRight()) |
| 17606 | { | ||
| 17607 |
2/4✓ Branch 0 taken 132307 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 132307 times.
|
132307 | if(NO_GRIDLOCK) |
| 17608 | { | ||
| 17609 | ✗ | if(!_walkflag(x,y+(bigHitbox?0:8)-1,1,SWITCHBLOCK_STATE) && | |
| 17610 | ✗ | !_walkflag(x+8, y+(bigHitbox?0:8)-1,1,SWITCHBLOCK_STATE) && | |
| 17611 | ✗ | _walkflag(x+15,y+(bigHitbox?0:8)-1,1,SWITCHBLOCK_STATE)) | |
| 17612 | { | ||
| 17613 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11),y+(bigHitbox?0:8)-1)) | |
| 17614 | ✗ | sprite::move((zfix)-1,(zfix)0); | |
| 17615 | ✗ | } | |
| 17616 | ✗ | else if(_walkflag(x,y+(bigHitbox?0:8)-1,1,SWITCHBLOCK_STATE) && | |
| 17617 | ✗ | !_walkflag(x+7, y+(bigHitbox?0:8)-1,1,SWITCHBLOCK_STATE) && | |
| 17618 | ✗ | !_walkflag(x+15,y+(bigHitbox?0:8)-1,1,SWITCHBLOCK_STATE)) | |
| 17619 | { | ||
| 17620 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4),y+(bigHitbox?0:8)-1)) | |
| 17621 | ✗ | sprite::move((zfix)1,(zfix)0); | |
| 17622 | ✗ | } | |
| 17623 | else | ||
| 17624 | { | ||
| 17625 | ✗ | pushing=push+1; | |
| 17626 | } | ||
| 17627 | ✗ | } | |
| 17628 | 132307 | else pushing=push+1; | |
| 17629 | |||
| 17630 |
4/4✓ Branch 0 taken 132124 times.
✓ Branch 1 taken 183 times.
✓ Branch 2 taken 96 times.
✓ Branch 3 taken 132028 times.
|
132307 | if(charging==0 && spins==0) |
| 17631 | { | ||
| 17632 | 132028 | dir=up; | |
| 17633 | 132028 | } | |
| 17634 | |||
| 17635 |
5/8✓ Branch 0 taken 129280 times.
✓ Branch 1 taken 3027 times.
✓ Branch 2 taken 129280 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 129280 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 129280 times.
|
132307 | if(action!=swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking) |
| 17636 | { | ||
| 17637 | 129280 | herostep(); | |
| 17638 | 129280 | } | |
| 17639 | |||
| 17640 | 132307 | return; | |
| 17641 | } | ||
| 17642 | else | ||
| 17643 | { | ||
| 17644 | 37559 | goto LEFTRIGHT_OLDMOVE; | |
| 17645 | } | ||
| 17646 | } | ||
| 17647 | |||
| 17648 | 8229 | return; | |
| 17649 | } | ||
| 17650 | |||
| 17651 |
2/2✓ Branch 0 taken 370268 times.
✓ Branch 1 taken 2929035 times.
|
3299303 | if(DrunkDown()) |
| 17652 | { | ||
| 17653 |
11/14✓ Branch 0 taken 10692 times.
✓ Branch 1 taken 359576 times.
✓ Branch 2 taken 9973 times.
✓ Branch 3 taken 719 times.
✓ Branch 4 taken 6692 times.
✓ Branch 5 taken 3281 times.
✓ Branch 6 taken 6692 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 6692 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 6692 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1 times.
✓ Branch 13 taken 6691 times.
|
370268 | if(xoff && !is_on_conveyor && action != swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking && jumping<1) |
| 17654 | { | ||
| 17655 |
3/4✓ Branch 0 taken 6691 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 6688 times.
|
6691 | if(dir!=up && dir!=down) |
| 17656 | { | ||
| 17657 |
4/4✓ Branch 0 taken 4674 times.
✓ Branch 1 taken 2014 times.
✓ Branch 2 taken 2000 times.
✓ Branch 3 taken 2674 times.
|
6688 | if(xoff>2&&xoff<6) |
| 17658 | { | ||
| 17659 | 2674 | moveOld2(dir); | |
| 17660 | 2674 | } | |
| 17661 |
2/2✓ Branch 0 taken 2000 times.
✓ Branch 1 taken 2014 times.
|
4014 | else if(xoff>=6) |
| 17662 | { | ||
| 17663 | 2000 | moveOld2(right); | |
| 17664 | 2000 | } | |
| 17665 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2014 times.
|
2014 | else if(xoff>=1) |
| 17666 | { | ||
| 17667 | 2014 | moveOld2(left); | |
| 17668 | 2014 | } | |
| 17669 | 6688 | } | |
| 17670 | else | ||
| 17671 | { | ||
| 17672 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if(xoff>=4) |
| 17673 | { | ||
| 17674 | 3 | moveOld2(right); | |
| 17675 | 3 | } | |
| 17676 | ✗ | else if(xoff<4) | |
| 17677 | { | ||
| 17678 | ✗ | moveOld2(left); | |
| 17679 | ✗ | } | |
| 17680 | } | ||
| 17681 | 6691 | } | |
| 17682 | else | ||
| 17683 | { | ||
| 17684 |
4/6✓ Branch 0 taken 340051 times.
✓ Branch 1 taken 23526 times.
✓ Branch 2 taken 340051 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 340051 times.
|
363577 | if(action==swimming || IsSideSwim() || action == swimhit) |
| 17685 | { | ||
| 17686 | 23526 | info=walkflag(x,y+15+int32_t(lsteps[y.getInt()&7]),2,down); | |
| 17687 | |||
| 17688 |
6/8✗ Branch 0 not taken.
✓ Branch 1 taken 23526 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 23526 times.
✓ Branch 4 taken 2312 times.
✓ Branch 5 taken 21214 times.
✓ Branch 6 taken 17545 times.
✓ Branch 7 taken 5981 times.
|
44740 | if(_walkflag(x+15, y+15+int32_t(lsteps[y.getInt()&7]), 1,SWITCHBLOCK_STATE) && |
| 17689 |
2/2✓ Branch 0 taken 5786 times.
✓ Branch 1 taken 15428 times.
|
36642 | !(iswaterex(MAPCOMBO(x, y+15+int32_t(lsteps[y.getInt()&7])), currmap, currscr, -1, x, y+15+int32_t(lsteps[y.getInt()&7])) && |
| 17690 | 15428 | iswaterex(MAPCOMBO(x+15, y+15+int32_t(lsteps[y.getInt()&7])), currmap, currscr, -1, x+15, y+15+int32_t(lsteps[y.getInt()&7])))) | |
| 17691 | 5981 | info.setUnwalkable(true); | |
| 17692 | 23526 | } | |
| 17693 | else | ||
| 17694 | { | ||
| 17695 | 340051 | info=walkflag(x,y+15+int32_t(lsteps[y.getInt()&7]),2,down); | |
| 17696 |
2/2✓ Branch 0 taken 724 times.
✓ Branch 1 taken 339327 times.
|
340051 | if(x.getInt() & 7) |
| 17697 | 724 | info = (info || walkflag(x+16,y+15+int32_t(lsteps[y.getInt()&7]),1,down)); | |
| 17698 | else | ||
| 17699 | 339327 | info = (info || walkflagMBlock(x+8,y+15+int32_t(lsteps[y.getInt()&7]))); | |
| 17700 | } | ||
| 17701 | |||
| 17702 | 363577 | execute(info); | |
| 17703 | |||
| 17704 |
2/2✓ Branch 0 taken 167095 times.
✓ Branch 1 taken 196482 times.
|
363577 | if(!info.isUnwalkable()) |
| 17705 | { | ||
| 17706 | 196482 | moveOld2(down); | |
| 17707 | 196482 | return; | |
| 17708 | } | ||
| 17709 | |||
| 17710 |
4/4✓ Branch 0 taken 146281 times.
✓ Branch 1 taken 20814 times.
✓ Branch 2 taken 20409 times.
✓ Branch 3 taken 125872 times.
|
167095 | if(!DrunkLeft() && !DrunkRight()) |
| 17711 | { | ||
| 17712 |
2/4✓ Branch 0 taken 125872 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 125872 times.
|
125872 | if(NO_GRIDLOCK) |
| 17713 | { | ||
| 17714 | ✗ | if(!_walkflag(x, y+15+1,1,SWITCHBLOCK_STATE)&& | |
| 17715 | ✗ | !_walkflag(x+8, y+15+1,1,SWITCHBLOCK_STATE)&& | |
| 17716 | ✗ | _walkflag(x+15,y+15+1,1,SWITCHBLOCK_STATE)) | |
| 17717 | { | ||
| 17718 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11),y+15+1)) | |
| 17719 | ✗ | sprite::move((zfix)-1,(zfix)0); | |
| 17720 | ✗ | } | |
| 17721 | ✗ | else if(_walkflag(x, y+15+1,1,SWITCHBLOCK_STATE)&& | |
| 17722 | ✗ | !_walkflag(x+7, y+15+1,1,SWITCHBLOCK_STATE)&& | |
| 17723 | ✗ | !_walkflag(x+15,y+15+1,1,SWITCHBLOCK_STATE)) | |
| 17724 | { | ||
| 17725 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4),y+15+1)) | |
| 17726 | ✗ | sprite::move((zfix)1,(zfix)0); | |
| 17727 | ✗ | } | |
| 17728 | else | ||
| 17729 | { | ||
| 17730 | ✗ | pushing=push+1; | |
| 17731 | } | ||
| 17732 | ✗ | } | |
| 17733 | 125872 | else pushing=push+1; | |
| 17734 | |||
| 17735 |
2/4✓ Branch 0 taken 125872 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 125872 times.
|
125872 | if(charging==0 && spins==0) |
| 17736 | { | ||
| 17737 | 125872 | dir=down; | |
| 17738 | 125872 | } | |
| 17739 | |||
| 17740 |
5/8✓ Branch 0 taken 123206 times.
✓ Branch 1 taken 2666 times.
✓ Branch 2 taken 123206 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 123206 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 123206 times.
|
125872 | if(action!=swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking) |
| 17741 | { | ||
| 17742 | 123206 | herostep(); | |
| 17743 | 123206 | } | |
| 17744 | |||
| 17745 | 125872 | return; | |
| 17746 | } | ||
| 17747 | 41223 | else goto LEFTRIGHT_OLDMOVE; | |
| 17748 | } | ||
| 17749 | |||
| 17750 | 6691 | return; | |
| 17751 | } | ||
| 17752 | |||
| 17753 | LEFTRIGHT_OLDMOVE: | ||
| 17754 | |||
| 17755 |
7/8✓ Branch 0 taken 2014752 times.
✓ Branch 1 taken 1052471 times.
✓ Branch 2 taken 1959398 times.
✓ Branch 3 taken 55354 times.
✓ Branch 4 taken 55639 times.
✓ Branch 5 taken 1959113 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 55639 times.
|
3067223 | if(isdungeon() && (y<=26 || y>=134) && !get_qr(qr_FREEFORM) && !toogam) |
| 17756 | { | ||
| 17757 | 55639 | return; | |
| 17758 | } | ||
| 17759 | |||
| 17760 |
2/2✓ Branch 0 taken 462595 times.
✓ Branch 1 taken 2548989 times.
|
3011584 | if(DrunkLeft()) |
| 17761 | { | ||
| 17762 |
11/14✓ Branch 0 taken 8414 times.
✓ Branch 1 taken 454181 times.
✓ Branch 2 taken 7961 times.
✓ Branch 3 taken 453 times.
✓ Branch 4 taken 7342 times.
✓ Branch 5 taken 619 times.
✓ Branch 6 taken 7342 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 7342 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 7342 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 2 times.
✓ Branch 13 taken 7340 times.
|
462595 | if(yoff && !is_on_conveyor && action != swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking && jumping<1) |
| 17763 | { | ||
| 17764 |
3/4✓ Branch 0 taken 7331 times.
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7331 times.
|
7340 | if(dir!=left && dir!=right) |
| 17765 | { | ||
| 17766 |
4/4✓ Branch 0 taken 5179 times.
✓ Branch 1 taken 2152 times.
✓ Branch 2 taken 2239 times.
✓ Branch 3 taken 2940 times.
|
7331 | if(yoff>2&&yoff<6) |
| 17767 | { | ||
| 17768 | 2940 | moveOld2(dir); | |
| 17769 | 2940 | } | |
| 17770 |
2/2✓ Branch 0 taken 2239 times.
✓ Branch 1 taken 2152 times.
|
4391 | else if(yoff>=6) |
| 17771 | { | ||
| 17772 | 2239 | moveOld2(down); | |
| 17773 | 2239 | } | |
| 17774 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2152 times.
|
2152 | else if(yoff>=1) |
| 17775 | { | ||
| 17776 | 2152 | moveOld2(up); | |
| 17777 | 2152 | } | |
| 17778 | 7331 | } | |
| 17779 | else | ||
| 17780 | { | ||
| 17781 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 3 times.
|
9 | if(yoff>=4) |
| 17782 | { | ||
| 17783 | 6 | moveOld2(down); | |
| 17784 | 6 | } | |
| 17785 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | else if(yoff<4) |
| 17786 | { | ||
| 17787 | 3 | moveOld2(up); | |
| 17788 | 3 | } | |
| 17789 | } | ||
| 17790 | 7340 | } | |
| 17791 | else | ||
| 17792 | { | ||
| 17793 | 910510 | info = walkflag(x-int32_t(lsteps[x.getInt()&7]),y+(bigHitbox?0:8),1,left) || | |
| 17794 | 455255 | walkflag(x-int32_t(lsteps[x.getInt()&7]),y+(isSideViewHero() ?0:8), 1,left); | |
| 17795 | |||
| 17796 | 455255 | execute(info); | |
| 17797 | |||
| 17798 |
2/2✓ Branch 0 taken 164044 times.
✓ Branch 1 taken 291211 times.
|
455255 | if(!info.isUnwalkable()) |
| 17799 | { | ||
| 17800 | 291211 | moveOld2(left); | |
| 17801 | 291211 | return; | |
| 17802 | } | ||
| 17803 | |||
| 17804 |
4/4✓ Branch 0 taken 156032 times.
✓ Branch 1 taken 8012 times.
✓ Branch 2 taken 8593 times.
✓ Branch 3 taken 147439 times.
|
164044 | if(!DrunkUp() && !DrunkDown()) |
| 17805 | { | ||
| 17806 |
2/4✓ Branch 0 taken 147439 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 147439 times.
|
147439 | if(NO_GRIDLOCK) |
| 17807 | { | ||
| 17808 | ✗ | int32_t v1=bigHitbox?0:8; | |
| 17809 | ✗ | int32_t v2=bigHitbox?8:12; | |
| 17810 | |||
| 17811 | ✗ | if(!_walkflag(x-1,y+v1,1,SWITCHBLOCK_STATE)&& | |
| 17812 | ✗ | !_walkflag(x-1,y+v2,1,SWITCHBLOCK_STATE)&& | |
| 17813 | ✗ | _walkflag(x-1,y+15,1,SWITCHBLOCK_STATE)) | |
| 17814 | { | ||
| 17815 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x-1,y+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11))) | |
| 17816 | ✗ | sprite::move((zfix)0,(zfix)-1); | |
| 17817 | ✗ | } | |
| 17818 | ✗ | else if(_walkflag(x-1,y+v1, 1,SWITCHBLOCK_STATE)&& | |
| 17819 | ✗ | !_walkflag(x-1,y+v2-1,1,SWITCHBLOCK_STATE)&& | |
| 17820 | ✗ | !_walkflag(x-1,y+15, 1,SWITCHBLOCK_STATE)) | |
| 17821 | { | ||
| 17822 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x-1,y+v1+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4))) | |
| 17823 | ✗ | sprite::move((zfix)0,(zfix)1); | |
| 17824 | ✗ | } | |
| 17825 | else | ||
| 17826 | { | ||
| 17827 | ✗ | pushing=push+1; | |
| 17828 | } | ||
| 17829 | ✗ | } | |
| 17830 | 147439 | else pushing=push+1; | |
| 17831 | |||
| 17832 |
3/4✓ Branch 0 taken 147433 times.
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 147433 times.
|
147439 | if(charging==0 && spins==0) |
| 17833 | { | ||
| 17834 | 147433 | dir=left; | |
| 17835 | 147433 | } | |
| 17836 | |||
| 17837 |
5/8✓ Branch 0 taken 143644 times.
✓ Branch 1 taken 3795 times.
✓ Branch 2 taken 143644 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 143644 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 143644 times.
|
147439 | if(action!=swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking) |
| 17838 | { | ||
| 17839 | 143644 | herostep(); | |
| 17840 | 143644 | } | |
| 17841 | |||
| 17842 | 147439 | return; | |
| 17843 | } | ||
| 17844 | } | ||
| 17845 | |||
| 17846 | 23945 | return; | |
| 17847 | } | ||
| 17848 | |||
| 17849 |
2/2✓ Branch 0 taken 2047217 times.
✓ Branch 1 taken 501772 times.
|
2548989 | if(DrunkRight()) |
| 17850 | { | ||
| 17851 |
10/14✓ Branch 0 taken 8228 times.
✓ Branch 1 taken 493544 times.
✓ Branch 2 taken 7619 times.
✓ Branch 3 taken 609 times.
✓ Branch 4 taken 7421 times.
✓ Branch 5 taken 198 times.
✓ Branch 6 taken 7421 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 7421 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 7421 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 7421 times.
|
501772 | if(yoff && !is_on_conveyor && action != swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking && jumping<1) |
| 17852 | { | ||
| 17853 |
4/4✓ Branch 0 taken 7418 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 9 times.
✓ Branch 3 taken 7409 times.
|
7421 | if(dir!=left && dir!=right) |
| 17854 | { | ||
| 17855 |
4/4✓ Branch 0 taken 5268 times.
✓ Branch 1 taken 2141 times.
✓ Branch 2 taken 2234 times.
✓ Branch 3 taken 3034 times.
|
7409 | if(yoff>2&&yoff<6) |
| 17856 | { | ||
| 17857 | 3034 | moveOld2(dir); | |
| 17858 | 3034 | } | |
| 17859 |
2/2✓ Branch 0 taken 2234 times.
✓ Branch 1 taken 2141 times.
|
4375 | else if(yoff>=6) |
| 17860 | { | ||
| 17861 | 2234 | moveOld2(down); | |
| 17862 | 2234 | } | |
| 17863 |
1/2✓ Branch 0 taken 2141 times.
✗ Branch 1 not taken.
|
2141 | else if(yoff>=1) |
| 17864 | { | ||
| 17865 | 2141 | moveOld2(up); | |
| 17866 | 2141 | } | |
| 17867 | 7409 | } | |
| 17868 | else | ||
| 17869 | { | ||
| 17870 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 6 times.
|
12 | if(yoff>=4) |
| 17871 | { | ||
| 17872 | 6 | moveOld2(down); | |
| 17873 | 6 | } | |
| 17874 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | else if(yoff<4) |
| 17875 | { | ||
| 17876 | 6 | moveOld2(up); | |
| 17877 | 6 | } | |
| 17878 | } | ||
| 17879 | 7421 | } | |
| 17880 | else | ||
| 17881 | { | ||
| 17882 | 988702 | info = walkflag(x+15+int32_t(lsteps[x.getInt()&7]),y+(bigHitbox?0:8),1,right) | |
| 17883 | 494351 | || walkflag(x+15+int32_t(lsteps[x.getInt()&7]),y+(isSideViewHero()?0:8),1,right); | |
| 17884 | |||
| 17885 | 494351 | execute(info); | |
| 17886 | |||
| 17887 |
2/2✓ Branch 0 taken 181171 times.
✓ Branch 1 taken 313180 times.
|
494351 | if(!info.isUnwalkable()) |
| 17888 | { | ||
| 17889 | 313180 | moveOld2(right); | |
| 17890 | 313180 | return; | |
| 17891 | } | ||
| 17892 | |||
| 17893 |
4/4✓ Branch 0 taken 174552 times.
✓ Branch 1 taken 6619 times.
✓ Branch 2 taken 8011 times.
✓ Branch 3 taken 166541 times.
|
181171 | if(!DrunkUp() && !DrunkDown()) |
| 17894 | { | ||
| 17895 |
2/4✓ Branch 0 taken 166541 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 166541 times.
|
166541 | if(NO_GRIDLOCK) |
| 17896 | { | ||
| 17897 | ✗ | int32_t v1=bigHitbox?0:8; | |
| 17898 | ✗ | int32_t v2=bigHitbox?8:12; | |
| 17899 | |||
| 17900 | ✗ | if(!_walkflag(x+16,y+v1,1,SWITCHBLOCK_STATE)&& | |
| 17901 | ✗ | !_walkflag(x+16,y+v2,1,SWITCHBLOCK_STATE)&& | |
| 17902 | ✗ | _walkflag(x+16,y+15,1,SWITCHBLOCK_STATE)) | |
| 17903 | { | ||
| 17904 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+16,y+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11))) | |
| 17905 | ✗ | sprite::move((zfix)0,(zfix)-1); | |
| 17906 | ✗ | } | |
| 17907 | ✗ | else if(_walkflag(x+16,y+v1,1,SWITCHBLOCK_STATE)&& | |
| 17908 | ✗ | !_walkflag(x+16,y+v2-1,1,SWITCHBLOCK_STATE)&& | |
| 17909 | ✗ | !_walkflag(x+16,y+15,1,SWITCHBLOCK_STATE)) | |
| 17910 | { | ||
| 17911 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+16,y+v1+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4))) | |
| 17912 | ✗ | sprite::move((zfix)0,(zfix)1); | |
| 17913 | ✗ | } | |
| 17914 | else | ||
| 17915 | { | ||
| 17916 | ✗ | pushing=push+1; | |
| 17917 | } | ||
| 17918 | ✗ | } | |
| 17919 | 166541 | else pushing=push+1; | |
| 17920 | |||
| 17921 |
2/4✓ Branch 0 taken 166541 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 166541 times.
|
166541 | if(charging==0 && spins==0) |
| 17922 | { | ||
| 17923 | 166541 | dir=right; | |
| 17924 | 166541 | } | |
| 17925 | |||
| 17926 |
5/8✓ Branch 0 taken 164947 times.
✓ Branch 1 taken 1594 times.
✓ Branch 2 taken 164947 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 164947 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 164947 times.
|
166541 | if(action!=swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking) |
| 17927 | { | ||
| 17928 | 164947 | herostep(); | |
| 17929 | 164947 | } | |
| 17930 | |||
| 17931 | 166541 | return; | |
| 17932 | } | ||
| 17933 | } | ||
| 17934 | 22051 | } | |
| 17935 | } | ||
| 17936 | 13153405 | } | |
| 17937 | |||
| 17938 | 4459587 | bool HeroClass::scr_walkflag(zfix_round zdx,zfix_round zdy,int d2,bool kb, int* canladder) | |
| 17939 | { | ||
| 17940 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4459587 times.
|
4459587 | if(toogam) return false; |
| 17941 | 4459587 | int dx = zdx.getRound(), dy = zdy.getRound(); | |
| 17942 | |||
| 17943 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 4459587 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
4459587 | if(blockpath && dy<80) //Blocked top parts of rooms |
| 17944 | ✗ | return true; | |
| 17945 | |||
| 17946 |
4/4✓ Branch 0 taken 30097 times.
✓ Branch 1 taken 4429490 times.
✓ Branch 2 taken 18818 times.
✓ Branch 3 taken 11279 times.
|
4459587 | if(mblock2.active() && mblock2.hit(dx,dy,0,1,1,1)) |
| 17947 | 11279 | return true; | |
| 17948 | //collide_object handled in scr_canmove | ||
| 17949 | |||
| 17950 |
4/6✓ Branch 0 taken 683926 times.
✓ Branch 1 taken 3764382 times.
✓ Branch 2 taken 683926 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4448308 times.
|
4472087 | if(isdungeon() && currscr<128 && dy<40 |
| 17951 |
5/10✓ Branch 0 taken 23779 times.
✓ Branch 1 taken 660147 times.
✓ Branch 2 taken 13692 times.
✓ Branch 3 taken 10087 times.
✓ Branch 4 taken 13692 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
683926 | && ((x<=112||x>=128) || _walkflag(120,24,2,SWITCHBLOCK_STATE)) |
| 17952 |
0/2✗ Branch 0 not taken.
✗ Branch 1 not taken.
|
23779 | && !get_qr(qr_FREEFORM)) |
| 17953 | ✗ | return true; //Old NES dungeon stuff | |
| 17954 | |||
| 17955 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 4448308 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4448308 times.
|
4448308 | bool solid = _walkflag(zdx,zdy,1,SWITCHBLOCK_STATE); |
| 17956 | |||
| 17957 |
4/6✓ Branch 0 taken 683926 times.
✓ Branch 1 taken 3764382 times.
✓ Branch 2 taken 683926 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 683926 times.
✗ Branch 5 not taken.
|
4448308 | if(isdungeon() && currscr<128 && !get_qr(qr_FREEFORM)) |
| 17958 | { | ||
| 17959 | ✗ | if(dx>=112&&dx<120&&dy<40&&dy>=32) | |
| 17960 | ✗ | solid=true; | |
| 17961 | |||
| 17962 | ✗ | if(dx>=136&&dx<144&&dy<40&&dy>=32) | |
| 17963 | ✗ | solid=true; | |
| 17964 | ✗ | } | |
| 17965 | |||
| 17966 |
3/4✓ Branch 0 taken 4411529 times.
✓ Branch 1 taken 36779 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4411529 times.
|
4448308 | if(action==swimming || IsSideSwim()) |
| 17967 | { | ||
| 17968 |
2/2✓ Branch 0 taken 13463 times.
✓ Branch 1 taken 23316 times.
|
36779 | if(!solid) |
| 17969 | { | ||
| 17970 | 23316 | int ls = 22; | |
| 17971 |
1/6✓ Branch 0 taken 23316 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
23316 | if((get_qr(qr_DROWN) && isSwimming()) || (!diagonalMovement) || get_qr(qr_NO_HOPPING)) |
| 17972 | 23316 | ls = 1; | |
| 17973 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 23316 times.
|
23316 | if(landswim < ls) |
| 17974 | { | ||
| 17975 |
2/4✓ Branch 0 taken 23316 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 23316 times.
|
23316 | if(dx<0||dy<0); |
| 17976 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 23296 times.
|
23316 | else if(dx>=256); |
| 17977 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 23278 times.
|
23296 | else if(dy>=176); |
| 17978 |
2/4✓ Branch 0 taken 23278 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 23278 times.
|
23278 | else if(get_qr(qr_DROWN) && !ilswim); |
| 17979 | ✗ | else if(iswaterex(MAPCOMBO(dx,dy), currmap, currscr, -1, dx,dy)) //!DIMI: weird duplicate function here before. Was water bugged this whole time, or was it just an unneccessary duplicate? | |
| 17980 | ✗ | solid = false; | |
| 17981 | else | ||
| 17982 | ✗ | solid = true; | |
| 17983 | 23316 | } | |
| 17984 | 23316 | } | |
| 17985 | else | ||
| 17986 | { | ||
| 17987 | 13463 | int32_t wtrx = iswaterex(MAPCOMBO(dx,dy), currmap, currscr, -1, dx,dy); | |
| 17988 | |||
| 17989 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13463 times.
|
13463 | if(wtrx) |
| 17990 | ✗ | solid = false; | |
| 17991 | } | ||
| 17992 | 36779 | } | |
| 17993 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4411529 times.
|
4411529 | else if(ladderx+laddery) // ladder is being used |
| 17994 | { | ||
| 17995 | ✗ | if (canladder) | |
| 17996 | { | ||
| 17997 | ✗ | *canladder = 0; | |
| 17998 | ✗ | } | |
| 17999 | ✗ | int32_t lx = zfix(dx); | |
| 18000 | ✗ | int32_t ly = zfix(dy); | |
| 18001 | |||
| 18002 | ✗ | if(ladderdir<=down) //vertical ladder | |
| 18003 | { | ||
| 18004 | ✗ | if(abs(ly-(laddery+8))<=8) // ly is between laddery (laddery+8-8) and laddery+16 (laddery+8+8) | |
| 18005 | { | ||
| 18006 | ✗ | bool temp = false; | |
| 18007 | |||
| 18008 | ✗ | if(!(abs(lx-(ladderx+8))<=8)) | |
| 18009 | ✗ | temp = true; | |
| 18010 | |||
| 18011 | ✗ | if(!temp) | |
| 18012 | { | ||
| 18013 | ✗ | solid = false; | |
| 18014 | ✗ | } | |
| 18015 | ✗ | else if(current_item_power(itype_ladder)<2 && (d2==left || d2==right) && !isSideViewHero()) | |
| 18016 | { | ||
| 18017 | ✗ | solid = true; | |
| 18018 | ✗ | } | |
| 18019 | ✗ | } | |
| 18020 | ✗ | } | |
| 18021 | else //horizontal ladder | ||
| 18022 | { | ||
| 18023 | ✗ | if(abs(lx-(ladderx+8))<=8) | |
| 18024 | { | ||
| 18025 | ✗ | if(abs(ly-(laddery+(bigHitbox?8:12)))<=(bigHitbox?8:4)) | |
| 18026 | { | ||
| 18027 | ✗ | solid = false; | |
| 18028 | ✗ | } | |
| 18029 | ✗ | else if(current_item_power(itype_ladder)<2 && (d2==up || d2==down)) | |
| 18030 | { | ||
| 18031 | ✗ | solid = true; | |
| 18032 | ✗ | } | |
| 18033 | ✗ | else if((abs(ly-laddery+8)<=8) && d2<=down) | |
| 18034 | { | ||
| 18035 | ✗ | solid = false; | |
| 18036 | ✗ | } | |
| 18037 | ✗ | } | |
| 18038 | } | ||
| 18039 | ✗ | } | |
| 18040 |
5/6✓ Branch 0 taken 2170207 times.
✓ Branch 1 taken 2241322 times.
✓ Branch 2 taken 2169359 times.
✓ Branch 3 taken 848 times.
✓ Branch 4 taken 2169359 times.
✗ Branch 5 not taken.
|
4411529 | else if(solid || isSideViewHero() || get_qr(qr_DROWN)) |
| 18041 | { | ||
| 18042 | // see if it's a good spot for the ladder or for swimming | ||
| 18043 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 4411529 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4411529 times.
|
4411529 | bool unwalkablex = _walkflag(zdx,zdy,1,SWITCHBLOCK_STATE); //will be used later for the ladder -DD |
| 18044 | |||
| 18045 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4411529 times.
|
4411529 | if(get_qr(qr_DROWN)) |
| 18046 | { | ||
| 18047 | // Drowning changes the following attributes: | ||
| 18048 | // * Dangerous water is also walkable, so ignore the previous | ||
| 18049 | // definitions of unwalkablex. | ||
| 18050 | // * Instead, prevent the ladder from being used in the | ||
| 18051 | // one frame where Hero has landed on water before drowning. | ||
| 18052 | 4411529 | unwalkablex = !iswaterex(MAPCOMBO(x+4,y+11), currmap, currscr, -1, x+4,y+11); | |
| 18053 | 4411529 | } | |
| 18054 | |||
| 18055 | // check if he can swim | ||
| 18056 |
4/6✓ Branch 0 taken 431459 times.
✓ Branch 1 taken 3980070 times.
✓ Branch 2 taken 431459 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 431459 times.
|
4411529 | if(current_item(itype_flippers) && z==0 && fakez==0) |
| 18057 | { | ||
| 18058 | 431459 | int32_t wtrx = iswaterex(MAPCOMBO(dx,dy), currmap, currscr, -1, dx,dy); | |
| 18059 |
5/6✓ Branch 0 taken 431285 times.
✓ Branch 1 taken 174 times.
✓ Branch 2 taken 893 times.
✓ Branch 3 taken 430392 times.
✓ Branch 4 taken 893 times.
✗ Branch 5 not taken.
|
431459 | if (current_item(itype_flippers) >= combobuf[wtrx].attribytes[0] && (!(combobuf[wtrx].usrflags&cflag1) || (itemsbuf[current_item_id(itype_flippers)].flags & item_flag3))) //Don't swim if the water's required level is too high! -Dimi |
| 18060 | { | ||
| 18061 | //ladder ignores water combos that are now walkable thanks to flippers -DD | ||
| 18062 |
2/2✓ Branch 0 taken 4582 times.
✓ Branch 1 taken 426703 times.
|
431285 | unwalkablex = unwalkablex && (!wtrx); |
| 18063 | |||
| 18064 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 431285 times.
|
431285 | if(landswim >= 22) |
| 18065 | { | ||
| 18066 | ✗ | solid = false; | |
| 18067 | ✗ | } | |
| 18068 |
2/2✓ Branch 0 taken 426943 times.
✓ Branch 1 taken 4342 times.
|
431285 | else if(wtrx) |
| 18069 | { | ||
| 18070 |
2/2✓ Branch 0 taken 1000 times.
✓ Branch 1 taken 3342 times.
|
4342 | if(dir==d2) |
| 18071 | { | ||
| 18072 | 3342 | ladderx = 0; | |
| 18073 | 3342 | laddery = 0; | |
| 18074 | 3342 | } | |
| 18075 | 4342 | } | |
| 18076 | 431285 | } | |
| 18077 | 431459 | } | |
| 18078 | |||
| 18079 | // check if he can use the ladder | ||
| 18080 | // "Allow Ladder Anywhere" is toggled by fLADDER | ||
| 18081 |
1/2✓ Branch 0 taken 4411529 times.
✗ Branch 1 not taken.
|
4411529 | if(can_deploy_ladder()) |
| 18082 | // laddersetup | ||
| 18083 | { | ||
| 18084 | // Check if there's water to use the ladder over | ||
| 18085 | ✗ | bool wtrx = (iswaterex(MAPCOMBO(dx,dy), currmap, currscr, -1, dx,dy) != 0); | |
| 18086 | ✗ | int32_t ldrid = current_item_id(itype_ladder); | |
| 18087 | ✗ | bool ladderpits = ldrid > -1 && (itemsbuf[ldrid].flags&item_flag1); | |
| 18088 | |||
| 18089 | ✗ | if(wtrx) | |
| 18090 | { | ||
| 18091 | ✗ | if(isSideViewHero()) | |
| 18092 | { | ||
| 18093 | ✗ | wtrx = !_walkflag(zdx, zdy+8, 1,SWITCHBLOCK_STATE) && !_walkflag(dx, dy, 1,SWITCHBLOCK_STATE) && dir!=down; | |
| 18094 | ✗ | } | |
| 18095 | // * walk on half-water using the ladder instead of using flippers. | ||
| 18096 | // * otherwise, walk on ladder(+hookshot) combos. | ||
| 18097 | ✗ | else if((isstepable(MAPCOMBO(dx, dy)) || wtrx==true)) | |
| 18098 | { | ||
| 18099 | ✗ | if(!get_qr(qr_OLD_210_WATER) && current_item(itype_flippers)) | |
| 18100 | { | ||
| 18101 | //if Hero could swim on a tile instead of using the ladder, | ||
| 18102 | //refuse to use the ladder to step over that tile. -DD | ||
| 18103 | ✗ | wtrx = isstepable(MAPCOMBO(dx, dy)) && unwalkablex; | |
| 18104 | ✗ | } | |
| 18105 | ✗ | } | |
| 18106 | ✗ | } | |
| 18107 | else | ||
| 18108 | { | ||
| 18109 | // No water; check other things | ||
| 18110 | |||
| 18111 | //Check pits | ||
| 18112 | ✗ | if(ladderpits) | |
| 18113 | { | ||
| 18114 | ✗ | int32_t pit_cmb = getpitfall(dx,dy); | |
| 18115 | ✗ | wtrx = pit_cmb && (combobuf[pit_cmb].usrflags&cflag4); | |
| 18116 | ✗ | } | |
| 18117 | ✗ | if(!ladderpits || (!wtrx || isSideViewHero())) //If no pit, check ladder combos | |
| 18118 | { | ||
| 18119 | ✗ | int32_t combo=combobuf[MAPCOMBO(dx, dy)].type; | |
| 18120 | ✗ | wtrx=(combo==cLADDERONLY || combo==cLADDERHOOKSHOT); | |
| 18121 | ✗ | } | |
| 18122 | } | ||
| 18123 | |||
| 18124 | ✗ | for (int32_t i = 0; i <= 1; ++i) | |
| 18125 | { | ||
| 18126 | ✗ | if(tmpscr2[i].valid!=0) | |
| 18127 | { | ||
| 18128 | ✗ | if (get_qr(qr_OLD_BRIDGE_COMBOS)) | |
| 18129 | { | ||
| 18130 | ✗ | if (combobuf[MAPCOMBO2(i,dx,dy)].type == cBRIDGE && !_walkflag_layer(dx,dy,1, &(tmpscr2[i]))) wtrx = false; | |
| 18131 | ✗ | } | |
| 18132 | else | ||
| 18133 | { | ||
| 18134 | ✗ | if (combobuf[MAPCOMBO2(i,dx,dy)].type == cBRIDGE && _effectflag_layer(dx,dy,1, &(tmpscr2[i]))) wtrx = false; | |
| 18135 | } | ||
| 18136 | ✗ | } | |
| 18137 | ✗ | } | |
| 18138 | ✗ | bool walkwater = (get_qr(qr_DROWN) && !iswaterex(MAPCOMBO(dx,dy), currmap, currscr, -1, dx,dy)); | |
| 18139 | |||
| 18140 | ✗ | if (!wtrx && solid) | |
| 18141 | { | ||
| 18142 | ✗ | if (canladder) | |
| 18143 | { | ||
| 18144 | ✗ | *canladder = 0; | |
| 18145 | ✗ | } | |
| 18146 | ✗ | } | |
| 18147 | |||
| 18148 | ✗ | if(d2==dir) | |
| 18149 | { | ||
| 18150 | ✗ | int32_t c = walkwater ? 0:8; | |
| 18151 | ✗ | int32_t b = walkwater ? 8:0; | |
| 18152 | |||
| 18153 | ✗ | if(d2>=left) | |
| 18154 | { | ||
| 18155 | ✗ | if (wtrx) | |
| 18156 | { | ||
| 18157 | //If the difference between dy and y is small enough | ||
| 18158 | //this is apparently a really crappy corner shove check? | ||
| 18159 | ✗ | if((replay_version_check(26)) || (abs((dy)-(int32_t(y+c)))<=(b))) | |
| 18160 | { | ||
| 18161 | // Don't activate the ladder if it would be entirely | ||
| 18162 | // over water and Hero has the flippers. This isn't | ||
| 18163 | // a good way to do this, but it's too risky | ||
| 18164 | // to make big changes to this stuff. | ||
| 18165 | ✗ | bool deployLadder=true; | |
| 18166 | ✗ | int32_t lx=dx&0xF0; | |
| 18167 | ✗ | if(current_item(itype_flippers) && current_item(itype_flippers) >= combobuf[iswaterex(MAPCOMBO(lx+8, y+8), currmap, currscr, -1, lx+8, y+8)].attribytes[0] && z==0 && fakez==0) | |
| 18168 | { | ||
| 18169 | ✗ | if(iswaterex(MAPCOMBO(lx, y), currmap, currscr, -1, lx, y) && | |
| 18170 | ✗ | iswaterex(MAPCOMBO(lx+15, y), currmap, currscr, -1, lx+15, y) && | |
| 18171 | ✗ | iswaterex(MAPCOMBO(lx, y+15), currmap, currscr, -1, lx, y+15) && | |
| 18172 | ✗ | iswaterex(MAPCOMBO(lx+15, y+15), currmap, currscr, -1, lx+15, y+15)) | |
| 18173 | ✗ | deployLadder=false; | |
| 18174 | ✗ | } | |
| 18175 | ✗ | if(deployLadder) | |
| 18176 | { | ||
| 18177 | ✗ | if (replay_version_check(26)) | |
| 18178 | { | ||
| 18179 | ✗ | if (canladder) | |
| 18180 | { | ||
| 18181 | ✗ | if (*canladder == -1) *canladder = 1; | |
| 18182 | ✗ | } | |
| 18183 | ✗ | } | |
| 18184 | else | ||
| 18185 | { | ||
| 18186 | ✗ | ladderx = dx&0xF0; | |
| 18187 | ✗ | laddery = y; | |
| 18188 | ✗ | ladderdir = left; | |
| 18189 | ✗ | ladderstart = d2; | |
| 18190 | ✗ | solid = laddery!=y.getInt(); | |
| 18191 | } | ||
| 18192 | ✗ | } | |
| 18193 | ✗ | } | |
| 18194 | ✗ | } | |
| 18195 | ✗ | } | |
| 18196 | ✗ | else if(d2<=down) | |
| 18197 | { | ||
| 18198 | ✗ | if (wtrx) | |
| 18199 | { | ||
| 18200 | //Unsure if this actually needs a replay check but better safe than sorry? | ||
| 18201 | ✗ | if (replay_version_check(26)) | |
| 18202 | { | ||
| 18203 | ✗ | if (canladder) | |
| 18204 | { | ||
| 18205 | ✗ | if (*canladder == -1) *canladder = 1; | |
| 18206 | ✗ | } | |
| 18207 | ✗ | } | |
| 18208 | // If the difference between dx and x is small enough | ||
| 18209 | ✗ | if(!replay_version_check(26) && (abs((dx)-(int32_t(x+c)))<=(b))) | |
| 18210 | { | ||
| 18211 | ✗ | ladderx = x; | |
| 18212 | ✗ | laddery = dy&0xF0; | |
| 18213 | ✗ | ladderdir = up; | |
| 18214 | ✗ | ladderstart = d2; | |
| 18215 | ✗ | solid = ladderx!=x.getInt(); | |
| 18216 | ✗ | } | |
| 18217 | ✗ | } | |
| 18218 | ✗ | } | |
| 18219 | ✗ | } | |
| 18220 | ✗ | } | |
| 18221 | 4411529 | } | |
| 18222 | |||
| 18223 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4448308 times.
|
4448308 | if (replay_version_check(26)) |
| 18224 | { | ||
| 18225 |
2/2✓ Branch 0 taken 3235517 times.
✓ Branch 1 taken 1212791 times.
|
4448308 | if (canladder) |
| 18226 | { | ||
| 18227 |
3/4✓ Branch 0 taken 1359224 times.
✓ Branch 1 taken 1876293 times.
✓ Branch 2 taken 1359224 times.
✗ Branch 3 not taken.
|
3235517 | if (solid && *canladder == 1) *canladder = 2; |
| 18228 | 3235517 | } | |
| 18229 | 4448308 | } | |
| 18230 | |||
| 18231 | 4448308 | return solid; | |
| 18232 | 4459587 | } | |
| 18233 | |||
| 18234 | 1467685 | bool HeroClass::scr_canmove(zfix dx, zfix dy, bool kb, bool ign_sv, int* canladder) | |
| 18235 | { | ||
| 18236 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1467685 times.
|
1467685 | if(toogam) return true; |
| 18237 |
3/4✓ Branch 0 taken 710891 times.
✓ Branch 1 taken 756794 times.
✓ Branch 2 taken 710891 times.
✗ Branch 3 not taken.
|
1467685 | if(!(dx || dy)) return true; |
| 18238 | 1467685 | zfix bx = x, by = y+(bigHitbox?0:8); //left/top | |
| 18239 | 1467685 | zfix rx = x+15.9999_zf, ry = y+15.9999_zf; //right/bottom | |
| 18240 | 1467685 | zfix wid = 16, hei = bigHitbox ? 16 : 8; | |
| 18241 |
5/14✓ Branch 0 taken 1400878 times.
✓ Branch 1 taken 66807 times.
✓ Branch 2 taken 333685 times.
✓ Branch 3 taken 1067193 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 333685 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
|
1467685 | if(!ign_sv && dy < 0 && sideview_mode() && !getOnSideviewLadder() && action != sideswimming && action != sideswimhit && action != sideswimattacking) |
| 18242 | ✗ | return false; | |
| 18243 | |||
| 18244 | 1467685 | bool nosolid = true; | |
| 18245 | |||
| 18246 | 1467685 | bool ret = true; | |
| 18247 | |||
| 18248 |
3/4✓ Branch 0 taken 756794 times.
✓ Branch 1 taken 710891 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 756794 times.
|
1467685 | if(dx && !dy) |
| 18249 | { | ||
| 18250 |
2/2✓ Branch 0 taken 351756 times.
✓ Branch 1 taken 405038 times.
|
756794 | if(dx < 0) |
| 18251 | { | ||
| 18252 | 351756 | zfix mx = bx+dx; | |
| 18253 |
2/2✓ Branch 0 taken 351756 times.
✓ Branch 1 taken 235577 times.
|
587333 | for(zfix ty = 0; by+ty < ry; ty += 8) |
| 18254 | { | ||
| 18255 |
2/2✓ Branch 0 taken 209107 times.
✓ Branch 1 taken 142649 times.
|
351756 | if(scr_walkflag(mx, by+ty, left, kb, canladder)) |
| 18256 | { | ||
| 18257 |
2/2✓ Branch 0 taken 26470 times.
✓ Branch 1 taken 116179 times.
|
142649 | if (canladder) ret = false; |
| 18258 | else | ||
| 18259 | { | ||
| 18260 | 116179 | return false; | |
| 18261 | } | ||
| 18262 | 26470 | } | |
| 18263 | 235577 | } | |
| 18264 |
2/2✓ Branch 0 taken 48785 times.
✓ Branch 1 taken 186792 times.
|
235577 | if(scr_walkflag(mx, ry, left, kb, canladder)) |
| 18265 | 48785 | return false; | |
| 18266 |
2/2✓ Branch 0 taken 182756 times.
✓ Branch 1 taken 4036 times.
|
186792 | if (!ret) return false; |
| 18267 |
2/4✓ Branch 0 taken 182756 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 182756 times.
✗ Branch 3 not taken.
|
182756 | if(nosolid && collide_object(bx+dx,by,-dx,hei,this)) |
| 18268 | ✗ | return false; | |
| 18269 | 182756 | } | |
| 18270 | else | ||
| 18271 | { | ||
| 18272 | 405038 | zfix mx = rx+dx; | |
| 18273 | 405038 | int lx = mx-hit_width+1; | |
| 18274 |
2/2✓ Branch 0 taken 405038 times.
✓ Branch 1 taken 272141 times.
|
677179 | for(zfix ty = 0; by+ty < ry; ty += 8) |
| 18275 | { | ||
| 18276 |
2/2✓ Branch 0 taken 235800 times.
✓ Branch 1 taken 169238 times.
|
405038 | if(scr_walkflag(mx, by+ty, right, kb, canladder)) |
| 18277 | { | ||
| 18278 |
2/2✓ Branch 0 taken 36341 times.
✓ Branch 1 taken 132897 times.
|
169238 | if (canladder) ret = false; |
| 18279 | else | ||
| 18280 | { | ||
| 18281 | 132897 | return false; | |
| 18282 | } | ||
| 18283 | 36341 | } | |
| 18284 | 272141 | } | |
| 18285 |
2/2✓ Branch 0 taken 72956 times.
✓ Branch 1 taken 199185 times.
|
272141 | if(scr_walkflag(mx, ry, right, kb, canladder)) |
| 18286 | 72956 | return false; | |
| 18287 |
2/2✓ Branch 0 taken 191739 times.
✓ Branch 1 taken 7446 times.
|
199185 | if (!ret) return false; |
| 18288 |
2/4✓ Branch 0 taken 191739 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 191739 times.
✗ Branch 3 not taken.
|
191739 | if(nosolid && collide_object(bx+wid,by,dx,hei,this)) |
| 18289 | ✗ | return false; | |
| 18290 | } | ||
| 18291 | 374495 | } | |
| 18292 |
2/4✓ Branch 0 taken 710891 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 710891 times.
|
710891 | else if(dy && !dx) |
| 18293 | { | ||
| 18294 |
2/2✓ Branch 0 taken 343209 times.
✓ Branch 1 taken 367682 times.
|
710891 | if(dy < 0) |
| 18295 | { | ||
| 18296 | 343209 | zfix my = by+dy; | |
| 18297 |
2/2✓ Branch 0 taken 595337 times.
✓ Branch 1 taken 232679 times.
|
828016 | for(zfix tx = 0; bx+tx < rx; tx += 8) |
| 18298 | { | ||
| 18299 |
2/2✓ Branch 0 taken 365626 times.
✓ Branch 1 taken 229711 times.
|
595337 | if(scr_walkflag(bx+tx, my, up, kb, canladder)) |
| 18300 | { | ||
| 18301 |
2/2✓ Branch 0 taken 119181 times.
✓ Branch 1 taken 110530 times.
|
229711 | if (canladder) ret = false; |
| 18302 | else | ||
| 18303 | { | ||
| 18304 | 110530 | return false; | |
| 18305 | } | ||
| 18306 | 119181 | } | |
| 18307 | 484807 | } | |
| 18308 |
2/2✓ Branch 0 taken 76623 times.
✓ Branch 1 taken 156056 times.
|
232679 | if(scr_walkflag(rx, my, up, kb, canladder)) |
| 18309 | 76623 | return false; | |
| 18310 |
2/2✓ Branch 0 taken 140293 times.
✓ Branch 1 taken 15763 times.
|
156056 | if (!ret) return false; |
| 18311 |
2/4✓ Branch 0 taken 140293 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 140293 times.
✗ Branch 3 not taken.
|
140293 | if(nosolid && collide_object(bx,by+dy,wid,-dy,this)) |
| 18312 | ✗ | return false; | |
| 18313 | 140293 | } | |
| 18314 | else | ||
| 18315 | { | ||
| 18316 | 367682 | zfix my = ry+dy; | |
| 18317 | 367682 | int ly = my-hit_height+1; | |
| 18318 |
2/2✓ Branch 0 taken 606251 times.
✓ Branch 1 taken 211183 times.
|
817434 | for(zfix tx = 0; bx+tx < rx; tx += 8) |
| 18319 | { | ||
| 18320 |
2/2✓ Branch 0 taken 401023 times.
✓ Branch 1 taken 205228 times.
|
606251 | if(scr_walkflag(bx+tx, my, down, kb, canladder)) |
| 18321 | { | ||
| 18322 |
2/2✓ Branch 0 taken 48729 times.
✓ Branch 1 taken 156499 times.
|
205228 | if (canladder) ret = false; |
| 18323 | else | ||
| 18324 | { | ||
| 18325 | 156499 | return false; | |
| 18326 | } | ||
| 18327 | 48729 | } | |
| 18328 | 449752 | } | |
| 18329 |
2/2✓ Branch 0 taken 59661 times.
✓ Branch 1 taken 151522 times.
|
211183 | if(scr_walkflag(rx, my, down, kb, canladder)) |
| 18330 | 59661 | return false; | |
| 18331 |
2/2✓ Branch 0 taken 144737 times.
✓ Branch 1 taken 6785 times.
|
151522 | if (!ret) return false; |
| 18332 |
2/4✓ Branch 0 taken 144737 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 144737 times.
|
144737 | if(nosolid && collide_object(bx,by+hei,wid,dy,this)) |
| 18333 | ✗ | return false; | |
| 18334 | } | ||
| 18335 | 285030 | } | |
| 18336 | else //! Untested, and currently unused. | ||
| 18337 | { | ||
| 18338 | ✗ | return scr_canmove(dx, 0, kb, ign_sv) && scr_canmove(dy, 0, kb, ign_sv); | |
| 18339 | } | ||
| 18340 | 659525 | return ret; | |
| 18341 | 1467685 | } | |
| 18342 | 444360 | bool handle_movestate(std::function<bool()> proc) | |
| 18343 | { | ||
| 18344 | 444360 | zfix ox = Hero.x, oy = Hero.y; | |
| 18345 | 444360 | auto oladderx = Hero.ladderx; | |
| 18346 | 444360 | auto oladdery = Hero.laddery; | |
| 18347 | 444360 | auto oladderdir = Hero.ladderdir; | |
| 18348 | 444360 | auto oladderstart = Hero.ladderstart; | |
| 18349 | |||
| 18350 | 444360 | bool ret = proc(); | |
| 18351 | |||
| 18352 | 444360 | Hero.x = ox; | |
| 18353 | 444360 | Hero.y = oy; | |
| 18354 | 444360 | Hero.ladderx = oladderx; | |
| 18355 | 444360 | Hero.laddery = oladdery; | |
| 18356 | 444360 | Hero.ladderdir = oladderdir; | |
| 18357 | 444360 | Hero.ladderstart = oladderstart; | |
| 18358 | |||
| 18359 | 444360 | return ret; | |
| 18360 | } | ||
| 18361 | |||
| 18362 | 70 | zfix handle_movestate_zfix(std::function<zfix()> proc) | |
| 18363 | { | ||
| 18364 | 70 | zfix ox = Hero.x, oy = Hero.y; | |
| 18365 | 70 | auto oladderx = Hero.ladderx; | |
| 18366 | 70 | auto oladdery = Hero.laddery; | |
| 18367 | 70 | auto oladderdir = Hero.ladderdir; | |
| 18368 | 70 | auto oladderstart = Hero.ladderstart; | |
| 18369 | |||
| 18370 | 70 | zfix ret = proc(); | |
| 18371 | |||
| 18372 | 70 | Hero.x = ox; | |
| 18373 | 70 | Hero.y = oy; | |
| 18374 | 70 | Hero.ladderx = oladderx; | |
| 18375 | 70 | Hero.laddery = oladdery; | |
| 18376 | 70 | Hero.ladderdir = oladderdir; | |
| 18377 | 70 | Hero.ladderstart = oladderstart; | |
| 18378 | |||
| 18379 | 70 | return ret; | |
| 18380 | } | ||
| 18381 | |||
| 18382 | 53377 | optional<zfix> HeroClass::get_solid_coord(zfix tx, zfix ty, byte dir, byte mdir, bool kb, zfix earlyterm, bool doladder) | |
| 18383 | { | ||
| 18384 | 53377 | zfix tmp; | |
| 18385 |
4/5✓ Branch 0 taken 4627 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9243 times.
✓ Branch 3 taken 21111 times.
✓ Branch 4 taken 18396 times.
|
53377 | switch(dir) |
| 18386 | ✗ | { | |
| 18387 | default: | ||
| 18388 | case up: | ||
| 18389 |
2/4✓ Branch 0 taken 4627 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4627 times.
✗ Branch 3 not taken.
|
84684 | tmp = binary_search_zfix(ty, earlyterm, [&](zfix ty, zfix& retval) |
| 18390 | { | ||
| 18391 | 80057 | int laddercheck = -1; | |
| 18392 |
2/2✓ Branch 0 taken 40197 times.
✓ Branch 1 taken 39860 times.
|
80057 | if(!scr_walkflag(tx,ty,mdir,kb, &laddercheck)) |
| 18393 | { | ||
| 18394 | 40197 | retval = ty; | |
| 18395 | 40197 | return BSEARCH_CONTINUE_UP; | |
| 18396 | } | ||
| 18397 |
2/4✓ Branch 0 taken 39860 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 39860 times.
|
39860 | else if(doladder && laddercheck > 0) |
| 18398 | { | ||
| 18399 | ✗ | retval = ty; | |
| 18400 | ✗ | return BSEARCH_CONTINUE_UP; | |
| 18401 | } | ||
| 18402 | 39860 | else return BSEARCH_CONTINUE_DOWN; | |
| 18403 |
1/2✓ Branch 0 taken 4627 times.
✗ Branch 1 not taken.
|
84684 | }, -999); |
| 18404 |
2/2✓ Branch 0 taken 405 times.
✓ Branch 1 taken 4222 times.
|
4627 | if(tmp > -999) |
| 18405 | 4222 | tmp -= 15.9999_zf; | |
| 18406 | 4627 | break; | |
| 18407 | case down: | ||
| 18408 |
2/4✓ Branch 0 taken 9243 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9243 times.
✗ Branch 3 not taken.
|
171090 | tmp = binary_search_zfix(ty, earlyterm, [&](zfix ty, zfix& retval) |
| 18409 | { | ||
| 18410 | 161847 | int laddercheck = -1; | |
| 18411 |
2/2✓ Branch 0 taken 68573 times.
✓ Branch 1 taken 93274 times.
|
161847 | if(!scr_walkflag(tx,ty,mdir,kb, &laddercheck)) |
| 18412 | { | ||
| 18413 | 68573 | retval = ty; | |
| 18414 | 68573 | return BSEARCH_CONTINUE_DOWN; | |
| 18415 | } | ||
| 18416 |
2/4✓ Branch 0 taken 93274 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 93274 times.
|
93274 | else if(doladder && laddercheck > 0) |
| 18417 | { | ||
| 18418 | ✗ | retval = ty; | |
| 18419 | ✗ | return BSEARCH_CONTINUE_DOWN; | |
| 18420 | } | ||
| 18421 | 93274 | else return BSEARCH_CONTINUE_UP; | |
| 18422 |
1/2✓ Branch 0 taken 9243 times.
✗ Branch 1 not taken.
|
171090 | }, -999); |
| 18423 |
2/2✓ Branch 0 taken 324 times.
✓ Branch 1 taken 8919 times.
|
9243 | if(tmp > -999) |
| 18424 | 8919 | tmp -= (bigHitbox?0:8); | |
| 18425 | 9243 | break; | |
| 18426 | case left: | ||
| 18427 |
2/4✓ Branch 0 taken 21111 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 21111 times.
✗ Branch 3 not taken.
|
395076 | tmp = binary_search_zfix(tx, earlyterm, [&](zfix tx, zfix& retval) |
| 18428 | { | ||
| 18429 | 373965 | int laddercheck = -1; | |
| 18430 |
2/2✓ Branch 0 taken 53414 times.
✓ Branch 1 taken 320551 times.
|
373965 | if(!scr_walkflag(tx,ty,mdir,kb, &laddercheck)) |
| 18431 | { | ||
| 18432 | 53414 | retval = tx; | |
| 18433 | 53414 | return BSEARCH_CONTINUE_UP; | |
| 18434 | } | ||
| 18435 |
2/4✓ Branch 0 taken 320551 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 320551 times.
|
320551 | else if(doladder && laddercheck > 0) |
| 18436 | { | ||
| 18437 | ✗ | retval = tx; | |
| 18438 | ✗ | return BSEARCH_CONTINUE_UP; | |
| 18439 | } | ||
| 18440 | 320551 | else return BSEARCH_CONTINUE_DOWN; | |
| 18441 |
1/2✓ Branch 0 taken 21111 times.
✗ Branch 1 not taken.
|
395076 | }, -999); |
| 18442 |
2/2✓ Branch 0 taken 15280 times.
✓ Branch 1 taken 5831 times.
|
21111 | if(tmp > -999) |
| 18443 | 5831 | tmp -= 15.9999_zf; | |
| 18444 | 21111 | break; | |
| 18445 | case right: | ||
| 18446 |
2/4✓ Branch 0 taken 18396 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 18396 times.
✗ Branch 3 not taken.
|
345652 | tmp = binary_search_zfix(tx, earlyterm, [&](zfix tx, zfix& retval) |
| 18447 | { | ||
| 18448 | 327256 | int laddercheck = -1; | |
| 18449 |
2/2✓ Branch 0 taken 38219 times.
✓ Branch 1 taken 289037 times.
|
327256 | if(!scr_walkflag(tx,ty,mdir,kb, &laddercheck)) |
| 18450 | { | ||
| 18451 | 38219 | retval = tx; | |
| 18452 | 38219 | return BSEARCH_CONTINUE_DOWN; | |
| 18453 | } | ||
| 18454 |
2/4✓ Branch 0 taken 289037 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 289037 times.
|
289037 | else if(doladder && laddercheck > 0) |
| 18455 | { | ||
| 18456 | ✗ | retval = tx; | |
| 18457 | ✗ | return BSEARCH_CONTINUE_DOWN; | |
| 18458 | } | ||
| 18459 | 289037 | else return BSEARCH_CONTINUE_UP; | |
| 18460 |
1/2✓ Branch 0 taken 18396 times.
✗ Branch 1 not taken.
|
345652 | }, -999); |
| 18461 | 18396 | break; | |
| 18462 | } | ||
| 18463 |
2/2✓ Branch 0 taken 29908 times.
✓ Branch 1 taken 23469 times.
|
53377 | if(tmp > -999) |
| 18464 | { | ||
| 18465 | 23469 | zfix tx2(x), ty2(y); | |
| 18466 | 23469 | zfix dx, dy; | |
| 18467 |
4/5✓ Branch 0 taken 4222 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5831 times.
✓ Branch 3 taken 4497 times.
✓ Branch 4 taken 8919 times.
|
23469 | switch(dir) |
| 18468 | { | ||
| 18469 | case left: | ||
| 18470 | 5831 | tx2 = tmp; | |
| 18471 | 5831 | break; | |
| 18472 | case right: | ||
| 18473 | 4497 | tx2 = tmp; | |
| 18474 | 4497 | break; | |
| 18475 | default: | ||
| 18476 | case up: | ||
| 18477 | 4222 | ty2 = tmp; | |
| 18478 | 4222 | break; | |
| 18479 | case down: | ||
| 18480 | 8919 | ty2 = tmp; | |
| 18481 | 8919 | break; | |
| 18482 | } | ||
| 18483 |
4/5✓ Branch 0 taken 4882 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4110 times.
✓ Branch 3 taken 9031 times.
✓ Branch 4 taken 5446 times.
|
23469 | switch(mdir) |
| 18484 | { | ||
| 18485 | case left: | ||
| 18486 | 4110 | dx = -0.0001_zf; | |
| 18487 | 4110 | break; | |
| 18488 | case right: | ||
| 18489 | 9031 | dx = 0.0001_zf; | |
| 18490 | 9031 | break; | |
| 18491 | default: | ||
| 18492 | case up: | ||
| 18493 | 4882 | dy = -0.0001_zf; | |
| 18494 | 4882 | break; | |
| 18495 | case down: | ||
| 18496 | 5446 | dy = 0.0001_zf; | |
| 18497 | 5446 | break; | |
| 18498 | } | ||
| 18499 | 23469 | zfix oldx(x), oldy(y); | |
| 18500 | 23469 | x = tx2; | |
| 18501 | 23469 | y = ty2; | |
| 18502 | 23469 | int laddercheck = -1; | |
| 18503 | 23469 | bool valid = scr_canmove(dx, dy, kb, true, &laddercheck); | |
| 18504 |
1/2✓ Branch 0 taken 23469 times.
✗ Branch 1 not taken.
|
23469 | if (laddercheck > 0) valid = true; |
| 18505 | 23469 | x = oldx; | |
| 18506 | 23469 | y = oldy; | |
| 18507 |
2/2✓ Branch 0 taken 23419 times.
✓ Branch 1 taken 50 times.
|
23469 | if(valid) |
| 18508 | 23419 | return tmp; | |
| 18509 | 50 | } | |
| 18510 | 29958 | return std::nullopt; | |
| 18511 | 53377 | } | |
| 18512 | |||
| 18513 | 720884 | bool HeroClass::movexy(zfix dx, zfix dy, bool kb, bool ign_sv, bool shove, bool earlyret) | |
| 18514 | { | ||
| 18515 | 720884 | bool ret = true; | |
| 18516 | 720884 | int ladderstuff = -1; | |
| 18517 |
3/10✓ Branch 0 taken 696765 times.
✓ Branch 1 taken 24119 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 696765 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
720884 | bool sv = !ign_sv && sideview_mode() && !getOnSideviewLadder() && action != sideswimming && action != sideswimhit && action != sideswimattacking; |
| 18518 |
1/2✓ Branch 0 taken 720884 times.
✗ Branch 1 not taken.
|
720884 | if(sv) |
| 18519 | ✗ | dy = 0; | |
| 18520 |
4/4✓ Branch 0 taken 420622 times.
✓ Branch 1 taken 300262 times.
✓ Branch 2 taken 355105 times.
✓ Branch 3 taken 65517 times.
|
720884 | if(dx && dy) |
| 18521 | 65517 | shove = false; | |
| 18522 | 720884 | bool checkladder = dy < 0; | |
| 18523 | |||
| 18524 | 720884 | const int scl = 2; | |
| 18525 |
4/4✓ Branch 0 taken 14 times.
✓ Branch 1 taken 720940 times.
✓ Branch 2 taken 70 times.
✓ Branch 3 taken 720884 times.
|
720954 | while(abs(dx) > scl || abs(dy) > scl) |
| 18526 | { | ||
| 18527 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 56 times.
|
70 | if(abs(dx) > abs(dy)) |
| 18528 | { | ||
| 18529 | 14 | int32_t tdx = dx.sign() * scl; | |
| 18530 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | if(movexy(tdx, 0, kb, ign_sv, shove, earlyret)) |
| 18531 | 14 | dx -= tdx; | |
| 18532 | else | ||
| 18533 | { | ||
| 18534 | ✗ | if(earlyret) return false; | |
| 18535 | ✗ | dx = tdx; | |
| 18536 | ✗ | ret = false; | |
| 18537 | } | ||
| 18538 | 14 | } | |
| 18539 | else | ||
| 18540 | { | ||
| 18541 | 56 | int32_t tdy = dy.sign() * scl; | |
| 18542 |
1/2✓ Branch 0 taken 56 times.
✗ Branch 1 not taken.
|
56 | if(movexy(0, tdy, kb, ign_sv, shove, earlyret)) |
| 18543 | 56 | dy -= tdy; | |
| 18544 | else | ||
| 18545 | { | ||
| 18546 | ✗ | if(earlyret) return false; | |
| 18547 | ✗ | dy = tdy; | |
| 18548 | ✗ | ret = false; | |
| 18549 | } | ||
| 18550 | } | ||
| 18551 | } | ||
| 18552 | |||
| 18553 |
10/12✓ Branch 0 taken 276384 times.
✓ Branch 1 taken 444500 times.
✓ Branch 2 taken 22832 times.
✓ Branch 3 taken 253552 times.
✓ Branch 4 taken 22832 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 556 times.
✓ Branch 7 taken 22276 times.
✓ Branch 8 taken 22176 times.
✓ Branch 9 taken 100 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 22176 times.
|
720884 | bool skipdmg = earlyret || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || hclk || ((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)); |
| 18554 |
2/2✓ Branch 0 taken 300262 times.
✓ Branch 1 taken 420622 times.
|
720884 | if(dx) |
| 18555 | { | ||
| 18556 |
2/2✓ Branch 0 taken 350219 times.
✓ Branch 1 taken 70403 times.
|
420622 | if(scr_canmove(dx, 0, kb, ign_sv, &ladderstuff)) |
| 18557 | { | ||
| 18558 |
1/2✓ Branch 0 taken 350219 times.
✗ Branch 1 not taken.
|
350219 | if (ladderstuff == 1) |
| 18559 | { | ||
| 18560 | ✗ | zfix tx = (dx < 0 ? (x+dx) : (x+8+dx)); | |
| 18561 | ✗ | zfix tx2 = (dx < 0 ? 15 : 0); | |
| 18562 | ✗ | zfix tx3 = (dx < 0 ? -8 : 8); | |
| 18563 | ✗ | ladderx = tx.getInt()&0xF8; | |
| 18564 | ✗ | laddery = y.getTrunc(); | |
| 18565 | ✗ | if (((iswaterex(MAPCOMBO(ladderx+tx2,y+9), currmap, currscr, -1, ladderx+tx2,y+9) != 0) || getpitfall(ladderx+tx2,y+9)) | |
| 18566 | ✗ | && ((iswaterex(MAPCOMBO(ladderx+tx2,y+15), currmap, currscr, -1, ladderx+tx2,y+15) != 0) || getpitfall(ladderx+tx2,y+15))) | |
| 18567 | { | ||
| 18568 | ✗ | ladderdir = left; | |
| 18569 | ✗ | ladderstart = dir; | |
| 18570 | ✗ | } | |
| 18571 | ✗ | else if (((iswaterex(MAPCOMBO(ladderx+tx2+tx3,y+9), currmap, currscr, -1, ladderx+tx2+tx3,y+9) != 0) || getpitfall(ladderx+tx2+tx3,y+9)) | |
| 18572 | ✗ | && ((iswaterex(MAPCOMBO(ladderx+tx2+tx3,y+15), currmap, currscr, -1, ladderx+tx2+tx3,y+15) != 0) || getpitfall(ladderx+tx2+tx3,y+15))) | |
| 18573 | { | ||
| 18574 | ✗ | ladderx = (tx.getInt()+tx3.getInt())&0xF8; | |
| 18575 | ✗ | ladderdir = left; | |
| 18576 | ✗ | ladderstart = dir; | |
| 18577 | ✗ | } | |
| 18578 | else | ||
| 18579 | { | ||
| 18580 | ✗ | ladderx = 0; | |
| 18581 | ✗ | laddery = 0; | |
| 18582 | } | ||
| 18583 | ✗ | } | |
| 18584 |
1/2✓ Branch 0 taken 350219 times.
✗ Branch 1 not taken.
|
350219 | if (ladderstuff > 0) ladderstuff = 0; |
| 18585 | 350219 | x += dx; | |
| 18586 | 350219 | } | |
| 18587 | else | ||
| 18588 | { | ||
| 18589 | 70403 | bool stopped = true; | |
| 18590 | 70403 | bool shoved = false; | |
| 18591 |
2/2✓ Branch 0 taken 10934 times.
✓ Branch 1 taken 59469 times.
|
70403 | if(shove) |
| 18592 | { | ||
| 18593 |
2/2✓ Branch 0 taken 24467 times.
✓ Branch 1 taken 35002 times.
|
59469 | zfix tx = (dx < 0 ? (x-4) : (x+20)); |
| 18594 | 59469 | int v=bigHitbox?0:8; | |
| 18595 | 59469 | zfix ly = y+v; | |
| 18596 | 59469 | zfix ry = y+15.9999_zf; | |
| 18597 | 59469 | zfix ly2 = y+v+6; | |
| 18598 | 59469 | zfix ry2 = y+9.9999_zf; | |
| 18599 | 59469 | auto mdir = GET_XDIR(dx); | |
| 18600 | 59469 | int laddershove = -1; | |
| 18601 | 59469 | int ladderhit = 0; | |
| 18602 | 59469 | bool onladder = (ladderx + laddery); | |
| 18603 | 59469 | bool hit_top = scr_walkflag(tx,ly,mdir,false, &laddershove); | |
| 18604 |
1/2✓ Branch 0 taken 59469 times.
✗ Branch 1 not taken.
|
59469 | if (laddershove > 0) |
| 18605 | { | ||
| 18606 | ✗ | hit_top = false; | |
| 18607 | ✗ | ladderhit += 1; | |
| 18608 | ✗ | } | |
| 18609 | 59469 | laddershove = -1; | |
| 18610 | 59469 | bool hit_bottom = scr_walkflag(tx,ry,mdir,false, &laddershove); | |
| 18611 |
1/2✓ Branch 0 taken 59469 times.
✗ Branch 1 not taken.
|
59469 | if (laddershove > 0) |
| 18612 | { | ||
| 18613 | ✗ | hit_bottom = false; | |
| 18614 | ✗ | ladderhit += 2; | |
| 18615 | ✗ | } | |
| 18616 | 59469 | laddershove = -1; | |
| 18617 | 59469 | bool hit_top2 = scr_walkflag(tx,ly2,mdir,false); | |
| 18618 | 59469 | bool hit_bottom2 = scr_walkflag(tx,ry2,mdir,false); | |
| 18619 |
3/4✓ Branch 0 taken 4744 times.
✓ Branch 1 taken 54725 times.
✓ Branch 2 taken 4744 times.
✗ Branch 3 not taken.
|
59469 | if (!hit_top && ladderhit == 2) |
| 18620 | { | ||
| 18621 | ✗ | hit_bottom = true; | |
| 18622 | ✗ | } | |
| 18623 |
3/4✓ Branch 0 taken 9360 times.
✓ Branch 1 taken 50109 times.
✓ Branch 2 taken 9360 times.
✗ Branch 3 not taken.
|
59469 | if (!hit_bottom && ladderhit == 1) |
| 18624 | { | ||
| 18625 | ✗ | hit_top = true; | |
| 18626 | ✗ | } | |
| 18627 |
2/2✓ Branch 0 taken 45599 times.
✓ Branch 1 taken 13870 times.
|
59469 | if(hit_top!=hit_bottom) |
| 18628 | { | ||
| 18629 |
2/2✓ Branch 0 taken 4627 times.
✓ Branch 1 taken 9243 times.
|
13870 | if(hit_bottom) //shove up |
| 18630 | { | ||
| 18631 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 4627 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
4627 | if (onladder && (ladderdir == left || ladderdir == right) && !hit_bottom2) |
| 18632 | { | ||
| 18633 | ✗ | y -= 1_zf; | |
| 18634 | ✗ | shoved = true; | |
| 18635 | ✗ | } | |
| 18636 |
4/6✓ Branch 0 taken 4613 times.
✓ Branch 1 taken 14 times.
✓ Branch 2 taken 14 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4627 times.
|
4627 | else if(skipdmg || !checkdamagecombos(tx,get_qr(qr_SENSITIVE_SOLID_DAMAGE)?int32_t(y+15):(v+bigHitbox?11:4))) |
| 18637 | { | ||
| 18638 |
2/2✓ Branch 0 taken 409 times.
✓ Branch 1 taken 4218 times.
|
4627 | if(optional<zfix> ty = get_solid_coord(tx,ry,up,mdir,false,ry-shove_offset, (ladderhit != 2))) |
| 18639 | { | ||
| 18640 |
2/2✓ Branch 0 taken 1023 times.
✓ Branch 1 taken 3195 times.
|
4218 | zfix dy = zc_max(-1_zf,*ty-y); |
| 18641 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4218 times.
|
4218 | if((shoved = dy)) |
| 18642 | 4218 | movexy(0, dy, kb, true, false, false); | |
| 18643 | 4218 | } | |
| 18644 | 4627 | } | |
| 18645 | 4627 | } | |
| 18646 | else //shove down | ||
| 18647 | { | ||
| 18648 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 9243 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
9243 | if (onladder && (ladderdir == left || ladderdir == right) && !hit_top2) |
| 18649 | { | ||
| 18650 | ✗ | y += 1_zf; | |
| 18651 | ✗ | shoved = true; | |
| 18652 | ✗ | } | |
| 18653 |
3/4✓ Branch 0 taken 1 times.
✓ Branch 1 taken 9242 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
|
9243 | else if(skipdmg || !checkdamagecombos(tx,v+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4))) |
| 18654 | { | ||
| 18655 |
2/2✓ Branch 0 taken 324 times.
✓ Branch 1 taken 8919 times.
|
9243 | if(optional<zfix> ty = get_solid_coord(tx,ly,down,mdir,false,ly+shove_offset, (ladderhit != 1))) |
| 18656 | { | ||
| 18657 |
2/2✓ Branch 0 taken 8286 times.
✓ Branch 1 taken 633 times.
|
8919 | zfix dy = zc_min(1_zf,*ty-y); |
| 18658 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8919 times.
|
8919 | if((shoved = dy)) |
| 18659 | 8919 | movexy(0, dy, kb, true, false, false); | |
| 18660 | 8919 | } | |
| 18661 | 9243 | } | |
| 18662 | } | ||
| 18663 | |||
| 18664 |
4/4✓ Branch 0 taken 13137 times.
✓ Branch 1 taken 733 times.
✓ Branch 2 taken 11366 times.
✓ Branch 3 taken 1771 times.
|
13870 | if(shoved && scr_canmove(dx, 0, kb, ign_sv)) |
| 18665 | { | ||
| 18666 | 1771 | x += dx; | |
| 18667 | 1771 | stopped = false; | |
| 18668 | 1771 | } | |
| 18669 | 13870 | } | |
| 18670 | 59469 | } | |
| 18671 |
2/2✓ Branch 0 taken 1771 times.
✓ Branch 1 taken 68632 times.
|
70403 | if(stopped) |
| 18672 | { | ||
| 18673 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 68632 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
68632 | if (ladderstuff > 0 && !shoved) |
| 18674 | { | ||
| 18675 | ✗ | zfix tx = (dx < 0 ? (x-12) : (x+20)); | |
| 18676 | ✗ | ladderx = tx.getInt()&0xF8; | |
| 18677 | ✗ | laddery = y.getTrunc(); | |
| 18678 | ✗ | ladderdir = left; | |
| 18679 | ✗ | ladderstart = dir; | |
| 18680 | ✗ | x += dx; | |
| 18681 | ✗ | ladderstuff = 0; | |
| 18682 | ✗ | } | |
| 18683 |
2/2✓ Branch 0 taken 48997 times.
✓ Branch 1 taken 19635 times.
|
68632 | else if(earlyret) |
| 18684 | { | ||
| 18685 | 48997 | ret = false; | |
| 18686 | 48997 | } | |
| 18687 | else | ||
| 18688 | { | ||
| 18689 | 19635 | ret = false; | |
| 18690 | 19635 | int xsign = dx.sign(); | |
| 18691 |
2/2✓ Branch 0 taken 1854 times.
✓ Branch 1 taken 17781 times.
|
19635 | if(abs(dx) > 1) |
| 18692 | { | ||
| 18693 |
2/2✓ Branch 0 taken 465 times.
✓ Branch 1 taken 17781 times.
|
18246 | while(scr_canmove(xsign, 0, kb, ign_sv)) |
| 18694 | { | ||
| 18695 | 465 | x += xsign; | |
| 18696 | 465 | dx -= xsign; | |
| 18697 | } | ||
| 18698 | 17781 | } | |
| 18699 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19635 times.
|
19635 | if(dx) |
| 18700 | { | ||
| 18701 | 19635 | dx.doDecBound(0,-9999, 0,9999); | |
| 18702 |
3/6✓ Branch 0 taken 19635 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 19635 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 19635 times.
✗ Branch 5 not taken.
|
311269 | dx = binary_search_zfix(dx.decsign(), dx, [&](zfix val, zfix& retval){ |
| 18703 |
2/2✓ Branch 0 taken 8889 times.
✓ Branch 1 taken 282745 times.
|
291634 | if(scr_canmove(val, 0, kb, ign_sv)) |
| 18704 | { | ||
| 18705 | 8889 | retval = val; | |
| 18706 | 8889 | return BSEARCH_CONTINUE_AWAY0; | |
| 18707 | } | ||
| 18708 | 282745 | else return BSEARCH_CONTINUE_TOWARD0; | |
| 18709 | 291634 | }); | |
| 18710 | 19635 | x += dx; | |
| 18711 | 19635 | } | |
| 18712 | } | ||
| 18713 | 68632 | } | |
| 18714 | } | ||
| 18715 | 420622 | } | |
| 18716 | 720884 | ladderstuff = -1; | |
| 18717 |
2/2✓ Branch 0 taken 356063 times.
✓ Branch 1 taken 364821 times.
|
720884 | if(dy) |
| 18718 | { | ||
| 18719 |
2/2✓ Branch 0 taken 260923 times.
✓ Branch 1 taken 103898 times.
|
364821 | if(scr_canmove(0, dy, kb, ign_sv, &ladderstuff)) |
| 18720 | { | ||
| 18721 |
1/2✓ Branch 0 taken 260923 times.
✗ Branch 1 not taken.
|
260923 | if (ladderstuff == 1) |
| 18722 | { | ||
| 18723 | ✗ | zfix ty = (dy < 0 ? (y+(bigHitbox?0:8)+dy) : (y+8+dy)); | |
| 18724 | ✗ | zfix ty2 = (dy < 0 ? 15 : 0); | |
| 18725 | ✗ | zfix ty3 = (dy < 0 ? -8 : 8); | |
| 18726 | |||
| 18727 | ✗ | ladderx = x.getTrunc(); | |
| 18728 | ✗ | laddery = ty.getInt()&0xF8; | |
| 18729 | ✗ | if (((iswaterex(MAPCOMBO(x+4,laddery+ty2), currmap, currscr, -1, x+4,laddery+ty2) != 0) || getpitfall(x+4,laddery+ty2)) | |
| 18730 | ✗ | && ((iswaterex(MAPCOMBO(x+11,laddery+ty2), currmap, currscr, -1, x+11,laddery+ty2) != 0) || getpitfall(x+11,laddery+ty2))) | |
| 18731 | { | ||
| 18732 | ✗ | ladderdir = up; | |
| 18733 | ✗ | ladderstart = dir; | |
| 18734 | ✗ | } | |
| 18735 | ✗ | else if (((iswaterex(MAPCOMBO(x+4,laddery+ty2+ty3), currmap, currscr, -1, x+4,laddery+ty2+ty3) != 0) || getpitfall(x+4,laddery+ty2+ty3)) | |
| 18736 | ✗ | && ((iswaterex(MAPCOMBO(x+11,laddery+ty2+ty3), currmap, currscr, -1, x+11,laddery+ty2+ty3) != 0) || getpitfall(x+11,laddery+ty2+ty3))) | |
| 18737 | { | ||
| 18738 | ✗ | laddery = (ty.getInt() + ty3.getInt())&0xF8; | |
| 18739 | ✗ | ladderdir = up; | |
| 18740 | ✗ | ladderstart = dir; | |
| 18741 | ✗ | } | |
| 18742 | else | ||
| 18743 | { | ||
| 18744 | ✗ | ladderx = 0; | |
| 18745 | ✗ | laddery = 0; | |
| 18746 | } | ||
| 18747 | ✗ | } | |
| 18748 |
1/2✓ Branch 0 taken 260923 times.
✗ Branch 1 not taken.
|
260923 | if (ladderstuff > 0) ladderstuff = 0; |
| 18749 | 260923 | y += dy; | |
| 18750 | 260923 | } | |
| 18751 | else | ||
| 18752 | { | ||
| 18753 | 103898 | bool stopped = true; | |
| 18754 | 103898 | bool shoved = false; | |
| 18755 |
2/2✓ Branch 0 taken 11742 times.
✓ Branch 1 taken 92156 times.
|
103898 | if(shove) |
| 18756 | { | ||
| 18757 |
2/2✓ Branch 0 taken 66475 times.
✓ Branch 1 taken 25681 times.
|
92156 | zfix ty = (dy < 0 ? (y+(bigHitbox?0:8)-4) : (y+20)); |
| 18758 | 92156 | zfix lx = x; | |
| 18759 | 92156 | zfix rx = x+15.9999_zf; | |
| 18760 | 92156 | zfix lx2 = x+6; | |
| 18761 | 92156 | zfix rx2 = x+9.9999_zf; | |
| 18762 | 92156 | auto mdir = GET_YDIR(dy); | |
| 18763 | 92156 | int laddershove = -1; | |
| 18764 | 92156 | int ladderhit = 0; | |
| 18765 | 92156 | bool onladder = (ladderx + laddery); | |
| 18766 | 92156 | bool hit_left = scr_walkflag(lx,ty,mdir,false, &laddershove); | |
| 18767 |
1/2✓ Branch 0 taken 92156 times.
✗ Branch 1 not taken.
|
92156 | if (laddershove > 0) |
| 18768 | { | ||
| 18769 | ✗ | hit_left = false; | |
| 18770 | ✗ | ladderhit += 1; | |
| 18771 | ✗ | } | |
| 18772 | 92156 | laddershove = -1; | |
| 18773 | 92156 | bool hit_right = scr_walkflag(rx,ty,mdir,false, &laddershove); | |
| 18774 |
1/2✓ Branch 0 taken 92156 times.
✗ Branch 1 not taken.
|
92156 | if (laddershove > 0) |
| 18775 | { | ||
| 18776 | ✗ | hit_right = false; | |
| 18777 | ✗ | ladderhit += 2; | |
| 18778 | ✗ | } | |
| 18779 | 92156 | bool hit_left2 = scr_walkflag(lx2,ty,mdir,false); | |
| 18780 | 92156 | bool hit_right2 = scr_walkflag(rx2,ty,mdir,false); | |
| 18781 | 92156 | laddershove = -1; | |
| 18782 |
3/4✓ Branch 0 taken 21285 times.
✓ Branch 1 taken 70871 times.
✓ Branch 2 taken 21285 times.
✗ Branch 3 not taken.
|
92156 | if (!hit_left && ladderhit == 2) |
| 18783 | { | ||
| 18784 | ✗ | hit_right = true; | |
| 18785 | ✗ | } | |
| 18786 |
3/4✓ Branch 0 taken 18570 times.
✓ Branch 1 taken 73586 times.
✓ Branch 2 taken 18570 times.
✗ Branch 3 not taken.
|
92156 | if (!hit_right && ladderhit == 1) |
| 18787 | { | ||
| 18788 | ✗ | hit_left = true; | |
| 18789 | ✗ | } | |
| 18790 |
2/2✓ Branch 0 taken 52649 times.
✓ Branch 1 taken 39507 times.
|
92156 | if(hit_left!=hit_right) |
| 18791 | { | ||
| 18792 |
2/2✓ Branch 0 taken 21111 times.
✓ Branch 1 taken 18396 times.
|
39507 | if(hit_right) //shove left |
| 18793 | { | ||
| 18794 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 21111 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
21111 | if (onladder && ladderdir <= down && !hit_right2) |
| 18795 | { | ||
| 18796 | ✗ | x -= 1_zf; | |
| 18797 | ✗ | shoved = true; | |
| 18798 | ✗ | } | |
| 18799 |
3/4✓ Branch 0 taken 21106 times.
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 21111 times.
|
21111 | else if(skipdmg || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11),ty)) |
| 18800 | { | ||
| 18801 |
2/2✓ Branch 0 taken 15280 times.
✓ Branch 1 taken 5831 times.
|
21111 | if(optional<zfix> tx = get_solid_coord(rx,ty,left,mdir,false,rx-shove_offset, (ladderhit != 2))) |
| 18802 | { | ||
| 18803 |
2/2✓ Branch 0 taken 4391 times.
✓ Branch 1 taken 1440 times.
|
5831 | zfix dx = zc_max(-1_zf,*tx-x); |
| 18804 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5831 times.
|
5831 | if((shoved = dx)) |
| 18805 | 5831 | movexy(dx, 0, kb, true, false, false); | |
| 18806 | 5831 | } | |
| 18807 | 21111 | } | |
| 18808 | 21111 | } | |
| 18809 | else //shove right | ||
| 18810 | { | ||
| 18811 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 18396 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
18396 | if (onladder && ladderdir <= down && !hit_left2) |
| 18812 | { | ||
| 18813 | ✗ | x += 1_zf; | |
| 18814 | ✗ | shoved = true; | |
| 18815 | ✗ | } | |
| 18816 |
3/4✓ Branch 0 taken 18393 times.
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 18396 times.
|
18396 | else if(skipdmg || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4),ty)) |
| 18817 | { | ||
| 18818 |
2/2✓ Branch 0 taken 13945 times.
✓ Branch 1 taken 4451 times.
|
18396 | if(optional<zfix> tx = get_solid_coord(lx,ty,right,mdir,false,lx+shove_offset, (ladderhit != 1))) |
| 18819 | { | ||
| 18820 |
2/2✓ Branch 0 taken 1671 times.
✓ Branch 1 taken 2780 times.
|
4451 | zfix dx = zc_min(1_zf,*tx-x); |
| 18821 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4451 times.
|
4451 | if((shoved = dx)) |
| 18822 | 4451 | movexy(dx, 0, kb, true, false, false); | |
| 18823 | 4451 | } | |
| 18824 | 18396 | } | |
| 18825 | } | ||
| 18826 | |||
| 18827 |
4/4✓ Branch 0 taken 10282 times.
✓ Branch 1 taken 29225 times.
✓ Branch 2 taken 6903 times.
✓ Branch 3 taken 3379 times.
|
39507 | if(shoved && scr_canmove(0, dy, kb, ign_sv)) |
| 18828 | { | ||
| 18829 | 3379 | y += dy; | |
| 18830 | 3379 | stopped = false; | |
| 18831 | 3379 | } | |
| 18832 | 39507 | } | |
| 18833 | 92156 | } | |
| 18834 |
2/2✓ Branch 0 taken 3379 times.
✓ Branch 1 taken 100519 times.
|
103898 | if(stopped) |
| 18835 | { | ||
| 18836 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 100519 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
100519 | if (ladderstuff > 0 && !shoved) |
| 18837 | { | ||
| 18838 | ✗ | zfix ty = (dy < 0 ? (y-(bigHitbox?12:4)) : (y+20)); | |
| 18839 | ✗ | ladderx = x.getTrunc(); | |
| 18840 | ✗ | laddery = ty.getInt()&0xF8; | |
| 18841 | ✗ | ladderdir = up; | |
| 18842 | ✗ | ladderstart = dir; | |
| 18843 | ✗ | y += dy; | |
| 18844 | ✗ | ladderstuff = 0; | |
| 18845 | ✗ | } | |
| 18846 | else | ||
| 18847 | { | ||
| 18848 |
2/2✓ Branch 0 taken 79867 times.
✓ Branch 1 taken 20652 times.
|
100519 | if(earlyret) return false; |
| 18849 | 20652 | ret = false; | |
| 18850 | 20652 | int ysign = dy.sign(); | |
| 18851 |
2/2✓ Branch 0 taken 2434 times.
✓ Branch 1 taken 18218 times.
|
20652 | if(abs(dy) > 1) |
| 18852 | { | ||
| 18853 |
2/2✓ Branch 0 taken 339 times.
✓ Branch 1 taken 18218 times.
|
18557 | while(scr_canmove(0, ysign, kb, ign_sv)) |
| 18854 | { | ||
| 18855 | 339 | y += ysign; | |
| 18856 | 339 | dy -= ysign; | |
| 18857 | } | ||
| 18858 | 18218 | } | |
| 18859 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20652 times.
|
20652 | if(dy) |
| 18860 | { | ||
| 18861 | 20652 | dy.doDecBound(0,-9999, 0,9999); | |
| 18862 |
3/6✓ Branch 0 taken 20652 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 20652 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 20652 times.
✗ Branch 5 not taken.
|
327499 | dy = binary_search_zfix(dy.decsign(), dy, [&](zfix val, zfix& retval){ |
| 18863 |
2/2✓ Branch 0 taken 10051 times.
✓ Branch 1 taken 296796 times.
|
306847 | if(scr_canmove(0, val, kb, ign_sv)) |
| 18864 | { | ||
| 18865 | 10051 | retval = val; | |
| 18866 | 10051 | return BSEARCH_CONTINUE_AWAY0; | |
| 18867 | } | ||
| 18868 | 296796 | else return BSEARCH_CONTINUE_TOWARD0; | |
| 18869 | 306847 | }); | |
| 18870 | 20652 | y += dy; | |
| 18871 | 20652 | } | |
| 18872 | } | ||
| 18873 | 20652 | } | |
| 18874 | } | ||
| 18875 | 284954 | } | |
| 18876 | |||
| 18877 |
2/2✓ Branch 0 taken 364633 times.
✓ Branch 1 taken 276384 times.
|
641017 | if(earlyret) |
| 18878 | 364633 | return ret; | |
| 18879 |
5/10✓ Branch 0 taken 64233 times.
✓ Branch 1 taken 212151 times.
✓ Branch 2 taken 60045 times.
✓ Branch 3 taken 4188 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 60045 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
276384 | if(dy < 0 && !ign_sv && sideview_mode() && IsSideSwim() && checkladder) |
| 18880 | { | ||
| 18881 | ✗ | if(!iswaterex(MAPCOMBO(x, y+(bigHitbox?0:8)-2), currmap, currscr, -1, x, y+(bigHitbox?0:8) - 2, true, false) | |
| 18882 | ✗ | && !canSideviewLadderRemote(x, y-4) && scr_canmove(0, -2, kb, true) && (y+(bigHitbox?0:8) - 4) > 0) | |
| 18883 | { | ||
| 18884 | ✗ | if (game->get_sideswim_jump() != 0) | |
| 18885 | { | ||
| 18886 | ✗ | setFall(zfix(0-(FEATHERJUMP*(game->get_sideswim_jump()/10000.0)))); | |
| 18887 | ✗ | sfx(WAV_ZN1SPLASH,(int32_t)x); | |
| 18888 | ✗ | hopclk = 0; | |
| 18889 | ✗ | if (charging || spins) action = attacking; | |
| 18890 | ✗ | else action = none; | |
| 18891 | ✗ | } | |
| 18892 | else | ||
| 18893 | { | ||
| 18894 | ✗ | movexy(0,-1*dy,false,false,false); | |
| 18895 | } | ||
| 18896 | ✗ | } | |
| 18897 | ✗ | } | |
| 18898 | 276384 | return ret; | |
| 18899 | 720884 | } | |
| 18900 | 3596 | bool HeroClass::can_movexy(zfix dx, zfix dy, bool kb, bool ign_sv, bool shove) | |
| 18901 | { | ||
| 18902 |
1/2✓ Branch 0 taken 3596 times.
✗ Branch 1 not taken.
|
7192 | return handle_movestate([&]() |
| 18903 | { | ||
| 18904 | 3596 | return movexy(dx,dy,kb,ign_sv,shove,true); | |
| 18905 | }); | ||
| 18906 | ✗ | } | |
| 18907 | ✗ | bool HeroClass::moveAtAngle(zfix degrees, zfix px, bool kb, bool ign_sv, bool shove, bool earlyret) | |
| 18908 | { | ||
| 18909 | ✗ | double v = degrees.getFloat() * PI / 180.0; | |
| 18910 | ✗ | zfix dx = zc::math::Cos(v)*px, dy = zc::math::Sin(v)*px; | |
| 18911 | ✗ | return movexy(dx, dy, kb, ign_sv, shove, earlyret); | |
| 18912 | } | ||
| 18913 | ✗ | bool HeroClass::can_moveAtAngle(zfix degrees, zfix px, bool kb, bool ign_sv, bool shove) | |
| 18914 | { | ||
| 18915 | ✗ | return handle_movestate([&]() | |
| 18916 | { | ||
| 18917 | ✗ | return moveAtAngle(degrees,px,kb,ign_sv,shove,true); | |
| 18918 | }); | ||
| 18919 | ✗ | } | |
| 18920 | 440764 | bool HeroClass::moveDir(int dir, zfix px, bool kb, bool ign_sv, bool shove, bool earlyret) | |
| 18921 | { | ||
| 18922 |
4/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 440762 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
440764 | static const zfix diagrate = zslongToFix(7071); |
| 18923 |
6/13✓ Branch 0 taken 440764 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 440764 times.
✓ Branch 4 taken 128017 times.
✓ Branch 5 taken 84306 times.
✓ Branch 6 taken 110138 times.
✓ Branch 7 taken 118303 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
|
440764 | switch(NORMAL_DIR(dir)) |
| 18924 | { | ||
| 18925 | case up: | ||
| 18926 | 128017 | return movexy(0, -px, kb, ign_sv, shove, earlyret); | |
| 18927 | case down: | ||
| 18928 | 84306 | return movexy(0, px, kb, ign_sv, shove, earlyret); | |
| 18929 | case left: | ||
| 18930 | 110138 | return movexy(-px, 0, kb, ign_sv, shove, earlyret); | |
| 18931 | case right: | ||
| 18932 | 118303 | return movexy(px, 0, kb, ign_sv, shove, earlyret); | |
| 18933 | case r_up: | ||
| 18934 | ✗ | return movexy(px*diagrate, -px*diagrate, kb, ign_sv, shove, earlyret); | |
| 18935 | case r_down: | ||
| 18936 | ✗ | return movexy(px*diagrate, px*diagrate, kb, ign_sv, shove, earlyret); | |
| 18937 | case l_up: | ||
| 18938 | ✗ | return movexy(-px*diagrate, -px*diagrate, kb, ign_sv, shove, earlyret); | |
| 18939 | case l_down: | ||
| 18940 | ✗ | return movexy(-px*diagrate, px*diagrate, kb, ign_sv, shove, earlyret); | |
| 18941 | } | ||
| 18942 | ✗ | return false; | |
| 18943 | 440764 | } | |
| 18944 | 440764 | bool HeroClass::can_moveDir(int dir, zfix px, bool kb, bool ign_sv, bool shove) | |
| 18945 | { | ||
| 18946 |
1/2✓ Branch 0 taken 440764 times.
✗ Branch 1 not taken.
|
881528 | return handle_movestate([&]() |
| 18947 | { | ||
| 18948 | 440764 | return moveDir(dir,px,kb,ign_sv,shove,true); | |
| 18949 | }); | ||
| 18950 | ✗ | } | |
| 18951 | |||
| 18952 | |||
| 18953 | 391624 | bool HeroClass::premove() | |
| 18954 | { | ||
| 18955 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 391624 times.
|
391624 | if(lstunclock) return false; |
| 18956 |
3/4✓ Branch 0 taken 3217 times.
✓ Branch 1 taken 388407 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3217 times.
|
391624 | if(is_conveyor_stunned) return (convey_forcex || convey_forcey); |
| 18957 | 388407 | int32_t xoff=x.getInt()&7; | |
| 18958 | 388407 | int32_t yoff=y.getInt()&7; | |
| 18959 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 388407 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
388407 | if(NO_GRIDLOCK) |
| 18960 | { | ||
| 18961 | 388407 | xoff = 0; | |
| 18962 | 388407 | yoff = 0; | |
| 18963 | 388407 | } | |
| 18964 | 388407 | int32_t push=pushing; | |
| 18965 | 388407 | int32_t oldladderx=-1000, oldladdery=-1000; // moved here because linux complains "init crosses goto ~Koopa | |
| 18966 | 388407 | int32_t flippers_id = current_item_id(itype_flippers); | |
| 18967 | 388407 | itemdata const& itm = itemsbuf[flippers_id]; | |
| 18968 | 388407 | byte intbtn = byte(itm.misc3&0xFF); | |
| 18969 | 388407 | bool dive_pressed = getIntBtnInput(intbtn, true, true, false, false, true); | |
| 18970 | 388407 | bool eatdive = false; | |
| 18971 |
2/2✓ Branch 0 taken 411 times.
✓ Branch 1 taken 387996 times.
|
388407 | if(diveclk>0) |
| 18972 | { | ||
| 18973 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 411 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
411 | if (isSideViewHero() && get_qr(qr_SIDESWIM)) diveclk = 0; |
| 18974 | 411 | --diveclk; | |
| 18975 |
4/8✓ Branch 0 taken 326 times.
✓ Branch 1 taken 85 times.
✓ Branch 2 taken 326 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 326 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
411 | if(isDiving() && flippers_id > -1 && itemsbuf[flippers_id].flags & item_flag2 && dive_pressed) //Cancellable Diving -V |
| 18976 | { | ||
| 18977 | ✗ | diveclk = itemsbuf[flippers_id].misc2; | |
| 18978 | ✗ | eatdive = true; | |
| 18979 | ✗ | } | |
| 18980 | 411 | } | |
| 18981 |
4/4✓ Branch 0 taken 6251 times.
✓ Branch 1 taken 381745 times.
✓ Branch 2 taken 6240 times.
✓ Branch 3 taken 11 times.
|
387996 | else if(action == swimming && dive_pressed) |
| 18982 | { | ||
| 18983 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11 times.
|
11 | bool global_diving=(flippers_id > -1 && itemsbuf[flippers_id].flags & item_flag1); |
| 18984 | 11 | bool screen_diving=(tmpscr->flags5&fTOGGLEDIVING) != 0; | |
| 18985 | |||
| 18986 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11 times.
|
11 | if(global_diving==screen_diving) |
| 18987 | { | ||
| 18988 |
1/2✓ Branch 0 taken 11 times.
✗ Branch 1 not taken.
|
11 | diveclk = (flippers_id < 0 ? 80 : (itemsbuf[flippers_id].misc1 + itemsbuf[flippers_id].misc2)); |
| 18989 | 11 | eatdive = true; | |
| 18990 | 11 | } | |
| 18991 | 11 | } | |
| 18992 |
2/2✓ Branch 0 taken 388396 times.
✓ Branch 1 taken 11 times.
|
388407 | if(eatdive) |
| 18993 | 11 | getIntBtnInput(intbtn, true, true, false, false, false); | |
| 18994 | |||
| 18995 |
1/2✓ Branch 0 taken 388407 times.
✗ Branch 1 not taken.
|
388407 | if(action==rafting) |
| 18996 | { | ||
| 18997 | ✗ | do_rafting(); | |
| 18998 | |||
| 18999 | ✗ | if(action==rafting) | |
| 19000 | { | ||
| 19001 | ✗ | return false; | |
| 19002 | } | ||
| 19003 | |||
| 19004 | |||
| 19005 | ✗ | set_respawn_point(); | |
| 19006 | ✗ | trySideviewLadder(); | |
| 19007 | ✗ | } | |
| 19008 | |||
| 19009 | 388407 | int32_t olddirectwpn = directWpn; // To be reinstated if startwpn() fails | |
| 19010 | 388407 | int32_t btnwpn = -1; | |
| 19011 | |||
| 19012 | //&0xFFF removes the "bow & arrows" bitmask | ||
| 19013 | //The Quick Sword is allowed to interrupt attacks. | ||
| 19014 |
4/4✓ Branch 0 taken 377729 times.
✓ Branch 1 taken 10678 times.
✓ Branch 2 taken 256212 times.
✓ Branch 3 taken 121517 times.
|
388407 | int32_t currentSwordOrWand = (itemsbuf[dowpn].family == itype_wand || itemsbuf[dowpn].family == itype_sword)?dowpn:-1; |
| 19015 |
7/8✓ Branch 0 taken 354285 times.
✓ Branch 1 taken 34122 times.
✓ Branch 2 taken 354220 times.
✓ Branch 3 taken 65 times.
✓ Branch 4 taken 5547 times.
✓ Branch 5 taken 28640 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 34187 times.
|
388407 | if((!attackclk && action!=attacking && action != sideswimattacking) || ((attack==wSword || attack==wWand) && (itemsbuf[currentSwordOrWand].flags & item_flag5))) |
| 19016 | { | ||
| 19017 |
2/2✓ Branch 0 taken 174 times.
✓ Branch 1 taken 354046 times.
|
354220 | if(DrunkrBbtn()) |
| 19018 | { | ||
| 19019 | 174 | btnwpn=getItemFamily(itemsbuf,Bwpn); | |
| 19020 |
1/2✓ Branch 0 taken 174 times.
✗ Branch 1 not taken.
|
174 | dowpn = NEG_OR_MASK(Bwpn,0xFFF); |
| 19021 | 174 | directWpn = directItemB; | |
| 19022 | 174 | } | |
| 19023 |
2/2✓ Branch 0 taken 2097 times.
✓ Branch 1 taken 351949 times.
|
354046 | else if(DrunkrAbtn()) |
| 19024 | { | ||
| 19025 | 2097 | btnwpn=getItemFamily(itemsbuf,Awpn); | |
| 19026 |
1/2✓ Branch 0 taken 2097 times.
✗ Branch 1 not taken.
|
2097 | dowpn = NEG_OR_MASK(Awpn,0xFFF); |
| 19027 | 2097 | directWpn = directItemA; | |
| 19028 | 2097 | } | |
| 19029 |
3/4✓ Branch 0 taken 351949 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 351826 times.
✓ Branch 3 taken 123 times.
|
351949 | else if(get_qr(qr_SET_XBUTTON_ITEMS) && DrunkrEx1btn()) |
| 19030 | { | ||
| 19031 | 123 | btnwpn=getItemFamily(itemsbuf,Xwpn); | |
| 19032 |
1/2✓ Branch 0 taken 123 times.
✗ Branch 1 not taken.
|
123 | dowpn = NEG_OR_MASK(Xwpn,0xFFF); |
| 19033 | 123 | directWpn = directItemX; | |
| 19034 | 123 | } | |
| 19035 |
3/4✓ Branch 0 taken 351826 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 351713 times.
✓ Branch 3 taken 113 times.
|
351826 | else if(get_qr(qr_SET_YBUTTON_ITEMS) && DrunkrEx2btn()) |
| 19036 | { | ||
| 19037 | 113 | btnwpn=getItemFamily(itemsbuf,Ywpn); | |
| 19038 |
1/2✓ Branch 0 taken 113 times.
✗ Branch 1 not taken.
|
113 | dowpn = NEG_OR_MASK(Ywpn,0xFFF); |
| 19039 | 113 | directWpn = directItemY; | |
| 19040 | 113 | } | |
| 19041 | |||
| 19042 |
1/2✓ Branch 0 taken 354220 times.
✗ Branch 1 not taken.
|
354220 | if(directWpn >= MAXITEMS) directWpn = -1; |
| 19043 | |||
| 19044 | // The Quick Sword only allows repeated sword or wand swings. | ||
| 19045 |
3/8✓ Branch 0 taken 354220 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 354220 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 354220 times.
|
354220 | if((action==attacking||action==sideswimattacking) && ((attack==wSword && btnwpn!=itype_sword) || (attack==wWand && btnwpn!=itype_wand))) |
| 19046 | ✗ | btnwpn=-1; | |
| 19047 | 354220 | } | |
| 19048 | |||
| 19049 |
2/2✓ Branch 0 taken 132197 times.
✓ Branch 1 taken 256210 times.
|
388407 | auto swordid = (directWpn>-1 ? directWpn : current_item_id(itype_sword)); |
| 19050 |
10/12✓ Branch 0 taken 373805 times.
✓ Branch 1 taken 14602 times.
✓ Branch 2 taken 371156 times.
✓ Branch 3 taken 2649 times.
✓ Branch 4 taken 244736 times.
✓ Branch 5 taken 126420 times.
✓ Branch 6 taken 244736 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2097 times.
✓ Branch 9 taken 242639 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 2097 times.
|
388407 | if(can_attack() && (swordid > -1 && itemsbuf[swordid].family==itype_sword) && checkitem_jinx(swordid) && btnwpn==itype_sword && charging==0) |
| 19051 | { | ||
| 19052 |
1/2✓ Branch 0 taken 2097 times.
✗ Branch 1 not taken.
|
2097 | attackid=directWpn>-1 ? directWpn : current_item_id(itype_sword); |
| 19053 |
2/6✓ Branch 0 taken 2097 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2097 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
2097 | if(checkbunny(attackid) && (checkmagiccost(attackid) || !(itemsbuf[attackid].flags & item_flag6))) |
| 19054 | { | ||
| 19055 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2097 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2097 | if((itemsbuf[attackid].flags & item_flag6) && !(misc_internal_hero_flags & LF_PAID_SWORD_COST)) |
| 19056 | { | ||
| 19057 | ✗ | paymagiccost(attackid,true); | |
| 19058 | ✗ | misc_internal_hero_flags |= LF_PAID_SWORD_COST; | |
| 19059 | ✗ | } | |
| 19060 | 2097 | SetAttack(); | |
| 19061 | 2097 | attack=wSword; | |
| 19062 | |||
| 19063 | 2097 | attackclk=0; | |
| 19064 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2097 times.
|
2097 | sfx(itemsbuf[directWpn>-1 ? directWpn : current_item_id(itype_sword)].usesound, pan(x.getInt())); |
| 19065 | |||
| 19066 |
2/10✓ Branch 0 taken 2097 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2097 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
2097 | if(dowpn>-1 && itemsbuf[dowpn].script!=0 && !did_scripta && !(FFCore.doscript(ScriptType::Item, dowpn) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING))) |
| 19067 | { | ||
| 19068 | ✗ | if(!checkmagiccost(dowpn)) | |
| 19069 | { | ||
| 19070 | ✗ | item_error(); | |
| 19071 | ✗ | } | |
| 19072 | else | ||
| 19073 | { | ||
| 19074 | //clear the item script stack for a new script | ||
| 19075 | ✗ | int i = dowpn; | |
| 19076 | ✗ | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 19077 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[i].script, i); | |
| 19078 | ✗ | did_scripta=true; | |
| 19079 | } | ||
| 19080 | ✗ | } | |
| 19081 | 2097 | } | |
| 19082 | else | ||
| 19083 | { | ||
| 19084 | ✗ | item_error(); | |
| 19085 | } | ||
| 19086 | 2097 | } | |
| 19087 | else | ||
| 19088 | { | ||
| 19089 | 386310 | did_scripta=false; | |
| 19090 | } | ||
| 19091 | |||
| 19092 |
6/10✓ Branch 0 taken 381745 times.
✓ Branch 1 taken 6662 times.
✓ Branch 2 taken 381745 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 381745 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 381745 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 381745 times.
|
388407 | if(action!=swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking && !getOnSideviewLadder()) |
| 19093 | { | ||
| 19094 |
3/4✓ Branch 0 taken 67380 times.
✓ Branch 1 taken 314365 times.
✓ Branch 2 taken 67380 times.
✗ Branch 3 not taken.
|
381745 | if(DrunkUp() && canSideviewLadder()) |
| 19095 | { | ||
| 19096 | ✗ | setOnSideviewLadder(true); | |
| 19097 | ✗ | } | |
| 19098 |
3/4✓ Branch 0 taken 71299 times.
✓ Branch 1 taken 310446 times.
✓ Branch 2 taken 71299 times.
✗ Branch 3 not taken.
|
381745 | else if(DrunkDown() && canSideviewLadder(true)) |
| 19099 | { | ||
| 19100 | ✗ | y+=1; | |
| 19101 | ✗ | setOnSideviewLadder(true); | |
| 19102 | ✗ | } | |
| 19103 | 381745 | } | |
| 19104 | |||
| 19105 | 388407 | int32_t wx=x; | |
| 19106 | 388407 | int32_t wy=y; | |
| 19107 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 388407 times.
|
388407 | if(conv_forcedir > -1) dir = conv_forcedir; |
| 19108 |
3/6✓ Branch 0 taken 282848 times.
✓ Branch 1 taken 105559 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 388407 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
388407 | else if((action==none || action==walking) && getOnSideviewLadder() && (get_qr(qr_SIDEVIEWLADDER_FACEUP)!=0)) //Allow DIR to change if standing still on sideview ladder, and force-face up. |
| 19109 | { | ||
| 19110 | ✗ | if((xoff==0)||diagonalMovement) | |
| 19111 | { | ||
| 19112 | ✗ | if(DrunkUp()) dir=up; | |
| 19113 | ✗ | if(DrunkDown()) dir=down; | |
| 19114 | ✗ | } | |
| 19115 | |||
| 19116 | ✗ | if((yoff==0)||diagonalMovement) | |
| 19117 | { | ||
| 19118 | ✗ | if(DrunkLeft()) dir=left; | |
| 19119 | ✗ | if(DrunkRight()) dir=right; | |
| 19120 | ✗ | } | |
| 19121 | ✗ | } | |
| 19122 | |||
| 19123 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 78067 times.
✓ Branch 2 taken 85319 times.
✓ Branch 3 taken 113642 times.
✓ Branch 4 taken 111379 times.
|
388407 | switch(dir) |
| 19124 | { | ||
| 19125 | case up: | ||
| 19126 | 78067 | wy-=16; | |
| 19127 | 78067 | break; | |
| 19128 | |||
| 19129 | case down: | ||
| 19130 | 85319 | wy+=16; | |
| 19131 | 85319 | break; | |
| 19132 | |||
| 19133 | case left: | ||
| 19134 | 113642 | wx-=16; | |
| 19135 | 113642 | break; | |
| 19136 | |||
| 19137 | case right: | ||
| 19138 | 111379 | wx+=16; | |
| 19139 | 111379 | break; | |
| 19140 | } | ||
| 19141 | |||
| 19142 | 388407 | do_lens(); | |
| 19143 | |||
| 19144 | 388407 | bool no_jinx = true; | |
| 19145 |
6/8✓ Branch 0 taken 373805 times.
✓ Branch 1 taken 14602 times.
✓ Branch 2 taken 406 times.
✓ Branch 3 taken 373399 times.
✓ Branch 4 taken 406 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 406 times.
|
388407 | if(can_attack() && btnwpn>itype_sword && charging==0 && btnwpn!=itype_rupee) // This depends on item 0 being a rupee... |
| 19146 | { | ||
| 19147 | 406 | bool paidmagic = false; | |
| 19148 |
1/2✓ Branch 0 taken 406 times.
✗ Branch 1 not taken.
|
406 | bool liftonly = lift_wpn && (liftflags & LIFTFL_DIS_ITEMS); |
| 19149 |
6/10✓ Branch 0 taken 406 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 347 times.
✓ Branch 3 taken 59 times.
✓ Branch 4 taken 59 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 59 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 59 times.
|
406 | if(!liftonly && btnwpn==itype_wand && (directWpn>-1 ? (!item_disabled(directWpn) ? itemsbuf[directWpn].family==itype_wand : false) : current_item(itype_wand))) |
| 19150 | { | ||
| 19151 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | attackid=directWpn>-1 ? directWpn : current_item_id(itype_wand); |
| 19152 | 59 | no_jinx = checkitem_jinx(attackid); | |
| 19153 |
3/8✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 59 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 59 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
59 | if(no_jinx && checkbunny(attackid) && ((!(itemsbuf[attackid].flags & item_flag6)) || checkmagiccost(attackid))) |
| 19154 | { | ||
| 19155 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 59 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
59 | if((itemsbuf[attackid].flags & item_flag6) && !(misc_internal_hero_flags & LF_PAID_WAND_COST)){ |
| 19156 | ✗ | paymagiccost(attackid,true); | |
| 19157 | ✗ | misc_internal_hero_flags |= LF_PAID_WAND_COST; | |
| 19158 | ✗ | } | |
| 19159 | 59 | SetAttack(); | |
| 19160 | 59 | attack=wWand; | |
| 19161 | 59 | attackclk=0; | |
| 19162 | 59 | } | |
| 19163 | else | ||
| 19164 | { | ||
| 19165 | ✗ | item_error(); | |
| 19166 | } | ||
| 19167 | 59 | } | |
| 19168 |
2/8✓ Branch 0 taken 347 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 347 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
347 | else if(!liftonly && (btnwpn==itype_hammer)&&!((action==attacking||action==sideswimattacking) && attack==wHammer) |
| 19169 | ✗ | && (directWpn>-1 ? (!item_disabled(directWpn) ? itemsbuf[directWpn].family==itype_hammer : false) : current_item(itype_hammer))) | |
| 19170 | { | ||
| 19171 | ✗ | no_jinx = checkitem_jinx(dowpn); | |
| 19172 | ✗ | if(!(no_jinx && checkmagiccost(dowpn) && checkbunny(dowpn))) | |
| 19173 | { | ||
| 19174 | ✗ | item_error(); | |
| 19175 | ✗ | } | |
| 19176 | else | ||
| 19177 | { | ||
| 19178 | ✗ | paymagiccost(dowpn); | |
| 19179 | ✗ | paidmagic = true; | |
| 19180 | ✗ | SetAttack(); | |
| 19181 | ✗ | attack=wHammer; | |
| 19182 | ✗ | attackid=directWpn>-1 ? directWpn : current_item_id(itype_hammer); | |
| 19183 | ✗ | attackclk=0; | |
| 19184 | } | ||
| 19185 | ✗ | } | |
| 19186 |
5/8✓ Branch 0 taken 347 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 47 times.
✓ Branch 3 taken 300 times.
✓ Branch 4 taken 47 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 47 times.
|
394 | else if(!liftonly && (btnwpn==itype_candle)&&!((action==attacking||action==sideswimattacking) && attack==wFire) |
| 19187 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 47 times.
✓ Branch 2 taken 47 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 47 times.
|
47 | && (directWpn>-1 ? (!item_disabled(directWpn) ? itemsbuf[directWpn].family==itype_candle : false) : current_item(itype_candle))) |
| 19188 | { | ||
| 19189 | //checkbunny handled where magic cost is paid | ||
| 19190 |
1/2✓ Branch 0 taken 47 times.
✗ Branch 1 not taken.
|
47 | attackid=directWpn>-1 ? directWpn : current_item_id(itype_candle); |
| 19191 | 47 | no_jinx = checkitem_jinx(attackid); | |
| 19192 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 47 times.
|
47 | if(no_jinx) |
| 19193 | { | ||
| 19194 | 47 | SetAttack(); | |
| 19195 | 47 | attack=wFire; | |
| 19196 | 47 | attackclk=0; | |
| 19197 | 47 | } | |
| 19198 | 47 | } | |
| 19199 |
2/8✓ Branch 0 taken 300 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 300 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
300 | else if(!liftonly && (btnwpn==itype_cbyrna)&&!((action==attacking||action==sideswimattacking) && attack==wCByrna) |
| 19200 | ✗ | && (directWpn>-1 ? (!item_disabled(directWpn) ? itemsbuf[directWpn].family==itype_cbyrna : false) : current_item(itype_cbyrna))) | |
| 19201 | { | ||
| 19202 | ✗ | attackid=directWpn>-1 ? directWpn : current_item_id(itype_cbyrna); | |
| 19203 | ✗ | no_jinx = checkitem_jinx(attackid); | |
| 19204 | ✗ | if(no_jinx && checkbunny(attackid) && ((!(itemsbuf[attackid].flags & item_flag6)) || checkmagiccost(attackid))) | |
| 19205 | { | ||
| 19206 | ✗ | if((itemsbuf[attackid].flags & item_flag6) && !(misc_internal_hero_flags & LF_PAID_CBYRNA_COST)){ | |
| 19207 | ✗ | paymagiccost(attackid,true); | |
| 19208 | ✗ | misc_internal_hero_flags |= LF_PAID_CBYRNA_COST; | |
| 19209 | ✗ | } | |
| 19210 | ✗ | SetAttack(); | |
| 19211 | ✗ | attack=wCByrna; | |
| 19212 | ✗ | attackclk=0; | |
| 19213 | ✗ | } | |
| 19214 | else | ||
| 19215 | { | ||
| 19216 | ✗ | item_error(); | |
| 19217 | } | ||
| 19218 | ✗ | } | |
| 19219 |
5/8✓ Branch 0 taken 300 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 294 times.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 6 times.
|
306 | else if(!liftonly && (btnwpn==itype_bugnet)&&!((action==attacking||action==sideswimattacking) && attack==wBugNet) |
| 19220 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 6 times.
|
6 | && (directWpn>-1 ? (!item_disabled(directWpn) && itemsbuf[directWpn].family==itype_bugnet) : current_item(itype_bugnet))) |
| 19221 | { | ||
| 19222 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | attackid = directWpn>-1 ? directWpn : current_item_id(itype_bugnet); |
| 19223 | 6 | no_jinx = checkitem_jinx(attackid); | |
| 19224 |
3/6✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 6 times.
|
6 | if(no_jinx && checkbunny(attackid) && checkmagiccost(attackid)) |
| 19225 | { | ||
| 19226 | 6 | paymagiccost(attackid); | |
| 19227 | 6 | SetAttack(); | |
| 19228 | 6 | attack = wBugNet; | |
| 19229 | 6 | attackclk = 0; | |
| 19230 | 6 | sfx(itemsbuf[attackid].usesound); | |
| 19231 | 6 | } | |
| 19232 | else | ||
| 19233 | { | ||
| 19234 | ✗ | item_error(); | |
| 19235 | } | ||
| 19236 | 6 | } | |
| 19237 | else | ||
| 19238 | { | ||
| 19239 |
1/2✓ Branch 0 taken 294 times.
✗ Branch 1 not taken.
|
294 | auto itmid = directWpn>-1 ? directWpn : current_item_id(btnwpn); |
| 19240 | 294 | no_jinx = checkitem_jinx(itmid); | |
| 19241 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 294 times.
|
294 | if(no_jinx) |
| 19242 | { | ||
| 19243 | 294 | paidmagic = startwpn(itmid); | |
| 19244 | |||
| 19245 |
1/2✓ Branch 0 taken 294 times.
✗ Branch 1 not taken.
|
294 | if(paidmagic) |
| 19246 | { | ||
| 19247 |
5/10✓ Branch 0 taken 294 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 294 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 294 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 294 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 294 times.
|
294 | if(action==casting || action==drowning || action==lavadrowning || action == sideswimcasting || action==sidedrowning) |
| 19248 | { | ||
| 19249 | ; | ||
| 19250 | ✗ | } | |
| 19251 | else | ||
| 19252 | { | ||
| 19253 | 294 | SetAttack(); | |
| 19254 | 294 | attackclk=0; | |
| 19255 | 294 | attack=none; | |
| 19256 | |||
| 19257 |
2/2✓ Branch 0 taken 122 times.
✓ Branch 1 taken 172 times.
|
294 | if(btnwpn==itype_brang) |
| 19258 | { | ||
| 19259 | 122 | attack=wBrang; | |
| 19260 | 122 | } | |
| 19261 | } | ||
| 19262 | 294 | } | |
| 19263 | else | ||
| 19264 | { | ||
| 19265 | // Weapon not started: directWpn should be reset to prev. value. | ||
| 19266 | ✗ | directWpn = olddirectwpn; | |
| 19267 | } | ||
| 19268 | 294 | } | |
| 19269 | } | ||
| 19270 | |||
| 19271 |
3/12✓ Branch 0 taken 406 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 406 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 406 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
406 | if(dowpn>-1 && no_jinx && itemsbuf[dowpn].script!=0 && !did_scriptb && !(FFCore.doscript(ScriptType::Item, dowpn) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING))) |
| 19272 | { | ||
| 19273 | ✗ | if(!((paidmagic || checkmagiccost(dowpn)) && checkbunny(dowpn))) | |
| 19274 | { | ||
| 19275 | ✗ | item_error(); | |
| 19276 | ✗ | } | |
| 19277 | else | ||
| 19278 | { | ||
| 19279 | // Only charge for magic if item's magic cost wasn't already charged | ||
| 19280 | // for the item's main use. | ||
| 19281 | ✗ | if(!paidmagic && attack!=wWand) | |
| 19282 | ✗ | paymagiccost(dowpn); | |
| 19283 | //clear the item script stack for a new script | ||
| 19284 | ✗ | int i = dowpn; | |
| 19285 | ✗ | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 19286 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[i].script, i); | |
| 19287 | ✗ | did_scriptb=true; | |
| 19288 | } | ||
| 19289 | ✗ | } | |
| 19290 | |||
| 19291 |
6/12✓ Branch 0 taken 406 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 406 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 406 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 406 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 406 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 406 times.
|
406 | if(no_jinx && (action==casting || action==drowning || action==lavadrowning || action == sideswimcasting || action==sidedrowning)) |
| 19292 | { | ||
| 19293 | ✗ | return false; | |
| 19294 | } | ||
| 19295 |
1/2✓ Branch 0 taken 406 times.
✗ Branch 1 not taken.
|
406 | if(!no_jinx) |
| 19296 | ✗ | did_scriptb = false; | |
| 19297 | 406 | } | |
| 19298 | else | ||
| 19299 | { | ||
| 19300 | 388001 | did_scriptb=false; | |
| 19301 | } | ||
| 19302 | |||
| 19303 |
5/6✓ Branch 0 taken 354285 times.
✓ Branch 1 taken 34122 times.
✓ Branch 2 taken 351717 times.
✓ Branch 3 taken 2568 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 351717 times.
|
388407 | if(attackclk || action==attacking || action==sideswimattacking) |
| 19304 | { | ||
| 19305 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36690 times.
|
36690 | if(conv_forcedir > -1) dir = conv_forcedir; |
| 19306 |
4/8✓ Branch 0 taken 2568 times.
✓ Branch 1 taken 34122 times.
✓ Branch 2 taken 2568 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2568 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
36690 | else if((attackclk==0) && action!=sideswimattacking && getOnSideviewLadder() && (get_qr(qr_SIDEVIEWLADDER_FACEUP)!=0)) //Allow DIR to change if standing still on sideview ladder, and force-face up. |
| 19307 | { | ||
| 19308 | ✗ | if((xoff==0)||diagonalMovement) | |
| 19309 | { | ||
| 19310 | ✗ | if(DrunkUp()) dir=up; | |
| 19311 | ✗ | if(DrunkDown()) dir=down; | |
| 19312 | ✗ | } | |
| 19313 | |||
| 19314 | ✗ | if((yoff==0)||diagonalMovement) | |
| 19315 | { | ||
| 19316 | ✗ | if(DrunkLeft()) dir=left; | |
| 19317 | ✗ | if(DrunkRight()) dir=right; | |
| 19318 | ✗ | } | |
| 19319 | ✗ | } | |
| 19320 | |||
| 19321 | 36690 | bool attacked = doattack(); | |
| 19322 | |||
| 19323 | // This section below interferes with script-setting Hero->Dir, so it comes after doattack | ||
| 19324 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36690 times.
|
36690 | if(conv_forcedir > -1) dir = conv_forcedir; |
| 19325 |
8/12✓ Branch 0 taken 36690 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 26520 times.
✓ Branch 3 taken 10170 times.
✓ Branch 4 taken 4890 times.
✓ Branch 5 taken 21630 times.
✓ Branch 6 taken 4890 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 4890 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 4890 times.
|
36690 | else if(!inlikelike && attackclk>4 && (attackclk&3)==0 && charging==0 && spins==0 && action!=sideswimattacking) |
| 19326 | { | ||
| 19327 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 4890 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
4890 | if((xoff==0)||diagonalMovement) |
| 19328 | { | ||
| 19329 |
2/2✓ Branch 0 taken 4645 times.
✓ Branch 1 taken 245 times.
|
4890 | if(DrunkUp()) dir=up; |
| 19330 | |||
| 19331 |
2/2✓ Branch 0 taken 4379 times.
✓ Branch 1 taken 511 times.
|
4890 | if(DrunkDown()) dir=down; |
| 19332 | 4890 | } | |
| 19333 | |||
| 19334 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 4890 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
4890 | if((yoff==0)||diagonalMovement) |
| 19335 | { | ||
| 19336 |
2/2✓ Branch 0 taken 4397 times.
✓ Branch 1 taken 493 times.
|
4890 | if(DrunkLeft()) dir=left; |
| 19337 | |||
| 19338 |
2/2✓ Branch 0 taken 4339 times.
✓ Branch 1 taken 551 times.
|
4890 | if(DrunkRight()) dir=right; |
| 19339 | 4890 | } | |
| 19340 | 4890 | } | |
| 19341 | |||
| 19342 |
6/10✓ Branch 0 taken 34223 times.
✓ Branch 1 taken 2467 times.
✓ Branch 2 taken 34223 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 34223 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 34223 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 34223 times.
|
36690 | if(attacked && (charging==0 && spins<=5) && jumping<1 && action!=sideswimattacking) |
| 19343 | { | ||
| 19344 | 34223 | return false; | |
| 19345 | } | ||
| 19346 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2467 times.
|
2467 | else if(!attacked) |
| 19347 | { | ||
| 19348 | // Spin attack - change direction | ||
| 19349 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2467 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2467 | if(spins>1 && attack != wHammer) |
| 19350 | { | ||
| 19351 | ✗ | spins--; | |
| 19352 | |||
| 19353 | ✗ | if(spins%5==0) | |
| 19354 | { | ||
| 19355 | ✗ | int id = currentscroll > -1 ? currentscroll : (current_item_id(spins>5 ? itype_spinscroll2 : itype_spinscroll)); | |
| 19356 | ✗ | sfx(itemsbuf[id].usesound,pan(x.getInt())); | |
| 19357 | ✗ | } | |
| 19358 | ✗ | attackclk=1; | |
| 19359 | |||
| 19360 | ✗ | switch(dir) | |
| 19361 | { | ||
| 19362 | case up: | ||
| 19363 | ✗ | dir=left; | |
| 19364 | ✗ | break; | |
| 19365 | |||
| 19366 | case right: | ||
| 19367 | ✗ | dir=up; | |
| 19368 | ✗ | break; | |
| 19369 | |||
| 19370 | case down: | ||
| 19371 | ✗ | dir=right; | |
| 19372 | ✗ | break; | |
| 19373 | |||
| 19374 | case left: | ||
| 19375 | ✗ | dir=down; | |
| 19376 | ✗ | break; | |
| 19377 | } | ||
| 19378 | |||
| 19379 | ✗ | return false; | |
| 19380 | } | ||
| 19381 | else | ||
| 19382 | { | ||
| 19383 | 2467 | spins=0; | |
| 19384 | } | ||
| 19385 | |||
| 19386 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2467 times.
|
2467 | if (IsSideSwim()) {action=sideswimming; FFCore.setHeroAction(sideswimming);} |
| 19387 | 2467 | else {action=none; FFCore.setHeroAction(none);} | |
| 19388 | 2467 | attackclk=0; | |
| 19389 | 2467 | charging=0; | |
| 19390 | 2467 | } | |
| 19391 | 2467 | } | |
| 19392 | 354184 | return true; | |
| 19393 | 391624 | } | |
| 19394 | 446704 | void HeroClass::movehero() | |
| 19395 | { | ||
| 19396 | 446704 | bool earlyret = false; | |
| 19397 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 446704 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
446704 | bool nohorz = (isdungeon() && (y<=26 || y>=134) && !get_qr(qr_FREEFORM) && !toogam); |
| 19398 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 446704 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
446704 | bool novert = (isdungeon() && (x<=26 || x>=214) && !get_qr(qr_FREEFORM) && !toogam); |
| 19399 | 446704 | zfix dx, dy; | |
| 19400 | 446704 | auto push=pushing; | |
| 19401 | 446704 | pushing=0; | |
| 19402 | |||
| 19403 |
2/2✓ Branch 0 taken 92520 times.
✓ Branch 1 taken 354184 times.
|
446704 | if(!is_conveyor_stunned) //these do not apply to conveyor auto-walk |
| 19404 | { | ||
| 19405 |
2/2✓ Branch 0 taken 63 times.
✓ Branch 1 taken 354121 times.
|
354184 | if(pitslide()) //Check pit's 'pull'. If true, then Hero cannot fight the pull. |
| 19406 | 63 | return; | |
| 19407 | |||
| 19408 |
2/2✓ Branch 0 taken 113350 times.
✓ Branch 1 taken 240771 times.
|
354121 | if(action==walking) //still walking |
| 19409 | { | ||
| 19410 |
9/10✓ Branch 0 taken 176973 times.
✓ Branch 1 taken 63798 times.
✓ Branch 2 taken 111511 times.
✓ Branch 3 taken 65462 times.
✓ Branch 4 taken 58564 times.
✓ Branch 5 taken 52947 times.
✓ Branch 6 taken 3076 times.
✓ Branch 7 taken 55488 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 3076 times.
|
240771 | if(!DrunkUp() && !DrunkDown() && !DrunkLeft() && !DrunkRight() && !autostep) |
| 19411 | { | ||
| 19412 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3076 times.
|
3076 | if(attackclk>0) SetAttack(); |
| 19413 | 3076 | else {action = none; FFCore.setHeroAction(none);} | |
| 19414 | 3076 | hero_count=-1; | |
| 19415 | 3076 | earlyret = true; | |
| 19416 | 3076 | goto newmove_slide; | |
| 19417 | } | ||
| 19418 | |||
| 19419 | 237695 | autostep=false; | |
| 19420 | 237695 | } // endif (action==walking) | |
| 19421 | |||
| 19422 |
13/24✓ Branch 0 taken 344383 times.
✓ Branch 1 taken 6662 times.
✓ Branch 2 taken 344383 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 344383 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 344383 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 344383 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 344383 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 344383 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 344383 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 344383 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 344383 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 344383 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✓ Branch 23 taken 344383 times.
|
351045 | if((action!=swimming)&&(action!=sideswimming)&&(action !=sideswimhit)&&(action !=sideswimattacking)&&(action!=casting)&&(action!=sideswimcasting)&&(action!=drowning)&&(action!=sidedrowning)&&(action!=lavadrowning) && charging==0 && spins==0 && jumping<1) |
| 19423 | { | ||
| 19424 | 344383 | action=none; FFCore.setHeroAction(none); | |
| 19425 | 344383 | } | |
| 19426 | 351045 | } | |
| 19427 | |||
| 19428 |
2/2✓ Branch 0 taken 92520 times.
✓ Branch 1 taken 351045 times.
|
979650 | if(is_conveyor_stunned) |
| 19429 | { | ||
| 19430 | 92520 | dx = convey_forcex; | |
| 19431 | 92520 | dy = convey_forcey; | |
| 19432 | 92520 | convey_forcex = 0; | |
| 19433 | 92520 | convey_forcey = 0; | |
| 19434 |
1/2✓ Branch 0 taken 92520 times.
✗ Branch 1 not taken.
|
92520 | if(action != walking) |
| 19435 | { | ||
| 19436 | ✗ | action = walking; FFCore.setHeroAction(walking); | |
| 19437 | ✗ | } | |
| 19438 | 92520 | } | |
| 19439 |
1/2✓ Branch 0 taken 351045 times.
✗ Branch 1 not taken.
|
351045 | else if(diagonalMovement) |
| 19440 | { | ||
| 19441 |
5/5✓ Branch 0 taken 100590 times.
✓ Branch 1 taken 48175 times.
✓ Branch 2 taken 52157 times.
✓ Branch 3 taken 72009 times.
✓ Branch 4 taken 78114 times.
|
351045 | switch(holddir) |
| 19442 | { | ||
| 19443 | case up: | ||
| 19444 |
2/2✓ Branch 0 taken 46260 times.
✓ Branch 1 taken 1915 times.
|
48175 | if(!Up()) |
| 19445 | { | ||
| 19446 | 1915 | holddir=-1; | |
| 19447 | 1915 | } | |
| 19448 | |||
| 19449 | 48175 | break; | |
| 19450 | |||
| 19451 | case down: | ||
| 19452 |
2/2✓ Branch 0 taken 50196 times.
✓ Branch 1 taken 1961 times.
|
52157 | if(!Down()) |
| 19453 | { | ||
| 19454 | 1961 | holddir=-1; | |
| 19455 | 1961 | } | |
| 19456 | |||
| 19457 | 52157 | break; | |
| 19458 | |||
| 19459 | case left: | ||
| 19460 |
2/2✓ Branch 0 taken 69690 times.
✓ Branch 1 taken 2319 times.
|
72009 | if(!Left()) |
| 19461 | { | ||
| 19462 | 2319 | holddir=-1; | |
| 19463 | 2319 | } | |
| 19464 | |||
| 19465 | 72009 | break; | |
| 19466 | |||
| 19467 | case right: | ||
| 19468 |
2/2✓ Branch 0 taken 75770 times.
✓ Branch 1 taken 2344 times.
|
78114 | if(!Right()) |
| 19469 | { | ||
| 19470 | 2344 | holddir=-1; | |
| 19471 | 2344 | } | |
| 19472 | |||
| 19473 | 78114 | break; | |
| 19474 | |||
| 19475 | default: | ||
| 19476 | 100590 | break; | |
| 19477 | } //end switch | ||
| 19478 | |||
| 19479 |
6/6✓ Branch 0 taken 67280 times.
✓ Branch 1 taken 283765 times.
✓ Branch 2 taken 65360 times.
✓ Branch 3 taken 1920 times.
✓ Branch 4 taken 46260 times.
✓ Branch 5 taken 48180 times.
|
351045 | if(DrunkUp()&&(holddir==-1||holddir==up)&&!novert) |
| 19480 | { | ||
| 19481 |
4/10✓ Branch 0 taken 48180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 48180 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 48180 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 48180 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
48180 | if(charging==0 && spins==0 && action != sideswimattacking && !(IsSideSwim() && get_qr(qr_SIDESWIMDIR))) |
| 19482 | { | ||
| 19483 | 48180 | dir=up; | |
| 19484 | 48180 | } | |
| 19485 | 48180 | holddir=up; | |
| 19486 | |||
| 19487 |
5/6✓ Branch 0 taken 7837 times.
✓ Branch 1 taken 40343 times.
✓ Branch 2 taken 7829 times.
✓ Branch 3 taken 8 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 7829 times.
|
48180 | if(DrunkRight()&&shiftdir!=left&&!nohorz) |
| 19488 | { | ||
| 19489 | 7829 | shiftdir=right; | |
| 19490 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 7829 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
7829 | if (IsSideSwim() && get_qr(qr_SIDESWIMDIR) && (charging==0 && spins==0)) dir = right; |
| 19491 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 7829 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
7829 | if (!IsSideSwim() || (charging==0 && spins==0)) sideswimdir = right; |
| 19492 | 7829 | } | |
| 19493 |
5/6✓ Branch 0 taken 6059 times.
✓ Branch 1 taken 34292 times.
✓ Branch 2 taken 6052 times.
✓ Branch 3 taken 7 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 6052 times.
|
40351 | else if(DrunkLeft()&&shiftdir!=right&&!nohorz) |
| 19494 | { | ||
| 19495 | 6052 | shiftdir=left; | |
| 19496 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 6052 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
6052 | if (IsSideSwim() && get_qr(qr_SIDESWIMDIR) && (charging==0 && spins==0)) dir = left; |
| 19497 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 6052 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
6052 | if (!IsSideSwim() || (charging==0 && spins==0)) sideswimdir = left; |
| 19498 | 6052 | } | |
| 19499 | else | ||
| 19500 | { | ||
| 19501 | 34299 | shiftdir=-1; | |
| 19502 | } | ||
| 19503 | 48180 | } | |
| 19504 |
6/6✓ Branch 0 taken 68782 times.
✓ Branch 1 taken 326603 times.
✓ Branch 2 taken 66817 times.
✓ Branch 3 taken 1965 times.
✓ Branch 4 taken 16621 times.
✓ Branch 5 taken 52161 times.
|
395385 | else if(DrunkDown()&&(holddir==-1||holddir==down)&&!novert) |
| 19505 | { | ||
| 19506 |
4/10✓ Branch 0 taken 52161 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 52161 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 52161 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 52161 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
52161 | if(charging==0 && spins==0 && action != sideswimattacking && !(IsSideSwim() && get_qr(qr_SIDESWIMDIR))) |
| 19507 | { | ||
| 19508 | 52161 | dir=down; | |
| 19509 | 52161 | } | |
| 19510 | 52161 | holddir=down; | |
| 19511 | |||
| 19512 |
5/6✓ Branch 0 taken 6593 times.
✓ Branch 1 taken 45568 times.
✓ Branch 2 taken 6578 times.
✓ Branch 3 taken 15 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 6578 times.
|
52161 | if(DrunkRight()&&shiftdir!=left&&!nohorz) |
| 19513 | { | ||
| 19514 | 6578 | shiftdir=right; | |
| 19515 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 6578 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
6578 | if (IsSideSwim() && get_qr(qr_SIDESWIMDIR) && (charging==0 && spins==0)) dir = right; |
| 19516 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 6578 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
6578 | if (!IsSideSwim() || (charging==0 && spins==0)) sideswimdir = right; |
| 19517 | 6578 | } | |
| 19518 |
5/6✓ Branch 0 taken 8441 times.
✓ Branch 1 taken 37142 times.
✓ Branch 2 taken 8430 times.
✓ Branch 3 taken 11 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 8430 times.
|
45583 | else if(DrunkLeft()&&shiftdir!=right&&!nohorz) |
| 19519 | { | ||
| 19520 | 8430 | shiftdir=left; | |
| 19521 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 8430 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
8430 | if (IsSideSwim() && get_qr(qr_SIDESWIMDIR) && (charging==0 && spins==0)) dir = left; |
| 19522 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 8430 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
8430 | if (!IsSideSwim() || (charging==0 && spins==0)) sideswimdir = left; |
| 19523 | 8430 | } | |
| 19524 | else | ||
| 19525 | { | ||
| 19526 | 37153 | shiftdir=-1; | |
| 19527 | } | ||
| 19528 | 52161 | } | |
| 19529 |
6/6✓ Branch 0 taken 72151 times.
✓ Branch 1 taken 271073 times.
✓ Branch 2 taken 69829 times.
✓ Branch 3 taken 2322 times.
✓ Branch 4 taken 139 times.
✓ Branch 5 taken 72012 times.
|
343224 | else if(DrunkLeft()&&(holddir==-1||holddir==left)&&!nohorz) |
| 19530 | { | ||
| 19531 |
3/6✓ Branch 0 taken 72012 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 72012 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 72012 times.
|
72012 | if(charging==0 && spins==0 && action != sideswimattacking) |
| 19532 | { | ||
| 19533 | 72012 | dir=left; | |
| 19534 | 72012 | } | |
| 19535 | 72012 | sideswimdir = left; | |
| 19536 | 72012 | holddir=left; | |
| 19537 | |||
| 19538 |
4/6✓ Branch 0 taken 8343 times.
✓ Branch 1 taken 63669 times.
✓ Branch 2 taken 8343 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8343 times.
|
72012 | if(DrunkUp()&&shiftdir!=down&&!novert) |
| 19539 | { | ||
| 19540 | 8343 | shiftdir=up; | |
| 19541 | 8343 | } | |
| 19542 |
5/6✓ Branch 0 taken 7856 times.
✓ Branch 1 taken 55813 times.
✓ Branch 2 taken 7855 times.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 7855 times.
|
63669 | else if(DrunkDown()&&shiftdir!=up&&!novert) |
| 19543 | { | ||
| 19544 | 7855 | shiftdir=down; | |
| 19545 | 7855 | } | |
| 19546 | else | ||
| 19547 | { | ||
| 19548 | 55814 | shiftdir=-1; | |
| 19549 | } | ||
| 19550 | 72012 | } | |
| 19551 |
5/6✓ Branch 0 taken 78114 times.
✓ Branch 1 taken 193098 times.
✓ Branch 2 taken 75770 times.
✓ Branch 3 taken 2344 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 78114 times.
|
271212 | else if(DrunkRight()&&(holddir==-1||holddir==right)&&!nohorz) |
| 19552 | { | ||
| 19553 |
3/6✓ Branch 0 taken 78114 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 78114 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 78114 times.
|
78114 | if(charging==0 && spins==0 && action != sideswimattacking) |
| 19554 | { | ||
| 19555 | 78114 | dir=right; | |
| 19556 | 78114 | } | |
| 19557 | 78114 | sideswimdir = right; | |
| 19558 | 78114 | holddir=right; | |
| 19559 | |||
| 19560 |
4/6✓ Branch 0 taken 10757 times.
✓ Branch 1 taken 67357 times.
✓ Branch 2 taken 10757 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 10757 times.
|
78114 | if(DrunkUp()&&shiftdir!=down&&!novert) |
| 19561 | { | ||
| 19562 | 10757 | shiftdir=up; | |
| 19563 | 10757 | } | |
| 19564 |
5/6✓ Branch 0 taken 8763 times.
✓ Branch 1 taken 58594 times.
✓ Branch 2 taken 8761 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 8761 times.
|
67357 | else if(DrunkDown()&&shiftdir!=up&&!novert) |
| 19565 | { | ||
| 19566 | 8761 | shiftdir=down; | |
| 19567 | 8761 | } | |
| 19568 | else | ||
| 19569 | { | ||
| 19570 | 58596 | shiftdir=-1; | |
| 19571 | } | ||
| 19572 | 78114 | } | |
| 19573 | else | ||
| 19574 | { | ||
| 19575 | 193098 | int32_t wtry = iswaterex(MAPCOMBO(x,y+15), currmap, currscr, -1, x,y+15, true, false); | |
| 19576 | 193098 | int32_t wtry8 = iswaterex(MAPCOMBO(x+15,y+15), currmap, currscr, -1, x+15,y+15, true, false); | |
| 19577 | 193098 | int32_t wtrx = iswaterex(MAPCOMBO(x,y+(bigHitbox?0:8)), currmap, currscr, -1, x,y+(bigHitbox?0:8), true, false); | |
| 19578 | 193098 | int32_t wtrx8 = iswaterex(MAPCOMBO(x+15,y+(bigHitbox?0:8)), currmap, currscr, -1, x+15,y+(bigHitbox?0:8), true, false); | |
| 19579 | 193098 | int32_t wtrc = iswaterex(MAPCOMBO(x+8,y+(bigHitbox?8:12)), currmap, currscr, -1, x+8,y+(bigHitbox?8:12), true, false); | |
| 19580 | |||
| 19581 |
9/12✓ Branch 0 taken 28585 times.
✓ Branch 1 taken 164513 times.
✓ Branch 2 taken 28528 times.
✓ Branch 3 taken 57 times.
✓ Branch 4 taken 185 times.
✓ Branch 5 taken 28343 times.
✓ Branch 6 taken 28528 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 28528 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 28528 times.
✗ Branch 11 not taken.
|
193098 | if(can_use_item(itype_flippers,i_flippers)&¤t_item(itype_flippers) >= combobuf[wtrc].attribytes[0]&&(!(combobuf[wtrc].usrflags&cflag1) || (itemsbuf[current_item_id(itype_flippers)].flags & item_flag3))&&!(ladderx+laddery)&&z==0&&fakez==0) |
| 19582 | { | ||
| 19583 |
8/12✓ Branch 0 taken 579 times.
✓ Branch 1 taken 27949 times.
✓ Branch 2 taken 311 times.
✓ Branch 3 taken 268 times.
✓ Branch 4 taken 294 times.
✓ Branch 5 taken 17 times.
✓ Branch 6 taken 294 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 294 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
28528 | if(wtrx&&wtrx8&&wtry&&wtry8 && !DRIEDLAKE) |
| 19584 | { | ||
| 19585 | //action=swimming; | ||
| 19586 |
2/12✓ Branch 0 taken 294 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 294 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
294 | if(action !=none && action != swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking && !isSideViewHero()) |
| 19587 | { | ||
| 19588 | ✗ | hopclk = 0xFF; | |
| 19589 | ✗ | } | |
| 19590 | 294 | } | |
| 19591 | 28528 | } | |
| 19592 | 193098 | earlyret = true; | |
| 19593 | } | ||
| 19594 |
2/2✓ Branch 0 taken 193098 times.
✓ Branch 1 taken 250467 times.
|
443565 | if(earlyret) |
| 19595 | 193098 | dx = dy = 0; | |
| 19596 | 250467 | else get_move(holddir,dx,dy,dir); | |
| 19597 | 443565 | } | |
| 19598 | else //4-way | ||
| 19599 | { | ||
| 19600 | ✗ | shiftdir = -1; | |
| 19601 | ✗ | holddir = -1; | |
| 19602 | ✗ | if(!novert && DrunkUp()) | |
| 19603 | { | ||
| 19604 | ✗ | holddir = dir = up; | |
| 19605 | ✗ | } | |
| 19606 | ✗ | else if(!novert && DrunkDown()) | |
| 19607 | { | ||
| 19608 | ✗ | holddir = dir = down; | |
| 19609 | ✗ | } | |
| 19610 | ✗ | else if(!nohorz && DrunkLeft()) | |
| 19611 | { | ||
| 19612 | ✗ | holddir = dir = left; | |
| 19613 | ✗ | } | |
| 19614 | ✗ | else if(!nohorz && DrunkRight()) | |
| 19615 | { | ||
| 19616 | ✗ | holddir = dir = right; | |
| 19617 | ✗ | } | |
| 19618 | ✗ | get_move(holddir,dx,dy,dir); | |
| 19619 | } | ||
| 19620 | |||
| 19621 | newmove_slide: | ||
| 19622 |
1/2✓ Branch 0 taken 354121 times.
✗ Branch 1 not taken.
|
354121 | if(conv_forcedir > -1) |
| 19623 | ✗ | dir = conv_forcedir; | |
| 19624 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 354121 times.
|
354121 | if(!is_conveyor_stunned) |
| 19625 | { | ||
| 19626 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 354121 times.
|
354121 | bool is_inair = (z > 0 || fakez > 0); |
| 19627 | 354121 | auto ic = ice_combo; | |
| 19628 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 354121 times.
|
354121 | if(!is_inair) //maintain momentum when jumping |
| 19629 | { | ||
| 19630 | 354121 | const int sens = 2; | |
| 19631 | 354121 | auto ty = y+(bigHitbox?0:8); | |
| 19632 | 354121 | int xs[] = {x+7, x+sens, x+sens, x+15-sens, x+15-sens}; | |
| 19633 | 354121 | int ys[] = {y+(bigHitbox?8:12), ty+sens, y+15-sens, ty+sens, y+15-sens}; | |
| 19634 | 354121 | bool found = false; | |
| 19635 |
2/2✓ Branch 0 taken 354121 times.
✓ Branch 1 taken 1770605 times.
|
2124726 | for(int q = 0; q < 5; ++q) |
| 19636 | { | ||
| 19637 | 1770605 | auto ice = get_icy(xs[q], ys[q], ICY_PLAYER); | |
| 19638 |
1/2✓ Branch 0 taken 1770605 times.
✗ Branch 1 not taken.
|
1770605 | if(ice) |
| 19639 | { | ||
| 19640 | ✗ | ic = ice_combo = ice; | |
| 19641 | ✗ | found = true; | |
| 19642 | ✗ | break; | |
| 19643 | } | ||
| 19644 | 1770605 | } | |
| 19645 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 354121 times.
|
354121 | if(!found) |
| 19646 | 354121 | ic = ice_combo = 0; | |
| 19647 | 354121 | } | |
| 19648 |
1/2✓ Branch 0 taken 354121 times.
✗ Branch 1 not taken.
|
354121 | if(script_ice_combo) |
| 19649 | { | ||
| 19650 | ✗ | if((unsigned(script_ice_combo) < MAXCOMBOS) && check_icy(combobuf[script_ice_combo], ICY_PLAYER)) | |
| 19651 | ✗ | ic = script_ice_combo; | |
| 19652 | ✗ | else ic = 0; | |
| 19653 | ✗ | } | |
| 19654 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 354121 times.
|
354121 | if(ic) |
| 19655 | { | ||
| 19656 | ✗ | handle_slide(combobuf[ic], dx, dy); | |
| 19657 | ✗ | earlyret = false; | |
| 19658 | ✗ | } | |
| 19659 | 354121 | else clear_ice(); | |
| 19660 | 354121 | } | |
| 19661 | ✗ | else clear_ice(); | |
| 19662 |
2/2✓ Branch 0 taken 250467 times.
✓ Branch 1 taken 103654 times.
|
354121 | if(earlyret) |
| 19663 | 103654 | return; | |
| 19664 | |||
| 19665 |
2/2✓ Branch 0 taken 212598 times.
✓ Branch 1 taken 37869 times.
|
250467 | if(!new_engine_move(dx,dy)) |
| 19666 | 37869 | pushing = push+1; | |
| 19667 | 354184 | } | |
| 19668 | |||
| 19669 | 407077 | void HeroClass::get_move(int movedir, zfix& dx, zfix& dy, int32_t& facedir) | |
| 19670 | { | ||
| 19671 | 407077 | dx = 0; dy = 0; | |
| 19672 |
6/8✓ Branch 0 taken 250467 times.
✓ Branch 1 taken 156610 times.
✓ Branch 2 taken 250467 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 250467 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 156610 times.
✓ Branch 7 taken 407077 times.
|
407077 | if(inlikelike || lstunclock > 0 || is_conveyor_stunned || movedir < 0) |
| 19673 | 313220 | return; | |
| 19674 | |||
| 19675 | 407077 | zfix base_movepix(zfix(steprate) / 100); | |
| 19676 | 407077 | zfix movepix(base_movepix); | |
| 19677 | 407077 | zfix up_step(zfix(game->get_sideswim_up()) / 100); | |
| 19678 | 407077 | zfix left_step(zfix(game->get_sideswim_side()) / 100); | |
| 19679 | 407077 | zfix right_step(zfix(game->get_sideswim_side()) / 100); | |
| 19680 | 407077 | zfix down_step(zfix(game->get_sideswim_down()) / 100); | |
| 19681 | 407077 | std::vector<zfix*> steps; | |
| 19682 |
2/2✓ Branch 0 taken 250467 times.
✓ Branch 1 taken 156610 times.
|
407077 | steps.push_back(&movepix); |
| 19683 |
1/2✓ Branch 0 taken 250467 times.
✗ Branch 1 not taken.
|
250467 | steps.push_back(&up_step); |
| 19684 |
1/2✓ Branch 0 taken 250467 times.
✗ Branch 1 not taken.
|
250467 | steps.push_back(&left_step); |
| 19685 |
1/2✓ Branch 0 taken 250467 times.
✗ Branch 1 not taken.
|
250467 | steps.push_back(&right_step); |
| 19686 |
1/2✓ Branch 0 taken 250467 times.
✗ Branch 1 not taken.
|
250467 | steps.push_back(&down_step); |
| 19687 | |||
| 19688 |
1/2✓ Branch 0 taken 250467 times.
✗ Branch 1 not taken.
|
250467 | mod_steps(steps); |
| 19689 | |||
| 19690 |
2/4✓ Branch 0 taken 250467 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 250467 times.
✗ Branch 3 not taken.
|
250467 | up_step = -up_step; |
| 19691 |
2/4✓ Branch 0 taken 250467 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 250467 times.
✗ Branch 3 not taken.
|
250467 | left_step = -left_step; |
| 19692 | |||
| 19693 | |||
| 19694 |
1/2✓ Branch 0 taken 250467 times.
✗ Branch 1 not taken.
|
250467 | zfix step(movepix); |
| 19695 |
1/2✓ Branch 0 taken 250467 times.
✗ Branch 1 not taken.
|
250467 | zfix step_diag(movepix); |
| 19696 | |||
| 19697 | |||
| 19698 |
1/2✓ Branch 0 taken 250467 times.
✗ Branch 1 not taken.
|
250467 | if (diagonalMovement) |
| 19699 | { | ||
| 19700 |
6/6✓ Branch 0 taken 202287 times.
✓ Branch 1 taken 48180 times.
✓ Branch 2 taken 42009 times.
✓ Branch 3 taken 244296 times.
✓ Branch 4 taken 85859 times.
✓ Branch 5 taken 4330 times.
|
381493 | if (((movedir == up || movedir == down) && (shiftdir == left || shiftdir == right)) || |
| 19701 |
4/4✓ Branch 0 taken 149566 times.
✓ Branch 1 taken 94730 times.
✓ Branch 2 taken 36296 times.
✓ Branch 3 taken 185862 times.
|
244296 | (movedir == left || movedir == right) && (shiftdir == up || shiftdir == down)) |
| 19702 | { | ||
| 19703 |
4/6✓ Branch 0 taken 64605 times.
✓ Branch 1 taken 156610 times.
✓ Branch 2 taken 64605 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 64605 times.
✗ Branch 5 not taken.
|
221215 | step = STEP_DIAGONAL(step); |
| 19704 |
3/6✓ Branch 0 taken 64605 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 64605 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 64605 times.
✗ Branch 5 not taken.
|
64605 | up_step = STEP_DIAGONAL(up_step); |
| 19705 |
3/6✓ Branch 0 taken 64605 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 64605 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 64605 times.
✗ Branch 5 not taken.
|
64605 | left_step = STEP_DIAGONAL(left_step); |
| 19706 |
3/6✓ Branch 0 taken 64605 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 64605 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 64605 times.
✗ Branch 5 not taken.
|
64605 | right_step = STEP_DIAGONAL(right_step); |
| 19707 |
3/6✓ Branch 0 taken 64605 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 64605 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 64605 times.
✗ Branch 5 not taken.
|
64605 | down_step = STEP_DIAGONAL(down_step); |
| 19708 | 64605 | } | |
| 19709 |
4/5✓ Branch 0 taken 48180 times.
✓ Branch 1 taken 52161 times.
✓ Branch 2 taken 72012 times.
✓ Branch 3 taken 78114 times.
✗ Branch 4 not taken.
|
250467 | switch (movedir) |
| 19710 | { | ||
| 19711 | case up: | ||
| 19712 |
3/3✓ Branch 0 taken 6052 times.
✓ Branch 1 taken 7829 times.
✓ Branch 2 taken 34299 times.
|
48180 | switch (shiftdir) |
| 19713 | { | ||
| 19714 | case left: | ||
| 19715 |
4/10✓ Branch 0 taken 6052 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6052 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 6052 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 6052 times.
✗ Branch 9 not taken.
|
6052 | dx = IsSideSwim() ? left_step : -step; |
| 19716 | 6052 | break; | |
| 19717 | case right: | ||
| 19718 |
3/6✓ Branch 0 taken 7829 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 7829 times.
✓ Branch 4 taken 7829 times.
✗ Branch 5 not taken.
|
7829 | dx = IsSideSwim() ? right_step : step; |
| 19719 | 7829 | break; | |
| 19720 | } | ||
| 19721 |
2/4✓ Branch 0 taken 48180 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 48180 times.
|
48180 | if (IsSideSwim()) |
| 19722 | { | ||
| 19723 | ✗ | dy = up_step; | |
| 19724 | ✗ | } | |
| 19725 |
2/4✓ Branch 0 taken 48180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 48180 times.
✗ Branch 3 not taken.
|
48180 | else dy = -step; |
| 19726 | 48180 | break; | |
| 19727 | case down: | ||
| 19728 |
3/3✓ Branch 0 taken 8430 times.
✓ Branch 1 taken 6578 times.
✓ Branch 2 taken 37153 times.
|
52161 | switch (shiftdir) |
| 19729 | { | ||
| 19730 | case left: | ||
| 19731 |
2/4✓ Branch 0 taken 8430 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8430 times.
✗ Branch 3 not taken.
|
8430 | dx = -step; |
| 19732 |
2/6✓ Branch 0 taken 8430 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 8430 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
8430 | if (IsSideSwim()) dx = left_step; |
| 19733 | 8430 | break; | |
| 19734 | case right: | ||
| 19735 |
1/2✓ Branch 0 taken 6578 times.
✗ Branch 1 not taken.
|
6578 | dx = step; |
| 19736 |
2/6✓ Branch 0 taken 6578 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6578 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
6578 | if (IsSideSwim()) dx = right_step; |
| 19737 | 6578 | break; | |
| 19738 | } | ||
| 19739 |
3/6✓ Branch 0 taken 52161 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 52161 times.
✓ Branch 4 taken 52161 times.
✗ Branch 5 not taken.
|
52161 | dy = IsSideSwim() ? down_step : step; |
| 19740 | 52161 | break; | |
| 19741 | case left: | ||
| 19742 |
3/3✓ Branch 0 taken 8343 times.
✓ Branch 1 taken 7855 times.
✓ Branch 2 taken 55814 times.
|
72012 | switch (shiftdir) |
| 19743 | { | ||
| 19744 | case up: | ||
| 19745 |
2/4✓ Branch 0 taken 8343 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 8343 times.
|
8343 | if (IsSideSwim()) |
| 19746 | { | ||
| 19747 | ✗ | dy = up_step; | |
| 19748 | ✗ | } | |
| 19749 |
2/4✓ Branch 0 taken 8343 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8343 times.
✗ Branch 3 not taken.
|
8343 | else dy = -step; |
| 19750 | 8343 | break; | |
| 19751 | case down: | ||
| 19752 |
1/2✓ Branch 0 taken 7855 times.
✗ Branch 1 not taken.
|
7855 | dy = step; |
| 19753 |
2/6✓ Branch 0 taken 7855 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 7855 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
7855 | if (IsSideSwim()) dy = down_step; |
| 19754 | 7855 | break; | |
| 19755 | } | ||
| 19756 |
4/10✓ Branch 0 taken 72012 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 72012 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 72012 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 72012 times.
✗ Branch 9 not taken.
|
72012 | dx = IsSideSwim() ? left_step : -step; |
| 19757 | 72012 | break; | |
| 19758 | case right: | ||
| 19759 |
3/3✓ Branch 0 taken 10757 times.
✓ Branch 1 taken 8761 times.
✓ Branch 2 taken 58596 times.
|
78114 | switch (shiftdir) |
| 19760 | { | ||
| 19761 | case up: | ||
| 19762 |
4/8✓ Branch 0 taken 10757 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10757 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 10757 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 10757 times.
✗ Branch 7 not taken.
|
10757 | if (!IsSideSwim()) dy = -step; |
| 19763 |
2/4✓ Branch 0 taken 10757 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 10757 times.
|
10757 | if (IsSideSwim()) |
| 19764 | { | ||
| 19765 | ✗ | dy = up_step; | |
| 19766 | ✗ | } | |
| 19767 | 10757 | break; | |
| 19768 | case down: | ||
| 19769 |
1/2✓ Branch 0 taken 8761 times.
✗ Branch 1 not taken.
|
8761 | dy = step; |
| 19770 |
2/6✓ Branch 0 taken 8761 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 8761 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
8761 | if (IsSideSwim()) dy = down_step; |
| 19771 | 8761 | break; | |
| 19772 | } | ||
| 19773 |
3/6✓ Branch 0 taken 78114 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 78114 times.
✓ Branch 4 taken 78114 times.
✗ Branch 5 not taken.
|
78114 | dx = IsSideSwim() ? right_step : step; |
| 19774 | 78114 | break; | |
| 19775 | }; | ||
| 19776 | 250467 | } | |
| 19777 | else | ||
| 19778 | { | ||
| 19779 | ✗ | switch (movedir) | |
| 19780 | { | ||
| 19781 | case up: | ||
| 19782 | ✗ | dy = IsSideSwim() ? up_step : -step; | |
| 19783 | ✗ | break; | |
| 19784 | case down: | ||
| 19785 | ✗ | dy = IsSideSwim() ? down_step : step; | |
| 19786 | ✗ | break; | |
| 19787 | case left: | ||
| 19788 | ✗ | dx = IsSideSwim() ? left_step : -step; | |
| 19789 | ✗ | break; | |
| 19790 | case right: | ||
| 19791 | ✗ | dx = IsSideSwim() ? right_step : step; | |
| 19792 | ✗ | break; | |
| 19793 | }; | ||
| 19794 | } | ||
| 19795 | |||
| 19796 |
2/8✓ Branch 0 taken 250467 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 250467 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
250467 | if (isSideViewHero() && slopeid) |
| 19797 | { | ||
| 19798 | ✗ | dy += (dx*slopeid); | |
| 19799 | ✗ | } | |
| 19800 | |||
| 19801 |
6/18✗ Branch 0 not taken.
✓ Branch 1 taken 250467 times.
✓ Branch 2 taken 250467 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 250467 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 250467 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 250467 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 250467 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
250467 | if((charging==0 || attack==wHammer) && spins==0 && attackclk!=HAMMERCHARGEFRAME && action != sideswimattacking && !(IsSideSwim() && get_qr(qr_SIDESWIMDIR) && (movedir == up || movedir == down))) //!DIRECTION SET |
| 19802 | { | ||
| 19803 | 250467 | facedir = movedir; | |
| 19804 | 250467 | } | |
| 19805 | ✗ | else if (IsSideSwim() && get_qr(qr_SIDESWIMDIR) && (movedir == up || movedir == down) && (shiftdir == left || shiftdir == right) && (charging==0 && spins==0)) | |
| 19806 | { | ||
| 19807 | ✗ | facedir = shiftdir; | |
| 19808 | ✗ | } | |
| 19809 | 563687 | } | |
| 19810 | |||
| 19811 | 250467 | bool HeroClass::new_engine_move(zfix dx, zfix dy) //no collision check | |
| 19812 | { | ||
| 19813 |
3/4✓ Branch 0 taken 71452 times.
✓ Branch 1 taken 179015 times.
✓ Branch 2 taken 71452 times.
✗ Branch 3 not taken.
|
250467 | if(!dx && !dy) return true; |
| 19814 |
5/8✓ Branch 0 taken 244177 times.
✓ Branch 1 taken 6290 times.
✓ Branch 2 taken 244177 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 244177 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 244177 times.
|
250467 | if(action != swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking) |
| 19815 | { | ||
| 19816 | 244177 | herostep(); | |
| 19817 | |||
| 19818 | //ack... don't walk if in midair! -DD | ||
| 19819 |
5/14✓ Branch 0 taken 244177 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 244177 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 244177 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 244177 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 244177 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
|
244177 | if(charging==0 && spins==0 && z==0 && fakez==0 && !(isSideViewHero() && !on_sideview_solid_oldpos(this) && !getOnSideviewLadder())) |
| 19820 | { | ||
| 19821 | 244177 | action=walking; FFCore.setHeroAction(walking); | |
| 19822 | 244177 | } | |
| 19823 | |||
| 19824 |
2/2✓ Branch 0 taken 231372 times.
✓ Branch 1 taken 12805 times.
|
244177 | if(++hero_count > (16*hero_animation_speed)) |
| 19825 | 12805 | hero_count=0; | |
| 19826 | 244177 | } | |
| 19827 |
2/2✓ Branch 0 taken 3148 times.
✓ Branch 1 taken 3142 times.
|
6290 | else if(!(frame & 1)) |
| 19828 | { | ||
| 19829 | 3142 | herostep(); | |
| 19830 | 3142 | } | |
| 19831 | |||
| 19832 | 250467 | bool ret = true; | |
| 19833 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 250467 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
250467 | if(charging==0 || attack!=wHammer) |
| 19834 | { | ||
| 19835 | 250467 | ret = movexy(dx,dy,false,false,true); | |
| 19836 | 250467 | } | |
| 19837 | 250467 | return ret; | |
| 19838 | 250467 | } | |
| 19839 | |||
| 19840 | 7410762 | void HeroClass::moveOld(int32_t d2) | |
| 19841 | { | ||
| 19842 | static bool totalskip = false; | ||
| 19843 | |||
| 19844 |
3/6✓ Branch 0 taken 7410762 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7410762 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 7410762 times.
|
7410762 | if( inlikelike || lstunclock > 0 || is_conveyor_stunned) |
| 19845 | ✗ | return; | |
| 19846 | |||
| 19847 | 7410762 | int32_t dx=0,dy=0; | |
| 19848 | 7410762 | int32_t xstep=lsteps[x.getInt()&7]; | |
| 19849 | 7410762 | int32_t ystep=lsteps[y.getInt()&7]; | |
| 19850 | 7410762 | int32_t z3skip=0; | |
| 19851 | 7410762 | int32_t z3diagskip=0; | |
| 19852 |
5/6✓ Branch 0 taken 200742 times.
✓ Branch 1 taken 7210020 times.
✓ Branch 2 taken 200680 times.
✓ Branch 3 taken 62 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 62 times.
|
14620844 | bool slowcombo = (combo_class_buf[combobuf[MAPCOMBO(x+7,y+8)].type].slow_movement && ((z==0 && fakez == 0) || tmpscr->flags2&fAIRCOMBOS)) || |
| 19853 |
5/6✓ Branch 0 taken 149353 times.
✓ Branch 1 taken 7060729 times.
✓ Branch 2 taken 81755 times.
✓ Branch 3 taken 67598 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 81755 times.
|
7210082 | (isSideViewHero() && (on_sideview_solid_oldpos(this)||getOnSideviewLadder()) && combo_class_buf[combobuf[MAPCOMBO(x+7,y+8)].type].slow_movement); |
| 19854 |
2/2✓ Branch 0 taken 7384947 times.
✓ Branch 1 taken 25815 times.
|
7410762 | bool slowcharging = charging>0 && (itemsbuf[getWpnPressed(itype_sword)].flags & item_flag10); |
| 19855 | 7410762 | bool is_swimming = (action == swimming); | |
| 19856 | |||
| 19857 | //slow walk combo, or charging, moves at 2/3 speed | ||
| 19858 | if( | ||
| 19859 |
4/4✓ Branch 0 taken 7309928 times.
✓ Branch 1 taken 100834 times.
✓ Branch 2 taken 201043 times.
✓ Branch 3 taken 7108885 times.
|
7511596 | (!is_swimming && (slowcharging ^ slowcombo))|| |
| 19860 |
2/2✓ Branch 0 taken 100834 times.
✓ Branch 1 taken 7108885 times.
|
7209719 | (is_swimming && (zinit.hero_swim_speed>60)) |
| 19861 | ) | ||
| 19862 | { | ||
| 19863 | 301877 | totalskip = false; | |
| 19864 | |||
| 19865 |
2/2✓ Branch 0 taken 49244 times.
✓ Branch 1 taken 252633 times.
|
301877 | if(diagonalMovement) |
| 19866 | { | ||
| 19867 | 49244 | skipstep=(skipstep+1)%6; | |
| 19868 | |||
| 19869 |
2/2✓ Branch 0 taken 25024 times.
✓ Branch 1 taken 24220 times.
|
49244 | if(skipstep%2==0) z3skip=1; |
| 19870 | 25024 | else z3skip=0; | |
| 19871 | |||
| 19872 |
2/2✓ Branch 0 taken 33205 times.
✓ Branch 1 taken 16039 times.
|
49244 | if(skipstep%3==0) z3diagskip=1; |
| 19873 | 33205 | else z3diagskip=0; | |
| 19874 | 49244 | } | |
| 19875 | else | ||
| 19876 | { | ||
| 19877 |
2/2✓ Branch 0 taken 165339 times.
✓ Branch 1 taken 87294 times.
|
252633 | if(d2<left) |
| 19878 | { | ||
| 19879 |
2/2✓ Branch 0 taken 99954 times.
✓ Branch 1 taken 65385 times.
|
165339 | if(ystep>1) |
| 19880 | { | ||
| 19881 | 65385 | skipstep^=1; | |
| 19882 | 65385 | ystep=skipstep; | |
| 19883 | 65385 | } | |
| 19884 | 165339 | } | |
| 19885 | else | ||
| 19886 | { | ||
| 19887 |
2/2✓ Branch 0 taken 53050 times.
✓ Branch 1 taken 34244 times.
|
87294 | if(xstep>1) |
| 19888 | { | ||
| 19889 | 34244 | skipstep^=1; | |
| 19890 | 34244 | xstep=skipstep; | |
| 19891 | 34244 | } | |
| 19892 | } | ||
| 19893 | } | ||
| 19894 | 301877 | } | |
| 19895 | // else if(is_swimming || (slowcharging && slowcombo)) | ||
| 19896 | else if( | ||
| 19897 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 7108885 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
7108996 | (is_swimming && (zinit.hero_swim_speed<60))|| |
| 19898 |
2/2✓ Branch 0 taken 111 times.
✓ Branch 1 taken 7108774 times.
|
7108885 | (slowcharging && slowcombo) |
| 19899 | ) | ||
| 19900 | { | ||
| 19901 | //swimming, or charging on a slow combo, moves at 1/2 speed | ||
| 19902 | 111 | totalskip = !totalskip; | |
| 19903 | |||
| 19904 |
1/2✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
|
111 | if(diagonalMovement) |
| 19905 | { | ||
| 19906 | ✗ | skipstep=0; | |
| 19907 | ✗ | } | |
| 19908 | 111 | } | |
| 19909 | else | ||
| 19910 | { | ||
| 19911 | 7108774 | totalskip = false; | |
| 19912 | |||
| 19913 |
2/2✓ Branch 0 taken 5123814 times.
✓ Branch 1 taken 1984960 times.
|
7108774 | if(diagonalMovement) |
| 19914 | { | ||
| 19915 | 1984960 | skipstep=0; | |
| 19916 | 1984960 | } | |
| 19917 | } | ||
| 19918 | |||
| 19919 |
2/2✓ Branch 0 taken 56 times.
✓ Branch 1 taken 7410706 times.
|
7410762 | if(!totalskip) |
| 19920 | { | ||
| 19921 |
2/2✓ Branch 0 taken 2034204 times.
✓ Branch 1 taken 5376502 times.
|
7410706 | if(diagonalMovement) |
| 19922 | { | ||
| 19923 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 439712 times.
✓ Branch 2 taken 372274 times.
✓ Branch 3 taken 640047 times.
✓ Branch 4 taken 582171 times.
|
2034204 | switch(d2) |
| 19924 | { | ||
| 19925 | case up: | ||
| 19926 |
2/2✓ Branch 0 taken 45201 times.
✓ Branch 1 taken 394511 times.
|
439712 | if(shiftdir==left) |
| 19927 | { | ||
| 19928 |
2/2✓ Branch 0 taken 35875 times.
✓ Branch 1 taken 9326 times.
|
45201 | if(walkable) |
| 19929 | { | ||
| 19930 | 35875 | dy-=1-z3diagskip; | |
| 19931 | 35875 | dx-=1-z3diagskip; | |
| 19932 | 35875 | z3step=2; | |
| 19933 | 35875 | } | |
| 19934 | else | ||
| 19935 | { | ||
| 19936 | 9326 | dx-=1-z3diagskip; | |
| 19937 | 9326 | z3step=2; | |
| 19938 | } | ||
| 19939 | 45201 | } | |
| 19940 |
2/2✓ Branch 0 taken 54111 times.
✓ Branch 1 taken 340400 times.
|
394511 | else if(shiftdir==right) |
| 19941 | { | ||
| 19942 |
2/2✓ Branch 0 taken 43412 times.
✓ Branch 1 taken 10699 times.
|
54111 | if(walkable) |
| 19943 | { | ||
| 19944 | 43412 | dy-=1-z3diagskip; | |
| 19945 | 43412 | dx+=1-z3diagskip; | |
| 19946 | 43412 | z3step=2; | |
| 19947 | 43412 | } | |
| 19948 | else | ||
| 19949 | { | ||
| 19950 | 10699 | dx+=1-z3diagskip; | |
| 19951 | 10699 | z3step=2; | |
| 19952 | } | ||
| 19953 | 54111 | } | |
| 19954 | else | ||
| 19955 | { | ||
| 19956 |
2/2✓ Branch 0 taken 57988 times.
✓ Branch 1 taken 282412 times.
|
340400 | if(walkable) |
| 19957 | { | ||
| 19958 | 282412 | dy-=z3step-z3skip; | |
| 19959 | 282412 | z3step=(z3step%2)+1; | |
| 19960 | 282412 | } | |
| 19961 | } | ||
| 19962 | |||
| 19963 | 439712 | break; | |
| 19964 | |||
| 19965 | case down: | ||
| 19966 |
2/2✓ Branch 0 taken 50651 times.
✓ Branch 1 taken 321623 times.
|
372274 | if(shiftdir==left) |
| 19967 | { | ||
| 19968 |
2/2✓ Branch 0 taken 38388 times.
✓ Branch 1 taken 12263 times.
|
50651 | if(walkable) |
| 19969 | { | ||
| 19970 | 38388 | dy+=1-z3diagskip; | |
| 19971 | 38388 | dx-=1-z3diagskip; | |
| 19972 | 38388 | z3step=2; | |
| 19973 | 38388 | } | |
| 19974 | else | ||
| 19975 | { | ||
| 19976 | 12263 | dx-=1-z3diagskip; | |
| 19977 | 12263 | z3step=2; | |
| 19978 | } | ||
| 19979 | 50651 | } | |
| 19980 |
2/2✓ Branch 0 taken 51930 times.
✓ Branch 1 taken 269693 times.
|
321623 | else if(shiftdir==right) |
| 19981 | { | ||
| 19982 |
2/2✓ Branch 0 taken 39650 times.
✓ Branch 1 taken 12280 times.
|
51930 | if(walkable) |
| 19983 | { | ||
| 19984 | 39650 | dy+=1-z3diagskip; | |
| 19985 | 39650 | dx+=1-z3diagskip; | |
| 19986 | 39650 | z3step=2; | |
| 19987 | 39650 | } | |
| 19988 | else | ||
| 19989 | { | ||
| 19990 | 12280 | dx+=1-z3diagskip; | |
| 19991 | 12280 | z3step=2; | |
| 19992 | } | ||
| 19993 | 51930 | } | |
| 19994 | else | ||
| 19995 | { | ||
| 19996 |
2/2✓ Branch 0 taken 44791 times.
✓ Branch 1 taken 224902 times.
|
269693 | if(walkable) |
| 19997 | { | ||
| 19998 | 224902 | dy+=z3step-z3skip; | |
| 19999 | 224902 | z3step=(z3step%2)+1; | |
| 20000 | 224902 | } | |
| 20001 | } | ||
| 20002 | |||
| 20003 | 372274 | break; | |
| 20004 | |||
| 20005 | case right: | ||
| 20006 |
2/2✓ Branch 0 taken 570449 times.
✓ Branch 1 taken 69598 times.
|
640047 | if(shiftdir==up) |
| 20007 | { | ||
| 20008 |
2/2✓ Branch 0 taken 57862 times.
✓ Branch 1 taken 11736 times.
|
69598 | if(walkable) |
| 20009 | { | ||
| 20010 | 57862 | dy-=1-z3diagskip; | |
| 20011 | 57862 | dx+=1-z3diagskip; | |
| 20012 | 57862 | z3step=2; | |
| 20013 | 57862 | } | |
| 20014 | else | ||
| 20015 | { | ||
| 20016 | 11736 | dy-=1-z3diagskip; | |
| 20017 | 11736 | z3step=2; | |
| 20018 | } | ||
| 20019 | 69598 | } | |
| 20020 |
2/2✓ Branch 0 taken 54246 times.
✓ Branch 1 taken 516203 times.
|
570449 | else if(shiftdir==down) |
| 20021 | { | ||
| 20022 |
2/2✓ Branch 0 taken 44949 times.
✓ Branch 1 taken 9297 times.
|
54246 | if(walkable) |
| 20023 | { | ||
| 20024 | 44949 | dy+=1-z3diagskip; | |
| 20025 | 44949 | dx+=1-z3diagskip; | |
| 20026 | 44949 | z3step=2; | |
| 20027 | 44949 | } | |
| 20028 | else | ||
| 20029 | { | ||
| 20030 | 9297 | dy+=1-z3diagskip; | |
| 20031 | 9297 | z3step=2; | |
| 20032 | } | ||
| 20033 | 54246 | } | |
| 20034 | else | ||
| 20035 | { | ||
| 20036 |
2/2✓ Branch 0 taken 59862 times.
✓ Branch 1 taken 456341 times.
|
516203 | if(walkable) |
| 20037 | { | ||
| 20038 | 456341 | dx+=z3step-z3skip; | |
| 20039 | 456341 | z3step=(z3step%2)+1; | |
| 20040 | 456341 | } | |
| 20041 | } | ||
| 20042 | |||
| 20043 | 640047 | break; | |
| 20044 | |||
| 20045 | case left: | ||
| 20046 |
2/2✓ Branch 0 taken 516604 times.
✓ Branch 1 taken 65567 times.
|
582171 | if(shiftdir==up) |
| 20047 | { | ||
| 20048 |
2/2✓ Branch 0 taken 55591 times.
✓ Branch 1 taken 9976 times.
|
65567 | if(walkable) |
| 20049 | { | ||
| 20050 | 55591 | dy-=1-z3diagskip; | |
| 20051 | 55591 | dx-=1-z3diagskip; | |
| 20052 | 55591 | z3step=2; | |
| 20053 | 55591 | } | |
| 20054 | else | ||
| 20055 | { | ||
| 20056 | 9976 | dy-=1-z3diagskip; | |
| 20057 | 9976 | z3step=2; | |
| 20058 | } | ||
| 20059 | 65567 | } | |
| 20060 |
2/2✓ Branch 0 taken 50527 times.
✓ Branch 1 taken 466077 times.
|
516604 | else if(shiftdir==down) |
| 20061 | { | ||
| 20062 |
2/2✓ Branch 0 taken 42583 times.
✓ Branch 1 taken 7944 times.
|
50527 | if(walkable) |
| 20063 | { | ||
| 20064 | 42583 | dy+=1-z3diagskip; | |
| 20065 | 42583 | dx-=1-z3diagskip; | |
| 20066 | 42583 | z3step=2; | |
| 20067 | 42583 | } | |
| 20068 | else | ||
| 20069 | { | ||
| 20070 | 7944 | dy+=1-z3diagskip; | |
| 20071 | 7944 | z3step=2; | |
| 20072 | } | ||
| 20073 | 50527 | } | |
| 20074 | else | ||
| 20075 | { | ||
| 20076 |
2/2✓ Branch 0 taken 49315 times.
✓ Branch 1 taken 416762 times.
|
466077 | if(walkable) |
| 20077 | { | ||
| 20078 | 416762 | dx-=z3step-z3skip; | |
| 20079 | 416762 | z3step=(z3step%2)+1; | |
| 20080 | 416762 | } | |
| 20081 | } | ||
| 20082 | |||
| 20083 | 582171 | break; | |
| 20084 | } | ||
| 20085 | 2034204 | } | |
| 20086 | else | ||
| 20087 | { | ||
| 20088 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 1267887 times.
✓ Branch 2 taken 1035600 times.
✓ Branch 3 taken 1490381 times.
✓ Branch 4 taken 1582634 times.
|
5376502 | switch(d2) |
| 20089 | { | ||
| 20090 | case up: | ||
| 20091 |
7/14✓ Branch 0 taken 308 times.
✓ Branch 1 taken 1267579 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 308 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 308 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 308 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 308 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 308 times.
|
1267887 | if(!isSideViewHero() || (ladderx && laddery && ladderdir==up) || getOnSideviewLadder() || action == sideswimming || action == sideswimhit || action == sideswimattacking) dy-=ystep; |
| 20092 | |||
| 20093 | 1267887 | break; | |
| 20094 | |||
| 20095 | case down: | ||
| 20096 |
7/14✓ Branch 0 taken 54 times.
✓ Branch 1 taken 1035546 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 54 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 54 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 54 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 54 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 54 times.
|
1035600 | if(!isSideViewHero() || (ladderx && laddery && ladderdir==up) || getOnSideviewLadder() || action == sideswimming || action == sideswimhit || action == sideswimattacking) dy+=ystep; |
| 20097 | |||
| 20098 | 1035600 | break; | |
| 20099 | |||
| 20100 | case left: | ||
| 20101 | 1490381 | dx-=xstep; | |
| 20102 | 1490381 | break; | |
| 20103 | |||
| 20104 | case right: | ||
| 20105 | 1582634 | dx+=xstep; | |
| 20106 | 1582634 | break; | |
| 20107 | } | ||
| 20108 | } | ||
| 20109 | 7410706 | } | |
| 20110 | |||
| 20111 |
8/16✓ Branch 0 taken 25815 times.
✓ Branch 1 taken 7384947 times.
✓ Branch 2 taken 7384668 times.
✓ Branch 3 taken 26094 times.
✓ Branch 4 taken 7384467 times.
✓ Branch 5 taken 201 times.
✓ Branch 6 taken 7384467 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 7384467 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
7410762 | if((charging==0 || attack==wHammer) && spins==0 && attackclk!=HAMMERCHARGEFRAME && action != sideswimattacking && !(IsSideSwim() && get_qr(qr_SIDESWIMDIR) && (d2 == up || d2 == down))) //!DIRECTION SET |
| 20112 | { | ||
| 20113 | 7384467 | dir=d2; | |
| 20114 | 7384467 | } | |
| 20115 |
1/12✗ Branch 0 not taken.
✓ Branch 1 taken 26295 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
26295 | else if (IsSideSwim() && get_qr(qr_SIDESWIMDIR) && (d2 == up || d2 == down) && (shiftdir == left || shiftdir == right) && (charging==0 && spins==0)) |
| 20116 | { | ||
| 20117 | ✗ | dir = shiftdir; | |
| 20118 | ✗ | } | |
| 20119 | |||
| 20120 |
3/4✓ Branch 0 taken 7309928 times.
✓ Branch 1 taken 100834 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7309928 times.
|
7410762 | if(action != swimming && !IsSideSwim()) |
| 20121 | { | ||
| 20122 | 7309928 | herostep(); | |
| 20123 | |||
| 20124 | //ack... don't walk if in midair! -DD | ||
| 20125 |
12/14✓ Branch 0 taken 7284113 times.
✓ Branch 1 taken 25815 times.
✓ Branch 2 taken 7283834 times.
✓ Branch 3 taken 279 times.
✓ Branch 4 taken 7273969 times.
✓ Branch 5 taken 9865 times.
✓ Branch 6 taken 7273969 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 149353 times.
✓ Branch 9 taken 7124616 times.
✓ Branch 10 taken 81755 times.
✓ Branch 11 taken 67598 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 81755 times.
|
7309928 | if(charging==0 && spins==0 && z==0 && fakez==0 && !(isSideViewHero() && !on_sideview_solid_oldpos(this) && !getOnSideviewLadder())) |
| 20126 | { | ||
| 20127 | 7192214 | action=walking; FFCore.setHeroAction(walking); | |
| 20128 | 7192214 | } | |
| 20129 | |||
| 20130 |
2/2✓ Branch 0 taken 6918933 times.
✓ Branch 1 taken 390995 times.
|
7309928 | if(++hero_count > (16*hero_animation_speed)) |
| 20131 | 390995 | hero_count=0; | |
| 20132 | 7309928 | } | |
| 20133 |
2/2✓ Branch 0 taken 50397 times.
✓ Branch 1 taken 50437 times.
|
100834 | else if(!(frame & 1)) |
| 20134 | { | ||
| 20135 | 50437 | herostep(); | |
| 20136 | 50437 | } | |
| 20137 | |||
| 20138 |
3/4✓ Branch 0 taken 25815 times.
✓ Branch 1 taken 7384947 times.
✓ Branch 2 taken 25815 times.
✗ Branch 3 not taken.
|
7410762 | if(charging==0 || attack!=wHammer) |
| 20139 | { | ||
| 20140 | 7410762 | sprite::move((zfix)dx,(zfix)dy); | |
| 20141 | 7410762 | } | |
| 20142 | 7410762 | } | |
| 20143 | 7740227 | void HeroClass::moveOld2(int32_t d2, int32_t forceRate) | |
| 20144 | { | ||
| 20145 |
4/6✓ Branch 0 taken 7737628 times.
✓ Branch 1 taken 2599 times.
✓ Branch 2 taken 7737628 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 7737628 times.
|
7740227 | if( inlikelike || lstunclock > 0 || is_conveyor_stunned) |
| 20146 | 2599 | return; | |
| 20147 | |||
| 20148 |
3/4✓ Branch 0 taken 7410762 times.
✓ Branch 1 taken 326866 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7410762 times.
|
7737628 | if(!get_qr(qr_NEW_HERO_MOVEMENT) && !IsSideSwim()) |
| 20149 | { | ||
| 20150 | 7410762 | moveOld(d2); | |
| 20151 | 7410762 | return; | |
| 20152 | } | ||
| 20153 | |||
| 20154 |
4/8✓ Branch 0 taken 8657 times.
✓ Branch 1 taken 318209 times.
✓ Branch 2 taken 8657 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 8657 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
645075 | bool slowcombo = (combo_class_buf[combobuf[MAPCOMBO(x+7,y+8)].type].slow_movement && _effectflag(x+7,y+8,1, -1) && ((z==0 && fakez==0) || tmpscr->flags2&fAIRCOMBOS)) || |
| 20155 |
5/6✓ Branch 0 taken 2454 times.
✓ Branch 1 taken 315755 times.
✓ Branch 2 taken 1050 times.
✓ Branch 3 taken 1404 times.
✓ Branch 4 taken 2454 times.
✗ Branch 5 not taken.
|
318209 | (isSideViewHero() && (on_sideview_solid_oldpos(this)||getOnSideviewLadder()) && combo_class_buf[combobuf[MAPCOMBO(x+7,y+8)].type].slow_movement && _effectflag(x+7,y+8,1, -1)); |
| 20156 | //!DIMITODO: add QR for slow combos under hero | ||
| 20157 |
4/4✓ Branch 0 taken 318209 times.
✓ Branch 1 taken 8657 times.
✓ Branch 2 taken 8657 times.
✓ Branch 3 taken 17314 times.
|
344180 | if(slowcombo) for (int32_t i = 0; i <= 1; ++i) |
| 20158 | { | ||
| 20159 |
2/2✓ Branch 0 taken 584 times.
✓ Branch 1 taken 16730 times.
|
17314 | if(tmpscr2[i].valid!=0) |
| 20160 | { | ||
| 20161 |
2/2✓ Branch 0 taken 11904 times.
✓ Branch 1 taken 4826 times.
|
16730 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 20162 | { | ||
| 20163 |
2/4✓ Branch 0 taken 11904 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11904 times.
✗ Branch 3 not taken.
|
11904 | if (combobuf[MAPCOMBO2(i,x+7,y+8)].type == cBRIDGE && !_walkflag_layer(x+7,y+8,1, &(tmpscr2[i]))) |
| 20164 | { | ||
| 20165 | ✗ | slowcombo = false; | |
| 20166 | ✗ | break; | |
| 20167 | } | ||
| 20168 | 11904 | } | |
| 20169 | else | ||
| 20170 | { | ||
| 20171 |
2/4✓ Branch 0 taken 4826 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4826 times.
✗ Branch 3 not taken.
|
4826 | if (combobuf[MAPCOMBO2(i,x+7,y+8)].type == cBRIDGE && _effectflag_layer(x+7,y+8,1, &(tmpscr2[i]))) |
| 20172 | { | ||
| 20173 | ✗ | slowcombo = false; | |
| 20174 | ✗ | break; | |
| 20175 | } | ||
| 20176 | } | ||
| 20177 | 16730 | } | |
| 20178 | 25971 | } | |
| 20179 |
2/2✓ Branch 0 taken 324597 times.
✓ Branch 1 taken 2269 times.
|
326866 | bool slowcharging = charging>0 && (itemsbuf[getWpnPressed(itype_sword)].flags & item_flag10); |
| 20180 | 326866 | bool is_swimming = (action == swimming); | |
| 20181 | 326866 | bool fastSwim = (zinit.hero_swim_speed>60); | |
| 20182 | 326866 | zfix rate(steprate); | |
| 20183 | 326866 | int32_t shieldid = getCurrentActiveShield(); | |
| 20184 |
1/2✓ Branch 0 taken 326866 times.
✗ Branch 1 not taken.
|
326866 | if(shieldid > -1) |
| 20185 | { | ||
| 20186 | ✗ | itemdata const& shield = itemsbuf[shieldid]; | |
| 20187 | ✗ | if(shield.flags & item_flag10) //Change Speed flag | |
| 20188 | { | ||
| 20189 | ✗ | zfix perc = shield.misc7; | |
| 20190 | ✗ | perc /= 100; | |
| 20191 | ✗ | if(perc < 0) | |
| 20192 | ✗ | perc = (perc*-1)+1; | |
| 20193 | ✗ | rate = (rate * perc) + shield.misc8; | |
| 20194 | ✗ | } | |
| 20195 | ✗ | } | |
| 20196 | |||
| 20197 | 326866 | zfix dx, dy; | |
| 20198 | 326866 | zfix movepix(rate / 100); | |
| 20199 | 326866 | zfix step(movepix); | |
| 20200 | 326866 | zfix step_diag(movepix); | |
| 20201 | 326866 | zfix up_step(game->get_sideswim_up() / -100.0); | |
| 20202 | 326866 | zfix left_step(game->get_sideswim_side() / -100.0); | |
| 20203 | 326866 | zfix right_step(game->get_sideswim_side() / 100.0); | |
| 20204 | 326866 | zfix down_step(game->get_sideswim_down() / 100.0); | |
| 20205 | 326866 | bool checkladder = false; | |
| 20206 | |||
| 20207 |
2/2✓ Branch 0 taken 326664 times.
✓ Branch 1 taken 202 times.
|
326866 | if(hero_newstep > movepix) hero_newstep = movepix; |
| 20208 |
2/2✓ Branch 0 taken 326664 times.
✓ Branch 1 taken 202 times.
|
326866 | if(hero_newstep_diag > movepix) hero_newstep_diag = movepix; |
| 20209 | //2/3 speed | ||
| 20210 |
5/6✗ Branch 0 not taken.
✓ Branch 1 taken 326866 times.
✓ Branch 2 taken 316022 times.
✓ Branch 3 taken 316022 times.
✓ Branch 4 taken 326866 times.
✓ Branch 5 taken 316022 times.
|
326866 | if((is_swimming && fastSwim) || (!is_swimming && (slowcharging ^ slowcombo))) |
| 20211 | { | ||
| 20212 | 642888 | step = ((step / 3.0) * 2); | |
| 20213 | 642888 | step_diag = ((step_diag / 3.0) * 2); | |
| 20214 | 642888 | up_step = ((up_step / 3.0) * 2); | |
| 20215 | 642888 | left_step = ((left_step / 3.0) * 2); | |
| 20216 | 642888 | right_step = ((right_step / 3.0) * 2); | |
| 20217 | 642888 | down_step = ((down_step / 3.0) * 2); | |
| 20218 | 642888 | } | |
| 20219 | //1/2 speed | ||
| 20220 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 316022 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 31 times.
✓ Branch 5 taken 315991 times.
|
316022 | else if((is_swimming && !fastSwim) || (slowcharging && slowcombo)) |
| 20221 | { | ||
| 20222 | 31 | step /= 2; | |
| 20223 | 31 | step_diag /= 2; | |
| 20224 | 31 | up_step /= 2; | |
| 20225 | 31 | left_step /= 2; | |
| 20226 | 31 | right_step /= 2; | |
| 20227 | 31 | down_step /= 2; | |
| 20228 | 31 | } | |
| 20229 | //normal speed | ||
| 20230 | else | ||
| 20231 | { | ||
| 20232 | //no modification | ||
| 20233 | } | ||
| 20234 | |||
| 20235 |
1/2✓ Branch 0 taken 326866 times.
✗ Branch 1 not taken.
|
326866 | if(diagonalMovement) |
| 20236 | { | ||
| 20237 |
6/6✓ Branch 0 taken 256347 times.
✓ Branch 1 taken 70519 times.
✓ Branch 2 taken 270941 times.
✓ Branch 3 taken 14594 times.
✓ Branch 4 taken 121444 times.
✓ Branch 5 taken 220016 times.
|
495429 | if(((d2 == up || d2 == down) && (shiftdir == left || shiftdir == right)) || |
| 20238 |
4/4✓ Branch 0 taken 200612 times.
✓ Branch 1 taken 186018 times.
✓ Branch 2 taken 19027 times.
✓ Branch 3 taken 181585 times.
|
14594 | (d2 == left || d2 == right) && (shiftdir == up || shiftdir == down)) |
| 20239 | { | ||
| 20240 |
3/4✓ Branch 0 taken 69887 times.
✓ Branch 1 taken 104 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 69887 times.
|
510023 | if(hero_newstep > 0 && hero_newstep_diag > 0) |
| 20241 | { | ||
| 20242 | 69887 | step = STEP_DIAGONAL(step); | |
| 20243 | 69887 | step_diag = STEP_DIAGONAL(step_diag); | |
| 20244 | 69887 | up_step = STEP_DIAGONAL(up_step); | |
| 20245 | 69887 | left_step = STEP_DIAGONAL(left_step); | |
| 20246 | 69887 | right_step = STEP_DIAGONAL(right_step); | |
| 20247 | 69887 | down_step = STEP_DIAGONAL(down_step); | |
| 20248 | 69887 | } | |
| 20249 | 69991 | } | |
| 20250 |
2/2✓ Branch 0 taken 219462 times.
✓ Branch 1 taken 32114 times.
|
251576 | if(hero_newstep < step) step = hero_newstep; //handle collision |
| 20251 |
2/2✓ Branch 0 taken 240575 times.
✓ Branch 1 taken 11001 times.
|
251576 | if(hero_newstep_diag < step_diag) step_diag = hero_newstep_diag; //handle collision |
| 20252 |
5/5✓ Branch 0 taken 75290 times.
✓ Branch 1 taken 70519 times.
✓ Branch 2 taken 67636 times.
✓ Branch 3 taken 93262 times.
✓ Branch 4 taken 95449 times.
|
251576 | switch(d2) |
| 20253 | { | ||
| 20254 | case up: | ||
| 20255 |
3/3✓ Branch 0 taken 55523 times.
✓ Branch 1 taken 7280 times.
✓ Branch 2 taken 7716 times.
|
70519 | switch(shiftdir) |
| 20256 | { | ||
| 20257 | case left: | ||
| 20258 | 7280 | dx = -step_diag; | |
| 20259 |
1/2✓ Branch 0 taken 7280 times.
✗ Branch 1 not taken.
|
7280 | if (IsSideSwim()) dx = left_step; |
| 20260 | 7280 | break; | |
| 20261 | case right: | ||
| 20262 | 7716 | dx = step_diag; | |
| 20263 |
1/2✓ Branch 0 taken 7716 times.
✗ Branch 1 not taken.
|
7716 | if (IsSideSwim()) dx = right_step; |
| 20264 | 7716 | break; | |
| 20265 | } | ||
| 20266 |
2/2✓ Branch 0 taken 10537 times.
✓ Branch 1 taken 59982 times.
|
70519 | if(walkable) |
| 20267 | { | ||
| 20268 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 59982 times.
|
59982 | if (!IsSideSwim()) dy = -step; |
| 20269 |
1/2✓ Branch 0 taken 59982 times.
✗ Branch 1 not taken.
|
59982 | if (IsSideSwim()) |
| 20270 | { | ||
| 20271 | ✗ | dy = up_step; | |
| 20272 | ✗ | if (!iswaterex(MAPCOMBO(x,y+8-(bigHitbox*8)+floor(up_step)), currmap, currscr, -1, x, y+8-(bigHitbox*8)-2, true, false)) checkladder = true; | |
| 20273 | ✗ | } | |
| 20274 | 59982 | } | |
| 20275 | 70519 | break; | |
| 20276 | case down: | ||
| 20277 |
3/3✓ Branch 0 taken 49640 times.
✓ Branch 1 taken 9431 times.
✓ Branch 2 taken 8565 times.
|
67636 | switch(shiftdir) |
| 20278 | { | ||
| 20279 | case left: | ||
| 20280 | 9431 | dx = -step_diag; | |
| 20281 |
1/2✓ Branch 0 taken 9431 times.
✗ Branch 1 not taken.
|
9431 | if (IsSideSwim()) dx = left_step; |
| 20282 | 9431 | break; | |
| 20283 | case right: | ||
| 20284 | 8565 | dx = step_diag; | |
| 20285 |
1/2✓ Branch 0 taken 8565 times.
✗ Branch 1 not taken.
|
8565 | if (IsSideSwim()) dx = right_step; |
| 20286 | 8565 | break; | |
| 20287 | } | ||
| 20288 |
2/2✓ Branch 0 taken 8248 times.
✓ Branch 1 taken 59388 times.
|
67636 | if(walkable) |
| 20289 | { | ||
| 20290 | 59388 | dy = step; | |
| 20291 |
1/2✓ Branch 0 taken 59388 times.
✗ Branch 1 not taken.
|
59388 | if (IsSideSwim()) dy = down_step; |
| 20292 | 59388 | } | |
| 20293 | 67636 | break; | |
| 20294 | case left: | ||
| 20295 |
3/3✓ Branch 0 taken 74595 times.
✓ Branch 1 taken 10090 times.
✓ Branch 2 taken 8577 times.
|
93262 | switch(shiftdir) |
| 20296 | { | ||
| 20297 | case up: | ||
| 20298 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10090 times.
|
10090 | if (!IsSideSwim()) dy = -step_diag; |
| 20299 |
1/2✓ Branch 0 taken 10090 times.
✗ Branch 1 not taken.
|
10090 | if (IsSideSwim()) |
| 20300 | { | ||
| 20301 | ✗ | dy = up_step; | |
| 20302 | ✗ | if (!iswaterex(MAPCOMBO(x,y+8-(bigHitbox*8)+floor(up_step)), currmap, currscr, -1, x, y+8-(bigHitbox*8)-2, true, false)) checkladder = true; | |
| 20303 | ✗ | } | |
| 20304 | 10090 | break; | |
| 20305 | case down: | ||
| 20306 | 8577 | dy = step_diag; | |
| 20307 |
1/2✓ Branch 0 taken 8577 times.
✗ Branch 1 not taken.
|
8577 | if (IsSideSwim()) dy = down_step; |
| 20308 | 8577 | break; | |
| 20309 | } | ||
| 20310 |
2/2✓ Branch 0 taken 8997 times.
✓ Branch 1 taken 84265 times.
|
93262 | if(walkable) |
| 20311 | { | ||
| 20312 | 84265 | dx = -step; | |
| 20313 |
1/2✓ Branch 0 taken 84265 times.
✗ Branch 1 not taken.
|
84265 | if (IsSideSwim()) dx = left_step; |
| 20314 | 84265 | } | |
| 20315 | 93262 | break; | |
| 20316 | case right: | ||
| 20317 |
3/3✓ Branch 0 taken 77117 times.
✓ Branch 1 taken 10058 times.
✓ Branch 2 taken 8274 times.
|
95449 | switch(shiftdir) |
| 20318 | { | ||
| 20319 | case up: | ||
| 20320 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10058 times.
|
10058 | if (!IsSideSwim()) dy = -step_diag; |
| 20321 |
1/2✓ Branch 0 taken 10058 times.
✗ Branch 1 not taken.
|
10058 | if (IsSideSwim()) |
| 20322 | { | ||
| 20323 | ✗ | dy = up_step; | |
| 20324 | ✗ | if (!iswaterex(MAPCOMBO(x,y+8-(bigHitbox*8)+floor(up_step)), currmap, currscr, -1, x, y+8-(bigHitbox*8)-2, true, false)) checkladder = true; | |
| 20325 | ✗ | } | |
| 20326 | 10058 | break; | |
| 20327 | case down: | ||
| 20328 | 8274 | dy = step_diag; | |
| 20329 |
1/2✓ Branch 0 taken 8274 times.
✗ Branch 1 not taken.
|
8274 | if (IsSideSwim()) dy = down_step; |
| 20330 | 8274 | break; | |
| 20331 | } | ||
| 20332 |
2/2✓ Branch 0 taken 9618 times.
✓ Branch 1 taken 85831 times.
|
95449 | if(walkable) |
| 20333 | { | ||
| 20334 | 85831 | dx = step; | |
| 20335 |
1/2✓ Branch 0 taken 85831 times.
✗ Branch 1 not taken.
|
85831 | if (IsSideSwim()) dx = right_step; |
| 20336 | 85831 | } | |
| 20337 | 95449 | break; | |
| 20338 | }; | ||
| 20339 | 402156 | } | |
| 20340 | else | ||
| 20341 | { | ||
| 20342 | ✗ | if(hero_newstep < step) step = hero_newstep; //handle collision | |
| 20343 | ✗ | switch(d2) | |
| 20344 | { | ||
| 20345 | case up: | ||
| 20346 | ✗ | dy -= step; | |
| 20347 | ✗ | if (IsSideSwim()) dy = up_step; | |
| 20348 | ✗ | break; | |
| 20349 | case down: | ||
| 20350 | ✗ | dy += step; | |
| 20351 | ✗ | if (IsSideSwim()) dy = down_step; | |
| 20352 | ✗ | break; | |
| 20353 | case left: | ||
| 20354 | ✗ | dx -= step; | |
| 20355 | ✗ | if (IsSideSwim()) dx = left_step; | |
| 20356 | ✗ | break; | |
| 20357 | case right: | ||
| 20358 | ✗ | dx += step; | |
| 20359 | ✗ | if (IsSideSwim()) dx = right_step; | |
| 20360 | ✗ | break; | |
| 20361 | }; | ||
| 20362 | } | ||
| 20363 | 402156 | hero_newstep = movepix; | |
| 20364 | 402156 | hero_newstep_diag = movepix; | |
| 20365 | |||
| 20366 |
7/16✓ Branch 0 taken 2269 times.
✓ Branch 1 taken 399887 times.
✓ Branch 2 taken 324597 times.
✓ Branch 3 taken 77559 times.
✓ Branch 4 taken 324597 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 324597 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 324597 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
402156 | if((charging==0 || attack==wHammer) && spins==0 && attackclk!=HAMMERCHARGEFRAME && action != sideswimattacking && !(IsSideSwim() && get_qr(qr_SIDESWIMDIR) && (d2 == up || d2 == down))) //!DIRECTION SET |
| 20367 | { | ||
| 20368 | 324597 | dir=d2; | |
| 20369 | 324597 | } | |
| 20370 |
1/12✗ Branch 0 not taken.
✓ Branch 1 taken 77559 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
77559 | else if (IsSideSwim() && get_qr(qr_SIDESWIMDIR) && (d2 == up || d2 == down) && (shiftdir == left || shiftdir == right) && (charging==0 && spins==0)) |
| 20371 | { | ||
| 20372 | ✗ | dir = shiftdir; | |
| 20373 | ✗ | } | |
| 20374 |
2/2✓ Branch 0 taken 401899 times.
✓ Branch 1 taken 257 times.
|
402156 | if(forceRate > -1) |
| 20375 | { | ||
| 20376 | 257 | checkladder = false; | |
| 20377 |
2/3✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 245 times.
|
257 | switch(dir) |
| 20378 | { | ||
| 20379 | case right: | ||
| 20380 | case r_up: | ||
| 20381 | case r_down: | ||
| 20382 | 12 | dx = zfix(forceRate) / 100; | |
| 20383 | 12 | break; | |
| 20384 | case left: | ||
| 20385 | case l_up: | ||
| 20386 | case l_down: | ||
| 20387 | ✗ | dx = zfix(-forceRate) / 100; | |
| 20388 | ✗ | break; | |
| 20389 | default: | ||
| 20390 | 245 | dx = 0; | |
| 20391 | 245 | } | |
| 20392 |
3/3✓ Branch 0 taken 17 times.
✓ Branch 1 taken 228 times.
✓ Branch 2 taken 12 times.
|
257 | switch(dir) |
| 20393 | { | ||
| 20394 | case down: | ||
| 20395 | case r_down: | ||
| 20396 | case l_down: | ||
| 20397 | 17 | dy = zfix(forceRate) / 100; | |
| 20398 | 17 | break; | |
| 20399 | case up: | ||
| 20400 | case r_up: | ||
| 20401 | case l_up: | ||
| 20402 | 228 | dy = zfix(-forceRate) / 100; | |
| 20403 | 228 | break; | |
| 20404 | default: | ||
| 20405 | 12 | dy = 0; | |
| 20406 | 12 | } | |
| 20407 | 257 | } | |
| 20408 |
4/4✓ Branch 0 taken 2454 times.
✓ Branch 1 taken 399702 times.
✓ Branch 2 taken 1716 times.
✓ Branch 3 taken 738 times.
|
402156 | if (isSideViewHero() && slopeid) |
| 20409 | { | ||
| 20410 | 738 | dy += (dx * slopeid); | |
| 20411 | 738 | } | |
| 20412 |
4/4✓ Branch 0 taken 124036 times.
✓ Branch 1 taken 278120 times.
✓ Branch 2 taken 97900 times.
✓ Branch 3 taken 26136 times.
|
402156 | if(dx == 0 && dy == 0) return; |
| 20413 |
5/8✓ Branch 0 taken 300730 times.
✓ Branch 1 taken 75290 times.
✓ Branch 2 taken 300730 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 300730 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 300730 times.
|
376020 | if(action != swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking) |
| 20414 | { | ||
| 20415 | 300730 | herostep(); | |
| 20416 | |||
| 20417 | //ack... don't walk if in midair! -DD | ||
| 20418 |
11/14✓ Branch 0 taken 298727 times.
✓ Branch 1 taken 2003 times.
✓ Branch 2 taken 298727 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 296414 times.
✓ Branch 5 taken 2313 times.
✓ Branch 6 taken 296414 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2390 times.
✓ Branch 9 taken 294024 times.
✓ Branch 10 taken 1016 times.
✓ Branch 11 taken 1374 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 1016 times.
|
300730 | if(charging==0 && spins==0 && z==0 && fakez==0 && !(isSideViewHero() && !on_sideview_solid_oldpos(this) && !getOnSideviewLadder())) |
| 20419 | { | ||
| 20420 | 295398 | action=walking; FFCore.setHeroAction(walking); | |
| 20421 | 295398 | } | |
| 20422 | |||
| 20423 |
2/2✓ Branch 0 taken 284955 times.
✓ Branch 1 taken 15775 times.
|
300730 | if(++hero_count > (16*hero_animation_speed)) |
| 20424 | 15775 | hero_count=0; | |
| 20425 | 300730 | } | |
| 20426 |
1/2✓ Branch 0 taken 75290 times.
✗ Branch 1 not taken.
|
75290 | else if(!(frame & 1)) |
| 20427 | { | ||
| 20428 | ✗ | herostep(); | |
| 20429 | ✗ | } | |
| 20430 | |||
| 20431 |
4/4✓ Branch 0 taken 2003 times.
✓ Branch 1 taken 374017 times.
✓ Branch 2 taken 73287 times.
✓ Branch 3 taken 71284 times.
|
376020 | if(charging==0 || attack!=wHammer) |
| 20432 | { | ||
| 20433 | 447304 | sprite::move(dx, dy); | |
| 20434 | 447304 | WalkflagInfo info; | |
| 20435 | 447304 | info = walkflag(x,y+8-(bigHitbox*8)-4,2,up); | |
| 20436 | 447304 | execute(info); | |
| 20437 |
2/8✗ Branch 0 not taken.
✓ Branch 1 taken 300730 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 300730 times.
✗ Branch 7 not taken.
|
447304 | if (checkladder && !canSideviewLadderRemote(x, y-4) && !info.isUnwalkable() && (y + 8 - (bigHitbox * 8) - 4) > 0) |
| 20438 | { | ||
| 20439 | ✗ | if (game->get_sideswim_jump() != 0) | |
| 20440 | { | ||
| 20441 | ✗ | setFall(zfix(0-(FEATHERJUMP*(game->get_sideswim_jump()/10000.0)))); | |
| 20442 | ✗ | sfx(WAV_ZN1SPLASH,(int32_t)x); | |
| 20443 | ✗ | hopclk = 0; | |
| 20444 | ✗ | if (charging || spins) action = attacking; | |
| 20445 | ✗ | else action = none; | |
| 20446 | ✗ | } | |
| 20447 | else | ||
| 20448 | { | ||
| 20449 | ✗ | sprite::move(0_zf, zfix(-1*dy)); | |
| 20450 | } | ||
| 20451 | ✗ | } | |
| 20452 | 300730 | } | |
| 20453 | 7811511 | } | |
| 20454 | |||
| 20455 | 32217890 | HeroClass::WalkflagInfo HeroClass::walkflag(zfix fx,zfix fy,int32_t cnt,byte d2) | |
| 20456 | { | ||
| 20457 | 32217890 | return walkflag(fx.getInt(), fy.getInt(), cnt, d2); | |
| 20458 | } | ||
| 20459 | 32217890 | HeroClass::WalkflagInfo HeroClass::walkflag(int32_t wx,int32_t wy,int32_t cnt,byte d2) | |
| 20460 | { | ||
| 20461 | 32217890 | WalkflagInfo ret; | |
| 20462 | |||
| 20463 | 32217890 | wx = vbound(wx, -1, 256); | |
| 20464 | 32217890 | wy = vbound(wy, -1, 176); | |
| 20465 | |||
| 20466 |
8/8✓ Branch 0 taken 32127051 times.
✓ Branch 1 taken 90839 times.
✓ Branch 2 taken 32038520 times.
✓ Branch 3 taken 88531 times.
✓ Branch 4 taken 32038227 times.
✓ Branch 5 taken 293 times.
✓ Branch 6 taken 7766 times.
✓ Branch 7 taken 32030461 times.
|
32217890 | if (wx < 0 || wx > 255 || wy < 0 || wy > 175) |
| 20467 | { | ||
| 20468 | 187429 | ret.setUnwalkable(false); | |
| 20469 | 187429 | return ret; | |
| 20470 | } | ||
| 20471 | |||
| 20472 |
2/2✓ Branch 0 taken 44786 times.
✓ Branch 1 taken 31985675 times.
|
32030461 | if(toogam) |
| 20473 | { | ||
| 20474 | 44786 | ret.setUnwalkable(false); | |
| 20475 | 44786 | return ret; | |
| 20476 | } | ||
| 20477 | |||
| 20478 |
4/4✓ Branch 0 taken 547172 times.
✓ Branch 1 taken 31438503 times.
✓ Branch 2 taken 522138 times.
✓ Branch 3 taken 25034 times.
|
31985675 | if(blockpath && wy<(bigHitbox?80:88)) |
| 20479 | { | ||
| 20480 | 25034 | ret.setUnwalkable(true); | |
| 20481 | 25034 | return ret; | |
| 20482 | } | ||
| 20483 | |||
| 20484 |
4/4✓ Branch 0 taken 495981 times.
✓ Branch 1 taken 31464660 times.
✓ Branch 2 taken 311830 times.
✓ Branch 3 taken 184151 times.
|
31960641 | if(mblock2.active() && mblock2.hit(wx,wy,0,1,1,1)) |
| 20485 | { | ||
| 20486 | 184151 | ret.setUnwalkable(true); | |
| 20487 | 184151 | return ret; | |
| 20488 | } | ||
| 20489 | |||
| 20490 |
2/2✓ Branch 0 taken 1100 times.
✓ Branch 1 taken 31775390 times.
|
31776490 | if (collide_object(wx, wy,1, 1)) |
| 20491 | { | ||
| 20492 | 1100 | ret.setUnwalkable(true); | |
| 20493 | 1100 | return ret; | |
| 20494 | } | ||
| 20495 | |||
| 20496 |
18/22✓ Branch 0 taken 15315079 times.
✓ Branch 1 taken 16460311 times.
✓ Branch 2 taken 14863586 times.
✓ Branch 3 taken 451493 times.
✓ Branch 4 taken 14342564 times.
✓ Branch 5 taken 521022 times.
✓ Branch 6 taken 517624 times.
✓ Branch 7 taken 3398 times.
✓ Branch 8 taken 517624 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 517624 times.
✓ Branch 12 taken 2095 times.
✓ Branch 13 taken 1303 times.
✓ Branch 14 taken 281863 times.
✓ Branch 15 taken 239159 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 239159 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 239159 times.
✓ Branch 20 taken 31083 times.
✓ Branch 21 taken 31744307 times.
|
32087695 | if(isdungeon() && currscr<128 && wy<(bigHitbox?32:40) && (((diagonalMovement||NO_GRIDLOCK)?(x<=112||x>=128):x!=120) || _walkflag(120,24,2,SWITCHBLOCK_STATE)) |
| 20497 |
2/2✓ Branch 0 taken 30442 times.
✓ Branch 1 taken 208717 times.
|
521022 | && !get_qr(qr_FREEFORM)) |
| 20498 | { | ||
| 20499 | 31083 | ret.setUnwalkable(true); | |
| 20500 | 31083 | return ret; | |
| 20501 | } | ||
| 20502 | |||
| 20503 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 31744307 times.
✓ Branch 2 taken 31744307 times.
✗ Branch 3 not taken.
|
31744307 | bool wf = _walkflag(wx,wy,cnt,SWITCHBLOCK_STATE); |
| 20504 | |||
| 20505 |
6/6✓ Branch 0 taken 15283996 times.
✓ Branch 1 taken 16460311 times.
✓ Branch 2 taken 14832503 times.
✓ Branch 3 taken 451493 times.
✓ Branch 4 taken 6357215 times.
✓ Branch 5 taken 8475288 times.
|
31744307 | if(isdungeon() && currscr<128 && !get_qr(qr_FREEFORM)) |
| 20506 | { | ||
| 20507 |
3/6✓ Branch 0 taken 8475288 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8475288 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8475288 times.
|
8475288 | if((diagonalMovement||NO_GRIDLOCK)) |
| 20508 | { | ||
| 20509 | ✗ | if(wx>=112&&wx<120&&wy<40&&wy>=32) wf=true; | |
| 20510 | |||
| 20511 | ✗ | if(wx>=136&&wx<144&&wy<40&&wy>=32) wf=true; | |
| 20512 | ✗ | } | |
| 20513 | 8475288 | } | |
| 20514 | //All problems related to exiting water are probably here. -Z | ||
| 20515 |
3/4✓ Branch 0 taken 31066977 times.
✓ Branch 1 taken 677330 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 31066977 times.
|
31744307 | if(action==swimming || IsSideSwim()) |
| 20516 | { | ||
| 20517 |
2/2✓ Branch 0 taken 645181 times.
✓ Branch 1 taken 32149 times.
|
677330 | if(!wf) |
| 20518 | { | ||
| 20519 | 32149 | bool isthissolid = false; | |
| 20520 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 32149 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 32149 times.
✓ Branch 4 taken 5887 times.
✓ Branch 5 taken 26262 times.
|
38460 | if (_walkflag(x+7,y+(bigHitbox?6:11),1,SWITCHBLOCK_STATE) |
| 20521 |
4/6✓ Branch 0 taken 25838 times.
✓ Branch 1 taken 6311 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6311 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 6311 times.
|
32149 | || _walkflag(x+7,y+(bigHitbox?9:12),1,SWITCHBLOCK_STATE) |
| 20522 |
4/6✓ Branch 0 taken 22 times.
✓ Branch 1 taken 6289 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6289 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 6289 times.
|
6311 | || _walkflag(x+8,y+(bigHitbox?6:11),1,SWITCHBLOCK_STATE) |
| 20523 |
4/6✓ Branch 0 taken 402 times.
✓ Branch 1 taken 5887 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5887 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5887 times.
|
32551 | || _walkflag(x+8,y+(bigHitbox?9:12),1,SWITCHBLOCK_STATE)) isthissolid = true; |
| 20524 | //This checks if Hero is currently swimming in solid water (cause even if the QR "No Hopping" is enabled, he should still hop out of solid water) - Dimi | ||
| 20525 | |||
| 20526 | |||
| 20527 |
5/6✓ Branch 0 taken 7310 times.
✓ Branch 1 taken 24839 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7310 times.
✓ Branch 4 taken 14729 times.
✓ Branch 5 taken 46086 times.
|
56988 | if(landswim>= (get_qr(qr_DROWN) && isSwimming() ? 1 |
| 20528 |
2/2✓ Branch 0 taken 2107 times.
✓ Branch 1 taken 22732 times.
|
24839 | : (!diagonalMovement) ? 1 : (get_qr(qr_NO_HOPPING)?1:22))) |
| 20529 | { | ||
| 20530 | //Check for out of bounds for swimming | ||
| 20531 | 14729 | bool changehop = true; | |
| 20532 | |||
| 20533 |
5/6✓ Branch 0 taken 1828 times.
✓ Branch 1 taken 12901 times.
✓ Branch 2 taken 1828 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 12828 times.
✓ Branch 5 taken 11732 times.
|
14729 | if((diagonalMovement||NO_GRIDLOCK)) |
| 20534 | { | ||
| 20535 |
2/4✓ Branch 0 taken 73 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 73 times.
|
25729 | if(wx<0||wy<0) |
| 20536 | ✗ | changehop = false; | |
| 20537 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 73 times.
|
73 | else if(wx>248) |
| 20538 | ✗ | changehop = false; | |
| 20539 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 73 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
73 | else if(wx>240&&cnt==2) |
| 20540 | ✗ | changehop = false; | |
| 20541 |
2/2✓ Branch 0 taken 70 times.
✓ Branch 1 taken 3 times.
|
73 | else if(wy>168) |
| 20542 | 3 | changehop = false; | |
| 20543 | 73 | } | |
| 20544 |
3/4✓ Branch 0 taken 1901 times.
✓ Branch 1 taken 9904 times.
✓ Branch 2 taken 11805 times.
✗ Branch 3 not taken.
|
11805 | if ((get_qr(qr_NO_HOPPING) || CanSideSwim()) && !isthissolid) changehop = false; |
| 20545 | //This may be where the hang-up for exiting water exists. -Z | ||
| 20546 | // hop out of the water | ||
| 20547 |
2/2✓ Branch 0 taken 9907 times.
✓ Branch 1 taken 1898 times.
|
11805 | if(changehop) |
| 20548 | 1898 | ret.setHopClk(1); | |
| 20549 | 11805 | } | |
| 20550 | else | ||
| 20551 | { | ||
| 20552 |
6/6✓ Branch 0 taken 26109 times.
✓ Branch 1 taken 19977 times.
✓ Branch 2 taken 25289 times.
✓ Branch 3 taken 20797 times.
✓ Branch 4 taken 16813 times.
✓ Branch 5 taken 8476 times.
|
46086 | if((!(get_qr(qr_NO_HOPPING) || CanSideSwim()) || isthissolid) && (dir==d2 || shiftdir==d2)) |
| 20553 | { | ||
| 20554 | //int32_t vx=((int32_t)x+4)&0xFFF8; | ||
| 20555 | //int32_t vy=((int32_t)y+4)&0xFFF8; | ||
| 20556 |
2/2✓ Branch 0 taken 1936 times.
✓ Branch 1 taken 7515 times.
|
25289 | if(d2==left) |
| 20557 | { | ||
| 20558 |
4/4✓ Branch 0 taken 1660 times.
✓ Branch 1 taken 276 times.
✓ Branch 2 taken 1656 times.
✓ Branch 3 taken 280 times.
|
3596 | if(!iswaterex(MAPCOMBO(x-1,y+(bigHitbox?6:11)), currmap, currscr, -1, x-1,y+(bigHitbox?6:11)) && |
| 20559 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1658 times.
|
1660 | !iswaterex(MAPCOMBO(x-1,y+(bigHitbox?9:12)), currmap, currscr, -1, x-1,y+(bigHitbox?9:12)) && |
| 20560 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 1658 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1658 times.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 1656 times.
|
1658 | !_walkflag(x-1,y+(bigHitbox?6:11),1,SWITCHBLOCK_STATE) && |
| 20561 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 1656 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1656 times.
|
1656 | !_walkflag(x-1,y+(bigHitbox?9:12),1,SWITCHBLOCK_STATE)) |
| 20562 | { | ||
| 20563 | 1656 | ret.setHopDir(d2); | |
| 20564 | 1656 | ret.setIlswim(true); | |
| 20565 | 1656 | } | |
| 20566 | 280 | else ret.setIlswim(false); | |
| 20567 | 1936 | } | |
| 20568 |
2/2✓ Branch 0 taken 5751 times.
✓ Branch 1 taken 1764 times.
|
7515 | else if(d2==right) |
| 20569 | { | ||
| 20570 |
4/4✓ Branch 0 taken 1654 times.
✓ Branch 1 taken 4097 times.
✓ Branch 2 taken 1654 times.
✓ Branch 3 taken 4097 times.
|
7405 | if(!iswaterex(MAPCOMBO(x+16,y+(bigHitbox?6:11)), currmap, currscr, -1, x+16,y+(bigHitbox?6:11)) && |
| 20571 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1654 times.
|
1654 | !iswaterex(MAPCOMBO(x+16,y+(bigHitbox?9:12)), currmap, currscr, -1, x+16,y+(bigHitbox?9:12)) && |
| 20572 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 1654 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1654 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1654 times.
|
1654 | !_walkflag(x+16,y+(bigHitbox?6:11),1,SWITCHBLOCK_STATE) && |
| 20573 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 1654 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1654 times.
|
1654 | !_walkflag(x+16,y+(bigHitbox?9:12),1,SWITCHBLOCK_STATE)) |
| 20574 | { | ||
| 20575 | 1654 | ret.setHopDir(d2); | |
| 20576 | 1654 | ret.setIlswim(true); | |
| 20577 | 1654 | } | |
| 20578 | 4097 | else ret.setIlswim(false); | |
| 20579 | 5751 | } | |
| 20580 |
2/2✓ Branch 0 taken 1002 times.
✓ Branch 1 taken 762 times.
|
1764 | else if(d2==up) |
| 20581 | { | ||
| 20582 |
4/4✓ Branch 0 taken 541 times.
✓ Branch 1 taken 221 times.
✓ Branch 2 taken 539 times.
✓ Branch 3 taken 223 times.
|
1303 | if(!iswaterex(MAPCOMBO(x+7,y+(bigHitbox?0:8)-1), currmap, currscr, -1, x+7,y+(bigHitbox?0:8)-1) && |
| 20583 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 541 times.
|
541 | !iswaterex(MAPCOMBO(x+8,y+(bigHitbox?0:8)-1), currmap, currscr, -1, x+8,y+(bigHitbox?0:8)-1) && |
| 20584 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 541 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 541 times.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 539 times.
|
541 | !_walkflag(x+7,y+(bigHitbox?0:8)-1,1,SWITCHBLOCK_STATE) && |
| 20585 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 539 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 539 times.
|
539 | !_walkflag(x+8,y+(bigHitbox?0:8)-1,1,SWITCHBLOCK_STATE)) |
| 20586 | { | ||
| 20587 | 539 | ret.setHopDir(d2); | |
| 20588 | 539 | ret.setIlswim(true); | |
| 20589 | 539 | } | |
| 20590 | 223 | else ret.setIlswim(false); | |
| 20591 | 762 | } | |
| 20592 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1002 times.
|
1002 | else if(d2==down) |
| 20593 | { | ||
| 20594 |
4/4✓ Branch 0 taken 351 times.
✓ Branch 1 taken 651 times.
✓ Branch 2 taken 351 times.
✓ Branch 3 taken 651 times.
|
1353 | if(!iswaterex(MAPCOMBO(x+7,y+16), currmap, currscr, -1, x+7,y+16) && |
| 20595 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 351 times.
|
351 | !iswaterex(MAPCOMBO(x+8,y+16), currmap, currscr, -1, x+8,y+16) && |
| 20596 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 351 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 351 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 351 times.
|
351 | !_walkflag(x+7,y+16,1,SWITCHBLOCK_STATE) && |
| 20597 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 351 times.
✓ Branch 2 taken 351 times.
✗ Branch 3 not taken.
|
351 | !_walkflag(x+8,y+16,1,SWITCHBLOCK_STATE)) |
| 20598 | { | ||
| 20599 | 351 | ret.setHopDir(d2); | |
| 20600 | 351 | ret.setIlswim(true); | |
| 20601 | 351 | } | |
| 20602 | 651 | else ret.setIlswim(false); | |
| 20603 | 1002 | } | |
| 20604 | 9451 | } | |
| 20605 | |||
| 20606 |
2/4✓ Branch 0 taken 30248 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 30248 times.
|
30248 | if(wx<0||wy<0); |
| 20607 |
2/2✓ Branch 0 taken 4422 times.
✓ Branch 1 taken 25826 times.
|
30248 | else if(wx>248); |
| 20608 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 25826 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
25826 | else if(wx>240&&cnt==2); |
| 20609 |
2/2✓ Branch 0 taken 774 times.
✓ Branch 1 taken 25052 times.
|
25826 | else if(wy>168); |
| 20610 |
4/4✓ Branch 0 taken 6428 times.
✓ Branch 1 taken 18624 times.
✓ Branch 2 taken 29 times.
✓ Branch 3 taken 6399 times.
|
25052 | else if(get_qr(qr_DROWN) && !ilswim); |
| 20611 | //if(iswaterex(MAPCOMBO(wx,wy)) && iswaterex(MAPCOMBO(wx,wy))) | ||
| 20612 |
2/2✓ Branch 0 taken 17095 times.
✓ Branch 1 taken 1558 times.
|
18653 | else if(iswaterex(MAPCOMBO(wx,wy), currmap, currscr, -1, wx,wy)) //!DIMI: weird duplicate function here before. Was water bugged this whole time, or was it just an unneccessary duplicate? |
| 20613 | { | ||
| 20614 | 1558 | ret.setUnwalkable(false); | |
| 20615 | 1558 | return ret; | |
| 20616 | } | ||
| 20617 | else | ||
| 20618 | { | ||
| 20619 | 17095 | ret.setUnwalkable(true); | |
| 20620 | 17095 | return ret; | |
| 20621 | } | ||
| 20622 | } | ||
| 20623 | 23400 | } | |
| 20624 | else | ||
| 20625 | { | ||
| 20626 | 645181 | int32_t wtrx = iswaterex(MAPCOMBO(wx,wy), currmap, currscr, -1, wx,wy); | |
| 20627 | 645181 | int32_t wtrx8 = iswaterex(MAPCOMBO(x+8,wy), currmap, currscr, -1, x+8,wy); //!DIMI: Is x + 8 intentional??? | |
| 20628 | |||
| 20629 |
8/8✓ Branch 0 taken 595014 times.
✓ Branch 1 taken 50167 times.
✓ Branch 2 taken 537287 times.
✓ Branch 3 taken 57727 times.
✓ Branch 4 taken 50167 times.
✓ Branch 5 taken 57727 times.
✓ Branch 6 taken 39371 times.
✓ Branch 7 taken 10796 times.
|
645181 | if((d2>=left && wtrx) || (d2<=down && wtrx && wtrx8)) |
| 20630 | { | ||
| 20631 | 576658 | ret.setUnwalkable(false); | |
| 20632 | 576658 | return ret; | |
| 20633 | } | ||
| 20634 | } | ||
| 20635 | 91923 | } | |
| 20636 |
2/2✓ Branch 0 taken 384504 times.
✓ Branch 1 taken 30682473 times.
|
31066977 | else if(ladderx+laddery) // ladder is being used |
| 20637 | { | ||
| 20638 |
8/10✓ Branch 0 taken 27069 times.
✓ Branch 1 taken 357435 times.
✓ Branch 2 taken 25080 times.
✓ Branch 3 taken 1989 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1989 times.
✓ Branch 6 taken 1989 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1936 times.
✓ Branch 9 taken 53 times.
|
384504 | int32_t lx = !(get_qr(qr_DROWN)&&iswaterex(MAPCOMBO(x+4,y+11), currmap, currscr, -1, x+4,y+11)&&!_walkflag(x+4,y+11,1,SWITCHBLOCK_STATE)) ? zfix(wx) : x; |
| 20639 |
8/10✓ Branch 0 taken 27069 times.
✓ Branch 1 taken 357435 times.
✓ Branch 2 taken 25080 times.
✓ Branch 3 taken 1989 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1989 times.
✓ Branch 6 taken 1989 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1936 times.
✓ Branch 9 taken 53 times.
|
384504 | int32_t ly = !(get_qr(qr_DROWN)&&iswaterex(MAPCOMBO(x+4,y+11), currmap, currscr, -1, x+4,y+11)&&!_walkflag(x+4,y+11,1,SWITCHBLOCK_STATE)) ? zfix(wy) : y; |
| 20640 | |||
| 20641 |
4/6✓ Branch 0 taken 363296 times.
✓ Branch 1 taken 21208 times.
✓ Branch 2 taken 363296 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 363296 times.
|
384504 | if((diagonalMovement||NO_GRIDLOCK)) |
| 20642 | { | ||
| 20643 |
2/2✓ Branch 0 taken 13575 times.
✓ Branch 1 taken 7633 times.
|
21208 | if(ladderdir==up) |
| 20644 | { | ||
| 20645 |
2/2✓ Branch 0 taken 3363 times.
✓ Branch 1 taken 4270 times.
|
7633 | if(abs(ly-(laddery+8))<=8) // ly is between laddery (laddery+8-8) and laddery+16 (laddery+8+8) |
| 20646 | { | ||
| 20647 | 4270 | bool temp = false; | |
| 20648 | |||
| 20649 |
2/2✓ Branch 0 taken 1391 times.
✓ Branch 1 taken 2879 times.
|
4270 | if(!(abs(lx-(ladderx+8))<=8)) |
| 20650 | 2879 | temp = true; | |
| 20651 | |||
| 20652 |
2/2✓ Branch 0 taken 3290 times.
✓ Branch 1 taken 980 times.
|
4270 | if(cnt==2) |
| 20653 |
1/2✓ Branch 0 taken 980 times.
✗ Branch 1 not taken.
|
980 | if(!(abs((lx+8)-(ladderx+8))<=8)) |
| 20654 | ✗ | temp=true; | |
| 20655 | |||
| 20656 |
2/2✓ Branch 0 taken 2879 times.
✓ Branch 1 taken 1391 times.
|
4270 | if(!temp) |
| 20657 | { | ||
| 20658 | 1391 | ret.setUnwalkable(false); | |
| 20659 | 1391 | return ret; | |
| 20660 | } | ||
| 20661 | |||
| 20662 |
5/6✓ Branch 0 taken 2879 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2125 times.
✓ Branch 3 taken 754 times.
✓ Branch 4 taken 122 times.
✓ Branch 5 taken 2757 times.
|
2879 | if(current_item_power(itype_ladder)<2 && (d2==left || d2==right) && !isSideViewHero()) |
| 20663 | { | ||
| 20664 | 2757 | ret.setUnwalkable(true); | |
| 20665 | 2757 | return ret; | |
| 20666 | } | ||
| 20667 | 122 | } | |
| 20668 | 3485 | } | |
| 20669 | else | ||
| 20670 | { | ||
| 20671 |
2/2✓ Branch 0 taken 7020 times.
✓ Branch 1 taken 6555 times.
|
13575 | if(abs(lx-(ladderx+8))<=8) |
| 20672 | { | ||
| 20673 |
2/2✓ Branch 0 taken 4323 times.
✓ Branch 1 taken 2232 times.
|
6555 | if(abs(ly-(laddery+(bigHitbox?8:12)))<=(bigHitbox?8:4)) |
| 20674 | { | ||
| 20675 | 4323 | ret.setUnwalkable(false); | |
| 20676 | 4323 | return ret; | |
| 20677 | } | ||
| 20678 | |||
| 20679 |
6/6✓ Branch 0 taken 2220 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 1785 times.
✓ Branch 3 taken 435 times.
✓ Branch 4 taken 916 times.
✓ Branch 5 taken 869 times.
|
2232 | if(current_item_power(itype_ladder)<2 && (d2==up || d2==down)) |
| 20680 | { | ||
| 20681 | 1351 | ret.setUnwalkable(true); | |
| 20682 | 1351 | return ret; | |
| 20683 | } | ||
| 20684 | |||
| 20685 |
3/4✓ Branch 0 taken 40 times.
✓ Branch 1 taken 841 times.
✓ Branch 2 taken 40 times.
✗ Branch 3 not taken.
|
881 | if((abs(ly-laddery+8)<=8) && d2<=down) |
| 20686 | { | ||
| 20687 | ✗ | ret.setUnwalkable(false); | |
| 20688 | ✗ | return ret; | |
| 20689 | } | ||
| 20690 | 881 | } | |
| 20691 | } | ||
| 20692 | 11386 | } // diagonalMovement | |
| 20693 | else | ||
| 20694 | { | ||
| 20695 |
2/2✓ Branch 0 taken 222358 times.
✓ Branch 1 taken 140938 times.
|
363296 | if((d2&2)==ladderdir) // same direction |
| 20696 | { | ||
| 20697 |
3/3✓ Branch 0 taken 13729 times.
✓ Branch 1 taken 196539 times.
✓ Branch 2 taken 12090 times.
|
222358 | switch(d2) |
| 20698 | { | ||
| 20699 | case up: | ||
| 20700 |
2/2✓ Branch 0 taken 8605 times.
✓ Branch 1 taken 3485 times.
|
12090 | if(y.getInt()<=laddery) |
| 20701 | { | ||
| 20702 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 8605 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 8605 times.
✓ Branch 4 taken 970 times.
✓ Branch 5 taken 7635 times.
|
16240 | ret.setUnwalkable(_walkflag(ladderx,laddery-8,1,SWITCHBLOCK_STATE) || |
| 20703 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 7635 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7635 times.
|
7635 | _walkflag(ladderx+8,laddery-8,1,SWITCHBLOCK_STATE)); |
| 20704 | 8605 | return ret; | |
| 20705 | |||
| 20706 | } | ||
| 20707 | |||
| 20708 | [[fallthrough]]; | ||
| 20709 | case down: | ||
| 20710 |
2/2✓ Branch 0 taken 9176 times.
✓ Branch 1 taken 8038 times.
|
17214 | if((wy&0xF0)==laddery) |
| 20711 | { | ||
| 20712 | 9176 | ret.setUnwalkable(false); | |
| 20713 | 9176 | return ret; | |
| 20714 | } | ||
| 20715 | |||
| 20716 | 8038 | break; | |
| 20717 | |||
| 20718 | default: | ||
| 20719 |
2/2✓ Branch 0 taken 74354 times.
✓ Branch 1 taken 122185 times.
|
196539 | if((wx&0xF0)==ladderx) |
| 20720 | { | ||
| 20721 | 74354 | ret.setUnwalkable(false); | |
| 20722 | 74354 | return ret; | |
| 20723 | } | ||
| 20724 | 122185 | } | |
| 20725 | |||
| 20726 |
2/2✓ Branch 0 taken 8038 times.
✓ Branch 1 taken 122185 times.
|
130223 | if(d2<=down) |
| 20727 | { | ||
| 20728 |
6/10✗ Branch 0 not taken.
✓ Branch 1 taken 8038 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 8038 times.
✓ Branch 4 taken 1060 times.
✓ Branch 5 taken 6978 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 6978 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 6978 times.
|
8038 | ret.setUnwalkable(_walkflag(ladderx,wy,1,SWITCHBLOCK_STATE) || _walkflag(ladderx+8,wy,1,SWITCHBLOCK_STATE)); |
| 20729 | 8038 | return ret; | |
| 20730 | } | ||
| 20731 | |||
| 20732 |
6/10✗ Branch 0 not taken.
✓ Branch 1 taken 122185 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 122185 times.
✓ Branch 4 taken 29654 times.
✓ Branch 5 taken 92531 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 92531 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 92531 times.
|
122185 | ret.setUnwalkable(_walkflag((wx&0xF0),wy,1,SWITCHBLOCK_STATE) || _walkflag((wx&0xF0)+8,wy,1,SWITCHBLOCK_STATE)); |
| 20733 | 122185 | return ret; | |
| 20734 | } | ||
| 20735 | |||
| 20736 | // different dir | ||
| 20737 |
3/8✓ Branch 0 taken 140509 times.
✓ Branch 1 taken 429 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 140509 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
140938 | if(current_item_power(itype_ladder)<2 && !(isSideViewHero() && (d2==left || d2==right))) |
| 20738 | { | ||
| 20739 | 140509 | ret.setUnwalkable(true); | |
| 20740 | 140509 | return ret; | |
| 20741 | } | ||
| 20742 | |||
| 20743 |
5/6✓ Branch 0 taken 372 times.
✓ Branch 1 taken 57 times.
✓ Branch 2 taken 372 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 352 times.
✓ Branch 5 taken 20 times.
|
429 | if(wy>=laddery && wy<=laddery+16 && d2<=down) |
| 20744 | { | ||
| 20745 | 20 | ret.setUnwalkable(false); | |
| 20746 | 20 | return ret; | |
| 20747 | } | ||
| 20748 | } | ||
| 20749 | 11795 | } | |
| 20750 |
6/6✓ Branch 0 taken 25406333 times.
✓ Branch 1 taken 5276140 times.
✓ Branch 2 taken 25101763 times.
✓ Branch 3 taken 304570 times.
✓ Branch 4 taken 6534069 times.
✓ Branch 5 taken 18567694 times.
|
30682473 | else if(wf || isSideViewHero() || get_qr(qr_DROWN)) |
| 20751 | { | ||
| 20752 | // see if it's a good spot for the ladder or for swimming | ||
| 20753 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 12114779 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 12114779 times.
|
12114779 | bool unwalkablex = _walkflag(wx,wy,1,SWITCHBLOCK_STATE); //will be used later for the ladder -DD |
| 20754 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 12114779 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 12114779 times.
|
12114779 | bool unwalkablex8 = _walkflag(x+8,wy,1,SWITCHBLOCK_STATE); |
| 20755 | |||
| 20756 |
2/2✓ Branch 0 taken 3561696 times.
✓ Branch 1 taken 8553083 times.
|
12114779 | if(get_qr(qr_DROWN)) |
| 20757 | { | ||
| 20758 | // Drowning changes the following attributes: | ||
| 20759 | // * Dangerous water is also walkable, so ignore the previous | ||
| 20760 | // definitions of unwalkablex and unwalkablex8. | ||
| 20761 | // * Instead, prevent the ladder from being used in the | ||
| 20762 | // one frame where Hero has landed on water before drowning. | ||
| 20763 | 8553083 | unwalkablex = unwalkablex8 = !iswaterex(MAPCOMBO(x+4,y+11), currmap, currscr, -1, x+4,y+11); | |
| 20764 | 8553083 | } | |
| 20765 | |||
| 20766 | // check if he can swim | ||
| 20767 |
5/6✓ Branch 0 taken 2403213 times.
✓ Branch 1 taken 9711566 times.
✓ Branch 2 taken 2400249 times.
✓ Branch 3 taken 2964 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2400249 times.
|
12114779 | if(current_item(itype_flippers) && z==0 && fakez==0) |
| 20768 | { | ||
| 20769 | 2400249 | int32_t wtrx = iswaterex(MAPCOMBO(wx,wy), currmap, currscr, -1, wx,wy); | |
| 20770 | 2400249 | int32_t wtrx8 = iswaterex(MAPCOMBO(x+8,wy), currmap, currscr, -1, x+8,wy); //!DIMI: Still not sure if this should be x + 8... | |
| 20771 |
2/6✓ Branch 0 taken 2400249 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2400249 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
2400249 | if (current_item(itype_flippers) >= combobuf[wtrx8].attribytes[0] && (!(combobuf[wtrx8].usrflags&cflag1) || (itemsbuf[current_item_id(itype_flippers)].flags & item_flag3))) //Don't swim if the water's required level is too high! -Dimi |
| 20772 | { | ||
| 20773 | //ladder ignores water combos that are now walkable thanks to flippers -DD | ||
| 20774 |
2/2✓ Branch 0 taken 13116 times.
✓ Branch 1 taken 2387133 times.
|
2400249 | unwalkablex = unwalkablex && (!wtrx); |
| 20775 |
2/2✓ Branch 0 taken 1358805 times.
✓ Branch 1 taken 1041444 times.
|
2400249 | unwalkablex8 = unwalkablex8 && (!wtrx8); |
| 20776 | |||
| 20777 |
2/2✓ Branch 0 taken 62 times.
✓ Branch 1 taken 2400187 times.
|
2400249 | if(landswim >= 22) |
| 20778 | { | ||
| 20779 | 62 | ret.setHopClk(2); | |
| 20780 | 62 | ret.setUnwalkable(false); | |
| 20781 | 62 | return ret; | |
| 20782 | } | ||
| 20783 |
8/8✓ Branch 0 taken 2102429 times.
✓ Branch 1 taken 297758 times.
✓ Branch 2 taken 17578 times.
✓ Branch 3 taken 2084851 times.
✓ Branch 4 taken 297758 times.
✓ Branch 5 taken 2084851 times.
✓ Branch 6 taken 1874 times.
✓ Branch 7 taken 295884 times.
|
2400187 | else if((d2>=left && wtrx) || (d2<=down && wtrx && wtrx8)) |
| 20784 | { | ||
| 20785 |
4/6✓ Branch 0 taken 12538 times.
✓ Branch 1 taken 6914 times.
✓ Branch 2 taken 12538 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 12538 times.
|
19452 | if(!(diagonalMovement||NO_GRIDLOCK)) |
| 20786 | { | ||
| 20787 | 12538 | ret.setHopClk(2); | |
| 20788 | |||
| 20789 |
2/4✓ Branch 0 taken 12538 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 12538 times.
|
12538 | if(charging || spins>5) |
| 20790 | { | ||
| 20791 | //if Hero is charging, he might be facing the wrong direction (we want him to | ||
| 20792 | //hop into the water, not in the facing direction) | ||
| 20793 | ✗ | ret.setDir(d2); | |
| 20794 | //moreover Hero can't charge in the water -DD | ||
| 20795 | ✗ | ret.setChargeAttack(); | |
| 20796 | ✗ | } | |
| 20797 | |||
| 20798 | 12538 | ret.setUnwalkable(false); | |
| 20799 | 12538 | return ret; | |
| 20800 | } | ||
| 20801 |
2/2✓ Branch 0 taken 523 times.
✓ Branch 1 taken 6391 times.
|
6914 | else if(dir==d2) |
| 20802 | { | ||
| 20803 | 6391 | ret.setIlswim(true); | |
| 20804 | 6391 | ladderx = 0; | |
| 20805 | 6391 | laddery = 0; | |
| 20806 | 6391 | } | |
| 20807 | 6914 | } | |
| 20808 | 2387649 | } | |
| 20809 | 2387649 | } | |
| 20810 | |||
| 20811 | // check if he can use the ladder | ||
| 20812 | // "Allow Ladder Anywhere" is toggled by fLADDER | ||
| 20813 |
2/2✓ Branch 0 taken 9251953 times.
✓ Branch 1 taken 2850226 times.
|
12102179 | if(can_deploy_ladder()) |
| 20814 | // laddersetup | ||
| 20815 | { | ||
| 20816 | // Check if there's water to use the ladder over | ||
| 20817 | 2850226 | bool wtrx = (iswaterex(MAPCOMBO(wx,wy), currmap, currscr, -1, wx,wy) != 0); | |
| 20818 | 2850226 | bool wtrx8 = (iswaterex(MAPCOMBO(x+8,wy), currmap, currscr, -1, x+8,wy) != 0); | |
| 20819 | 2850226 | int32_t ldrid = current_item_id(itype_ladder); | |
| 20820 |
1/2✓ Branch 0 taken 2850226 times.
✗ Branch 1 not taken.
|
2850226 | bool ladderpits = ldrid > -1 && (itemsbuf[ldrid].flags&item_flag1); |
| 20821 | |||
| 20822 |
4/4✓ Branch 0 taken 2840313 times.
✓ Branch 1 taken 9913 times.
✓ Branch 2 taken 53 times.
✓ Branch 3 taken 2840260 times.
|
2850226 | if(wtrx || wtrx8) |
| 20823 | { | ||
| 20824 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9966 times.
|
9966 | if(isSideViewHero()) |
| 20825 | { | ||
| 20826 | ✗ | wtrx = !_walkflag(wx, wy+8, 1,SWITCHBLOCK_STATE) && !_walkflag(wx, wy, 1,SWITCHBLOCK_STATE) && dir!=down; | |
| 20827 | ✗ | wtrx8 = !_walkflag(wx+8, wy+8, 1,SWITCHBLOCK_STATE) && !_walkflag(wx+8, wy, 1,SWITCHBLOCK_STATE) && dir!=down; | |
| 20828 | ✗ | } | |
| 20829 | // * walk on half-water using the ladder instead of using flippers. | ||
| 20830 | // * otherwise, walk on ladder(+hookshot) combos. | ||
| 20831 |
3/8✓ Branch 0 taken 595 times.
✓ Branch 1 taken 9371 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 595 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
9966 | else if(wtrx==wtrx8 && (isstepable(MAPCOMBO(wx, wy)) || isstepable(MAPCOMBO(wx+8,wy)) || wtrx==true)) |
| 20832 | { | ||
| 20833 |
2/2✓ Branch 0 taken 131 times.
✓ Branch 1 taken 464 times.
|
595 | if(!get_qr(qr_OLD_210_WATER)) |
| 20834 | { | ||
| 20835 | //if Hero could swim on a tile instead of using the ladder, | ||
| 20836 | //refuse to use the ladder to step over that tile. -DD | ||
| 20837 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 464 times.
|
464 | wtrx = isstepable(MAPCOMBO(wx, wy)) && unwalkablex; |
| 20838 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 458 times.
|
464 | wtrx8 = isstepable(MAPCOMBO(wx+8,wy)) && unwalkablex8; |
| 20839 | 464 | } | |
| 20840 | 595 | } | |
| 20841 | 9966 | } | |
| 20842 | else | ||
| 20843 | { | ||
| 20844 | // No water; check other things | ||
| 20845 | |||
| 20846 | //Check pits | ||
| 20847 |
2/2✓ Branch 0 taken 2839233 times.
✓ Branch 1 taken 1027 times.
|
2840260 | if(ladderpits) |
| 20848 | { | ||
| 20849 | 1027 | int32_t pit_cmb = getpitfall(wx,wy); | |
| 20850 |
1/2✓ Branch 0 taken 1027 times.
✗ Branch 1 not taken.
|
1027 | wtrx = pit_cmb && (combobuf[pit_cmb].usrflags&cflag4); |
| 20851 | 1027 | pit_cmb = getpitfall(x+8,wy); | |
| 20852 |
1/2✓ Branch 0 taken 1027 times.
✗ Branch 1 not taken.
|
1027 | wtrx8 = pit_cmb && (combobuf[pit_cmb].usrflags&cflag4); |
| 20853 | 1027 | } | |
| 20854 |
4/6✓ Branch 0 taken 1027 times.
✓ Branch 1 taken 2839233 times.
✓ Branch 2 taken 1027 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1027 times.
✗ Branch 5 not taken.
|
2840260 | if(!ladderpits || (!(wtrx || wtrx8) || isSideViewHero())) //If no pit, check ladder combos |
| 20855 | { | ||
| 20856 | 2840260 | int32_t combo=combobuf[MAPCOMBO(wx, wy)].type; | |
| 20857 |
2/2✓ Branch 0 taken 186 times.
✓ Branch 1 taken 2840074 times.
|
2840260 | wtrx=(combo==cLADDERONLY || combo==cLADDERHOOKSHOT); |
| 20858 | 2840260 | combo=combobuf[MAPCOMBO(wx+8, wy)].type; | |
| 20859 |
2/2✓ Branch 0 taken 292 times.
✓ Branch 1 taken 2839968 times.
|
2840260 | wtrx8=(combo==cLADDERONLY || combo==cLADDERHOOKSHOT); |
| 20860 | 2840260 | } | |
| 20861 | } | ||
| 20862 | |||
| 20863 |
2/2✓ Branch 0 taken 5700452 times.
✓ Branch 1 taken 2850226 times.
|
8550678 | for (int32_t i = 0; i <= 1; ++i) |
| 20864 | { | ||
| 20865 |
2/2✓ Branch 0 taken 4345824 times.
✓ Branch 1 taken 1354628 times.
|
5700452 | if(tmpscr2[i].valid!=0) |
| 20866 | { | ||
| 20867 |
2/2✓ Branch 0 taken 1303366 times.
✓ Branch 1 taken 51262 times.
|
1354628 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 20868 | { | ||
| 20869 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1303366 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1303366 | if (combobuf[MAPCOMBO2(i,wx,wy)].type == cBRIDGE && !_walkflag_layer(wx,wy,1, &(tmpscr2[i]))) wtrx = false; |
| 20870 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1303366 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1303366 | if (combobuf[MAPCOMBO2(i,wx+8,wy)].type == cBRIDGE && !_walkflag_layer(wx+8,wy,1, &(tmpscr2[i]))) wtrx8 = false; |
| 20871 | 1303366 | } | |
| 20872 | else | ||
| 20873 | { | ||
| 20874 |
3/4✓ Branch 0 taken 259 times.
✓ Branch 1 taken 51003 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 259 times.
|
51262 | if (combobuf[MAPCOMBO2(i,wx,wy)].type == cBRIDGE && _effectflag_layer(wx,wy,1, &(tmpscr2[i]))) wtrx = false; |
| 20875 |
3/4✓ Branch 0 taken 237 times.
✓ Branch 1 taken 51025 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 237 times.
|
51262 | if (combobuf[MAPCOMBO2(i,wx+8,wy)].type == cBRIDGE && _effectflag_layer(wx+8,wy,1, &(tmpscr2[i]))) wtrx8 = false; |
| 20876 | } | ||
| 20877 | 1354628 | } | |
| 20878 | 5700452 | } | |
| 20879 |
2/2✓ Branch 0 taken 2062592 times.
✓ Branch 1 taken 787634 times.
|
2850226 | bool walkwater = (get_qr(qr_DROWN) && !iswaterex(MAPCOMBO(wx,wy), currmap, currscr, -1, wx,wy)); |
| 20880 | |||
| 20881 |
4/6✓ Branch 0 taken 2202554 times.
✓ Branch 1 taken 647672 times.
✓ Branch 2 taken 2202554 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2202554 times.
|
2850226 | if((diagonalMovement||NO_GRIDLOCK)) |
| 20882 | { | ||
| 20883 |
2/2✓ Branch 0 taken 109936 times.
✓ Branch 1 taken 537736 times.
|
647672 | if(d2==dir) |
| 20884 | { | ||
| 20885 | 537736 | int32_t c = walkwater ? 0:8; | |
| 20886 | 537736 | int32_t b = walkwater ? 8:0; | |
| 20887 | |||
| 20888 |
2/2✓ Branch 0 taken 347962 times.
✓ Branch 1 taken 189774 times.
|
537736 | if(d2>=left) |
| 20889 | { | ||
| 20890 | // If the difference between wy and y is small enough | ||
| 20891 |
4/4✓ Branch 0 taken 102382 times.
✓ Branch 1 taken 245580 times.
✓ Branch 2 taken 347804 times.
✓ Branch 3 taken 158 times.
|
347962 | if(abs((wy)-(int32_t(y+c)))<=(b) && wtrx) |
| 20892 | { | ||
| 20893 | // Don't activate the ladder if it would be entirely | ||
| 20894 | // over water and Hero has the flippers. This isn't | ||
| 20895 | // a good way to do this, but it's too risky | ||
| 20896 | // to make big changes to this stuff. | ||
| 20897 | 158 | bool deployLadder=true; | |
| 20898 | 158 | int32_t lx=wx&0xF0; | |
| 20899 |
6/8✓ Branch 0 taken 2 times.
✓ Branch 1 taken 156 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 156 times.
✓ Branch 7 taken 2 times.
|
158 | if(current_item(itype_flippers) && current_item(itype_flippers) >= combobuf[iswaterex(MAPCOMBO(lx+8, y+8), currmap, currscr, -1, lx+8, y+8)].attribytes[0] && z==0 && fakez==0) |
| 20900 | { | ||
| 20901 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | if(iswaterex(MAPCOMBO(lx, y), currmap, currscr, -1, lx, y) && |
| 20902 | ✗ | iswaterex(MAPCOMBO(lx+15, y), currmap, currscr, -1, lx+15, y) && | |
| 20903 | ✗ | iswaterex(MAPCOMBO(lx, y+15), currmap, currscr, -1, lx, y+15) && | |
| 20904 | ✗ | iswaterex(MAPCOMBO(lx+15, y+15), currmap, currscr, -1, lx+15, y+15)) | |
| 20905 | ✗ | deployLadder=false; | |
| 20906 | 2 | } | |
| 20907 |
1/2✓ Branch 0 taken 158 times.
✗ Branch 1 not taken.
|
158 | if(deployLadder) |
| 20908 | { | ||
| 20909 | 158 | ladderx = wx&0xF0; | |
| 20910 | 158 | laddery = y; | |
| 20911 | 158 | ladderdir = left; | |
| 20912 | 158 | ladderstart = d2; | |
| 20913 | 158 | ret.setUnwalkable(laddery!=y.getInt()); | |
| 20914 | 158 | return ret; | |
| 20915 | } | ||
| 20916 | ✗ | } | |
| 20917 | 347804 | } | |
| 20918 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 189774 times.
|
189774 | else if(d2<=down) |
| 20919 | { | ||
| 20920 | // If the difference between wx and x is small enough | ||
| 20921 |
4/4✓ Branch 0 taken 75665 times.
✓ Branch 1 taken 114109 times.
✓ Branch 2 taken 87 times.
✓ Branch 3 taken 189687 times.
|
189774 | if(abs((wx)-(int32_t(x+c)))<=(b) && wtrx) |
| 20922 | { | ||
| 20923 | 87 | ladderx = x; | |
| 20924 | 87 | laddery = wy&0xF0; | |
| 20925 | 87 | ladderdir = up; | |
| 20926 | 87 | ladderstart = d2; | |
| 20927 | 87 | ret.setUnwalkable(ladderx!=x.getInt()); | |
| 20928 | 87 | return ret; | |
| 20929 | } | ||
| 20930 | |||
| 20931 |
2/2✓ Branch 0 taken 75624 times.
✓ Branch 1 taken 114063 times.
|
189687 | if(cnt==2) |
| 20932 | { | ||
| 20933 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 114063 times.
✓ Branch 2 taken 17 times.
✓ Branch 3 taken 114046 times.
|
114063 | if(abs((wx+8)-(int32_t(x+c)))<=(b) && wtrx8) |
| 20934 | { | ||
| 20935 | 17 | ladderx = x; | |
| 20936 | 17 | laddery = wy&0xF0; | |
| 20937 | 17 | ladderdir = up; | |
| 20938 | 17 | ladderstart = d2; | |
| 20939 | 17 | ret.setUnwalkable(ladderx!=x.getInt()); | |
| 20940 | 17 | return ret; | |
| 20941 | } | ||
| 20942 | 114046 | } | |
| 20943 | 189670 | } | |
| 20944 | 537474 | } | |
| 20945 | 647410 | } | |
| 20946 | else | ||
| 20947 | { | ||
| 20948 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 2202554 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2202554 times.
✓ Branch 4 taken 116610 times.
✓ Branch 5 taken 2085944 times.
|
2202554 | bool flgx = _walkflag(wx,wy,1,SWITCHBLOCK_STATE) && !wtrx; // Solid, and not steppable |
| 20949 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 2202554 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2202554 times.
✓ Branch 4 taken 2015835 times.
✓ Branch 5 taken 186719 times.
|
2202554 | bool flgx8 = _walkflag(x+8,wy,1,SWITCHBLOCK_STATE) && !wtrx8; // Solid, and not steppable |
| 20950 | |||
| 20951 |
2/2✓ Branch 0 taken 2039953 times.
✓ Branch 1 taken 162601 times.
|
2202626 | if((d2>=left && wtrx) |
| 20952 | // Deploy the ladder vertically even if Hero is only half on water. | ||
| 20953 |
8/8✓ Branch 0 taken 18496 times.
✓ Branch 1 taken 2021457 times.
✓ Branch 2 taken 162601 times.
✓ Branch 3 taken 2021457 times.
✓ Branch 4 taken 1222 times.
✓ Branch 5 taken 161379 times.
✓ Branch 6 taken 72 times.
✓ Branch 7 taken 162529 times.
|
2202554 | || (d2<=down && ((wtrx && !flgx8) || (wtrx8 && !flgx)))) |
| 20954 | { | ||
| 20955 |
4/4✓ Branch 0 taken 17936 times.
✓ Branch 1 taken 560 times.
✓ Branch 2 taken 697 times.
✓ Branch 3 taken 17239 times.
|
18496 | if(((y.getInt()+15) < wy) || ((y.getInt()+8) > wy)) |
| 20956 | 1257 | ladderdir = up; | |
| 20957 | else | ||
| 20958 | 17239 | ladderdir = left; | |
| 20959 | |||
| 20960 |
2/2✓ Branch 0 taken 17239 times.
✓ Branch 1 taken 1257 times.
|
18496 | if(ladderdir==up) |
| 20961 | { | ||
| 20962 | 1257 | ladderx = x.getInt()&0xF8; | |
| 20963 | 1257 | laddery = wy&0xF0; | |
| 20964 | 1257 | } | |
| 20965 | else | ||
| 20966 | { | ||
| 20967 | 17239 | ladderx = wx&0xF0; | |
| 20968 | 17239 | laddery = y.getInt()&0xF8; | |
| 20969 | } | ||
| 20970 | |||
| 20971 | 18496 | ret.setUnwalkable(false); | |
| 20972 | 18496 | return ret; | |
| 20973 | } | ||
| 20974 | } | ||
| 20975 | 2831468 | } | |
| 20976 | 12083421 | } | |
| 20977 | |||
| 20978 | 30754833 | ret.setUnwalkable(wf); | |
| 20979 | 30754833 | return ret; | |
| 20980 | 32227794 | } | |
| 20981 | |||
| 20982 | // Only checks for moving blocks. Apparently this is a thing we need. | ||
| 20983 | 3036610 | HeroClass::WalkflagInfo HeroClass::walkflagMBlock(int32_t wx,int32_t wy) | |
| 20984 | { | ||
| 20985 | 3036610 | HeroClass::WalkflagInfo ret; | |
| 20986 |
2/2✓ Branch 0 taken 47377 times.
✓ Branch 1 taken 2989233 times.
|
3036610 | if (!mblock2.active()) //Without this, weird swimming behaviors happen. |
| 20987 | { | ||
| 20988 | 2989233 | ret.setFlags(~1); | |
| 20989 | 2989233 | ret.setHopDir(-1); | |
| 20990 | 2989233 | } | |
| 20991 |
2/2✓ Branch 0 taken 2807 times.
✓ Branch 1 taken 3033803 times.
|
3036610 | if(toogam) return ret; |
| 20992 |
2/2✓ Branch 0 taken 2986426 times.
✓ Branch 1 taken 47377 times.
|
3033803 | if (mblock2.active()) |
| 20993 | 47377 | ret.setUnwalkable(mblock2.hit(wx,wy,0,1,1,1)); | |
| 20994 |
2/2✓ Branch 0 taken 3033553 times.
✓ Branch 1 taken 250 times.
|
3033803 | if (collide_object(wx, wy,1, 1)) |
| 20995 | 250 | ret.setUnwalkable(true); | |
| 20996 | 3033803 | return ret; | |
| 20997 | 3036610 | } | |
| 20998 | |||
| 20999 | 13970753 | bool HeroClass::checksoliddamage() | |
| 21000 | { | ||
| 21001 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13970753 times.
|
13970753 | if(toogam) return false; |
| 21002 | |||
| 21003 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 13970753 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
13970753 | if (get_qr(qr_NO_SIDEVIEW_SOLID_DAMAGE) && get_qr(qr_NOSOLIDDAMAGECOMBOS)) return false; //no point checking if both of these rules are on |
| 21004 | |||
| 21005 |
2/4✓ Branch 0 taken 13970753 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 13970753 times.
|
13970753 | if(z!=0||fakez!=0) return false; |
| 21006 | 13970753 | int32_t bx = x.getInt(); | |
| 21007 | 13970753 | int32_t by = y.getInt(); | |
| 21008 | 13970753 | int32_t initk = 0; | |
| 21009 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 3450860 times.
✓ Branch 2 taken 2801714 times.
✓ Branch 3 taken 3734643 times.
✓ Branch 4 taken 3983536 times.
|
13970753 | switch(dir) |
| 21010 | { | ||
| 21011 | case up: | ||
| 21012 | |||
| 21013 |
2/2✓ Branch 0 taken 83482 times.
✓ Branch 1 taken 3367378 times.
|
3450860 | by-=get_qr(qr_NEW_HERO_MOVEMENT2)?(bigHitbox ? 4 : -4):(bigHitbox ? 1 : -7); |
| 21014 |
2/2✓ Branch 0 taken 83482 times.
✓ Branch 1 taken 3367378 times.
|
3450860 | if (get_qr(qr_LENIENT_SOLID_DAMAGE)) bx += 8; |
| 21015 |
1/2✓ Branch 0 taken 3367378 times.
✗ Branch 1 not taken.
|
3367378 | else if (!get_qr(qr_SENSITIVE_SOLID_DAMAGE)) bx += 4; |
| 21016 |
2/2✓ Branch 0 taken 100 times.
✓ Branch 1 taken 3450760 times.
|
3450860 | if(by<0) |
| 21017 | { | ||
| 21018 | 100 | return false; | |
| 21019 | } | ||
| 21020 | 3450760 | break; | |
| 21021 | |||
| 21022 | case down: | ||
| 21023 | |||
| 21024 | 2801714 | by+=get_qr(qr_NEW_HERO_MOVEMENT2)?16:20; | |
| 21025 |
2/2✓ Branch 0 taken 89712 times.
✓ Branch 1 taken 2712002 times.
|
2801714 | if (get_qr(qr_LENIENT_SOLID_DAMAGE)) bx += 8; |
| 21026 |
1/2✓ Branch 0 taken 2712002 times.
✗ Branch 1 not taken.
|
2712002 | else if (!get_qr(qr_SENSITIVE_SOLID_DAMAGE)) bx += 4; |
| 21027 |
2/2✓ Branch 0 taken 26483 times.
✓ Branch 1 taken 2775231 times.
|
2801714 | if(by>175) |
| 21028 | { | ||
| 21029 | 26483 | return false; | |
| 21030 | } | ||
| 21031 | |||
| 21032 | 2775231 | break; | |
| 21033 | |||
| 21034 | case left: | ||
| 21035 | 3734643 | bx-=get_qr(qr_NEW_HERO_MOVEMENT2)?1:4; | |
| 21036 |
2/2✓ Branch 0 taken 119761 times.
✓ Branch 1 taken 3614882 times.
|
3734643 | if (get_qr(qr_LENIENT_SOLID_DAMAGE)) by += bigHitbox?7:11; |
| 21037 |
1/2✓ Branch 0 taken 3614882 times.
✗ Branch 1 not taken.
|
3614882 | else if (!get_qr(qr_SENSITIVE_SOLID_DAMAGE)) by += 4; |
| 21038 |
4/4✓ Branch 0 taken 3666431 times.
✓ Branch 1 taken 68212 times.
✓ Branch 2 taken 119761 times.
✓ Branch 3 taken 3546670 times.
|
3734643 | if (!bigHitbox && !get_qr(qr_LENIENT_SOLID_DAMAGE)) |
| 21039 | { | ||
| 21040 | 3546670 | by+=8; | |
| 21041 | 3546670 | initk = 1; | |
| 21042 | 3546670 | } | |
| 21043 |
2/2✓ Branch 0 taken 20267 times.
✓ Branch 1 taken 3714376 times.
|
3734643 | if(bx<0) |
| 21044 | { | ||
| 21045 | 20267 | return false; | |
| 21046 | } | ||
| 21047 | |||
| 21048 | 3714376 | break; | |
| 21049 | |||
| 21050 | case right: | ||
| 21051 | 3983536 | bx+=get_qr(qr_NEW_HERO_MOVEMENT2)?16:20; | |
| 21052 |
2/2✓ Branch 0 taken 118008 times.
✓ Branch 1 taken 3865528 times.
|
3983536 | if (get_qr(qr_LENIENT_SOLID_DAMAGE)) by += bigHitbox?7:11; |
| 21053 |
1/2✓ Branch 0 taken 3865528 times.
✗ Branch 1 not taken.
|
3865528 | else if (!get_qr(qr_SENSITIVE_SOLID_DAMAGE)) by += 4; |
| 21054 |
4/4✓ Branch 0 taken 3905942 times.
✓ Branch 1 taken 77594 times.
✓ Branch 2 taken 118008 times.
✓ Branch 3 taken 3787934 times.
|
3983536 | if (!bigHitbox && !get_qr(qr_LENIENT_SOLID_DAMAGE)) |
| 21055 | { | ||
| 21056 | 3787934 | by+=8; | |
| 21057 | 3787934 | initk = 1; | |
| 21058 | 3787934 | } | |
| 21059 |
2/2✓ Branch 0 taken 28650 times.
✓ Branch 1 taken 3954886 times.
|
3983536 | if(bx>255) |
| 21060 | { | ||
| 21061 | 28650 | return false; | |
| 21062 | } | ||
| 21063 | |||
| 21064 | 3954886 | break; | |
| 21065 | } | ||
| 21066 |
2/2✓ Branch 0 taken 13484580 times.
✓ Branch 1 taken 410673 times.
|
13895253 | if (!get_qr(qr_SENSITIVE_SOLID_DAMAGE)) initk++; |
| 21067 | 13895253 | newcombo const& cmb = combobuf[MAPCOMBO(bx,by)]; | |
| 21068 | 13895253 | int32_t t = cmb.type; | |
| 21069 |
2/2✓ Branch 0 taken 13895137 times.
✓ Branch 1 taken 116 times.
|
13895253 | if(cmb.triggerflags[0] & combotriggerONLYGENTRIG) |
| 21070 | 116 | t = cNONE; | |
| 21071 | 13895253 | int32_t initbx = bx; | |
| 21072 | 13895253 | int32_t initby = by; | |
| 21073 | |||
| 21074 | // Unlike push blocks, damage combos should be tested on layers 2 and under | ||
| 21075 |
2/2✓ Branch 0 taken 25227243 times.
✓ Branch 1 taken 13895238 times.
|
39122481 | for(int32_t i=(get_qr(qr_DMGCOMBOLAYERFIX) ? 2 : 0); i>=0; i--) |
| 21076 | { | ||
| 21077 | 25227243 | bx = initbx; | |
| 21078 | 25227243 | by = initby; | |
| 21079 |
2/2✓ Branch 0 taken 7733665 times.
✓ Branch 1 taken 17493578 times.
|
25227243 | if (!get_qr(qr_NOSOLIDDAMAGECOMBOS)) |
| 21080 | { | ||
| 21081 |
2/2✓ Branch 0 taken 16261551 times.
✓ Branch 1 taken 41443667 times.
|
57705218 | for (int32_t k = initk; k <= 2; k++) |
| 21082 | { | ||
| 21083 | 41443667 | newcombo const& cmb = combobuf[FFCore.tempScreens[i]->data[COMBOPOS(bx,by)]]; | |
| 21084 | 41443667 | t = cmb.type; | |
| 21085 |
2/2✓ Branch 0 taken 41443349 times.
✓ Branch 1 taken 318 times.
|
41443667 | if(cmb.triggerflags[0] & combotriggerONLYGENTRIG) |
| 21086 | 318 | t = cNONE; | |
| 21087 | // Solid damage combos use pushing>0, hence the code is here. | ||
| 21088 |
9/10✓ Branch 0 taken 1744500 times.
✓ Branch 1 taken 39699167 times.
✓ Branch 2 taken 75234 times.
✓ Branch 3 taken 1669266 times.
✓ Branch 4 taken 72345 times.
✓ Branch 5 taken 2889 times.
✓ Branch 6 taken 1305 times.
✓ Branch 7 taken 71040 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1305 times.
|
41443667 | if (!get_qr(qr_LESS_AWFUL_SIDESPIKES) || !isSideViewHero() || (dir != down && (dir != up || getOnSideviewLadder()))) |
| 21089 | { | ||
| 21090 |
13/16✓ Branch 0 taken 41411152 times.
✓ Branch 1 taken 28321 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 28321 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 28321 times.
✓ Branch 6 taken 1265 times.
✓ Branch 7 taken 27056 times.
✓ Branch 8 taken 169 times.
✓ Branch 9 taken 1096 times.
✓ Branch 10 taken 67 times.
✓ Branch 11 taken 102 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 67 times.
✓ Branch 14 taken 41439406 times.
✓ Branch 15 taken 67 times.
|
41439473 | if(combo_class_buf[t].modify_hp_amount && _walkflag(bx,by,1,SWITCHBLOCK_STATE) && pushing>0 && hclk<1 && action!=casting && action != sideswimcasting) |
| 21091 | { | ||
| 21092 | // Bite Hero | ||
| 21093 |
2/2✓ Branch 0 taken 59 times.
✓ Branch 1 taken 8 times.
|
67 | if (checkdamagecombos(bx, bx, by, by, i-1, true)) return true; |
| 21094 | 59 | } | |
| 21095 | 41439465 | } | |
| 21096 |
2/2✓ Branch 0 taken 22279979 times.
✓ Branch 1 taken 19163680 times.
|
41443659 | if (dir < left) bx += (k % 2) ? 7 : 8; |
| 21097 | 19163680 | else by += (k % 2) ? 7 : 8; | |
| 21098 |
2/2✓ Branch 0 taken 40211640 times.
✓ Branch 1 taken 1232019 times.
|
41443659 | if (get_qr(qr_LENIENT_SOLID_DAMAGE)) break; |
| 21099 | 40211640 | } | |
| 21100 | 17493570 | } | |
| 21101 |
4/6✓ Branch 0 taken 381213 times.
✓ Branch 1 taken 24846022 times.
✓ Branch 2 taken 381213 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 354288 times.
|
25581523 | if(isSideViewHero() && !get_qr(qr_NO_SIDEVIEW_SOLID_DAMAGE) && // Check for sideview damage combos |
| 21102 |
3/4✓ Branch 0 taken 354288 times.
✓ Branch 1 taken 26925 times.
✓ Branch 2 taken 354288 times.
✗ Branch 3 not taken.
|
381213 | hclk<1 && action!=casting && action!=sideswimcasting) // ... but only if Hero could be hurt |
| 21103 | { | ||
| 21104 |
2/2✓ Branch 0 taken 34776 times.
✓ Branch 1 taken 319512 times.
|
354288 | if (get_qr(qr_LESS_AWFUL_SIDESPIKES)) |
| 21105 | { | ||
| 21106 |
2/6✓ Branch 0 taken 34776 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 34776 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
34776 | if (on_sideview_solid_oldpos(this) && (!getOnSideviewLadder() || DrunkDown())) |
| 21107 | { | ||
| 21108 |
4/4✓ Branch 0 taken 34772 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 34774 times.
✓ Branch 3 taken 2 times.
|
34776 | if(checkdamagecombos(x+4, x+4, y+16, y+18, i-1, false, false) && checkdamagecombos(x+12, x+12, y+16, y+18, i-1, false, false)) |
| 21109 | { | ||
| 21110 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if (checkdamagecombos(x+4, x+12, y+16, y+18, i-1, false, true)) return true; |
| 21111 | ✗ | } | |
| 21112 | 34774 | } | |
| 21113 |
1/2✓ Branch 0 taken 34774 times.
✗ Branch 1 not taken.
|
34774 | if (checkdamagecombos(x+4, x+12, y+8, y+15, i-1, false, true)) return true; |
| 21114 | 34774 | } | |
| 21115 | else | ||
| 21116 | { | ||
| 21117 | //old 2.50.2-ish code for 2.50.0 sideview quests for er_OLDSIDEVIEWSPIKES | ||
| 21118 |
1/2✓ Branch 0 taken 319512 times.
✗ Branch 1 not taken.
|
319512 | if ( get_qr(qr_OLDSIDEVIEWSPIKES ) ) |
| 21119 | { | ||
| 21120 |
2/2✓ Branch 0 taken 319507 times.
✓ Branch 1 taken 5 times.
|
639024 | if (checkdamagecombos(x+8-(zfix)(tmpscr->csensitive), |
| 21121 |
1/2✓ Branch 0 taken 319512 times.
✗ Branch 1 not taken.
|
319512 | x+8+(zc_max(tmpscr->csensitive-1,0)), |
| 21122 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 319512 times.
|
319512 | y+17-(get_qr(qr_LTTPCOLLISION)?tmpscr->csensitive:(tmpscr->csensitive+1)/2), |
| 21123 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 319512 times.
✓ Branch 2 taken 319512 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 319512 times.
|
319512 | y+17+zc_max((get_qr(qr_LTTPCOLLISION)?tmpscr->csensitive:(tmpscr->csensitive+1)/2)-1,0), i-1, true)) |
| 21124 | 5 | return true; | |
| 21125 | 319507 | } | |
| 21126 | else //2.50.1 and later | ||
| 21127 | { | ||
| 21128 | ✗ | if(checkdamagecombos(x+4, x+12, y+16, y+24)) | |
| 21129 | ✗ | return true; | |
| 21130 | } | ||
| 21131 | } | ||
| 21132 | |||
| 21133 | 354281 | } | |
| 21134 | 25227228 | } | |
| 21135 | 13895238 | return false; | |
| 21136 | 13970753 | } | |
| 21137 | 14129284 | void HeroClass::checkpushblock() | |
| 21138 | { | ||
| 21139 |
2/2✓ Branch 0 taken 14694 times.
✓ Branch 1 taken 14114590 times.
|
14129284 | if(toogam) return; |
| 21140 | |||
| 21141 |
3/4✓ Branch 0 taken 14096910 times.
✓ Branch 1 taken 17680 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 14096910 times.
|
14114590 | if(z!=0||fakez!=0) return; |
| 21142 | |||
| 21143 | // Return early in some cases.. | ||
| 21144 | 14096910 | bool earlyReturn=false; | |
| 21145 | |||
| 21146 |
5/6✓ Branch 0 taken 9721570 times.
✓ Branch 1 taken 4375340 times.
✓ Branch 2 taken 9721570 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 10915757 times.
✓ Branch 5 taken 3181153 times.
|
14096910 | if(!(diagonalMovement||NO_GRIDLOCK) || dir==left) |
| 21147 |
2/2✓ Branch 0 taken 3855184 times.
✓ Branch 1 taken 7060573 times.
|
10915757 | if(x.getInt()&15) earlyReturn=true; |
| 21148 | |||
| 21149 | // if(y<16) return; | ||
| 21150 |
4/4✓ Branch 0 taken 253972 times.
✓ Branch 1 taken 13842938 times.
✓ Branch 2 taken 127815 times.
✓ Branch 3 taken 126157 times.
|
14096910 | if(isSideViewHero() && !on_sideview_solid_oldpos(this)) return; |
| 21151 | |||
| 21152 | 13970753 | int32_t bx = x.getInt()&0xF0; | |
| 21153 | 13970753 | int32_t by = (y.getInt()&0xF0); | |
| 21154 | |||
| 21155 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 3450860 times.
✓ Branch 2 taken 2801714 times.
✓ Branch 3 taken 3734643 times.
✓ Branch 4 taken 3983536 times.
|
13970753 | switch(dir) |
| 21156 | { | ||
| 21157 | case up: | ||
| 21158 |
2/2✓ Branch 0 taken 118403 times.
✓ Branch 1 taken 3332457 times.
|
3450860 | if(y<16) |
| 21159 | { | ||
| 21160 | 118403 | earlyReturn=true; | |
| 21161 | 118403 | break; | |
| 21162 | } | ||
| 21163 | |||
| 21164 |
3/4✓ Branch 0 taken 579715 times.
✓ Branch 1 taken 2752742 times.
✓ Branch 2 taken 579715 times.
✗ Branch 3 not taken.
|
3332457 | if(!((int32_t)y&15)&&y!=0) by-=bigHitbox ? 16 : 0; |
| 21165 | |||
| 21166 |
2/2✓ Branch 0 taken 1929354 times.
✓ Branch 1 taken 1403103 times.
|
3332457 | if((int32_t)x&8) bx+=16; |
| 21167 | |||
| 21168 | 3332457 | break; | |
| 21169 | |||
| 21170 | case down: | ||
| 21171 |
2/2✓ Branch 0 taken 231709 times.
✓ Branch 1 taken 2570005 times.
|
2801714 | if(y>128) |
| 21172 | { | ||
| 21173 | 231709 | earlyReturn=true; | |
| 21174 | 231709 | break; | |
| 21175 | } | ||
| 21176 | else | ||
| 21177 | { | ||
| 21178 | 2570005 | by+=16; | |
| 21179 | |||
| 21180 |
2/2✓ Branch 0 taken 1648120 times.
✓ Branch 1 taken 921885 times.
|
2570005 | if((int32_t)x&8) bx+=16; |
| 21181 | } | ||
| 21182 | |||
| 21183 | 2570005 | break; | |
| 21184 | |||
| 21185 | case left: | ||
| 21186 |
2/2✓ Branch 0 taken 196332 times.
✓ Branch 1 taken 3538311 times.
|
3734643 | if(x<32) |
| 21187 | { | ||
| 21188 | 196332 | earlyReturn=true; | |
| 21189 | 196332 | break; | |
| 21190 | } | ||
| 21191 | else | ||
| 21192 | { | ||
| 21193 | 3538311 | bx-=16; | |
| 21194 | |||
| 21195 |
2/2✓ Branch 0 taken 2139873 times.
✓ Branch 1 taken 1398438 times.
|
3538311 | if(y.getInt()&8) |
| 21196 | { | ||
| 21197 | 1398438 | by+=16; | |
| 21198 | 1398438 | } | |
| 21199 | } | ||
| 21200 | |||
| 21201 | 3538311 | break; | |
| 21202 | |||
| 21203 | case right: | ||
| 21204 |
2/2✓ Branch 0 taken 204800 times.
✓ Branch 1 taken 3778736 times.
|
3983536 | if(x>208) |
| 21205 | { | ||
| 21206 | 204800 | earlyReturn=true; | |
| 21207 | 204800 | break; | |
| 21208 | } | ||
| 21209 | else | ||
| 21210 | { | ||
| 21211 | 3778736 | bx+=16; | |
| 21212 | |||
| 21213 |
2/2✓ Branch 0 taken 2301404 times.
✓ Branch 1 taken 1477332 times.
|
3778736 | if(y.getInt()&8) |
| 21214 | { | ||
| 21215 | 1477332 | by+=16; | |
| 21216 | 1477332 | } | |
| 21217 | } | ||
| 21218 | |||
| 21219 | 3778736 | break; | |
| 21220 | } | ||
| 21221 | |||
| 21222 |
2/2✓ Branch 0 taken 15 times.
✓ Branch 1 taken 13970738 times.
|
13970753 | if (checksoliddamage()) return; |
| 21223 | |||
| 21224 |
2/2✓ Branch 0 taken 7361806 times.
✓ Branch 1 taken 6608932 times.
|
13970738 | if(earlyReturn) |
| 21225 | 7361806 | return; | |
| 21226 | |||
| 21227 | 6608932 | int itemid=current_item_id(itype_bracelet); | |
| 21228 | 6608932 | size_t combopos = (by&0xF0)+(bx>>4); | |
| 21229 |
2/2✓ Branch 0 taken 2752942 times.
✓ Branch 1 taken 3855990 times.
|
6608932 | bool limitedpush = (itemid>=0 && itemsbuf[itemid].flags & item_flag1); |
| 21230 |
2/2✓ Branch 0 taken 3855990 times.
✓ Branch 1 taken 2752942 times.
|
6608932 | itemdata const* glove = itemid < 0 ? NULL : &itemsbuf[itemid]; |
| 21231 |
2/2✓ Branch 0 taken 1712009 times.
✓ Branch 1 taken 10044563 times.
|
11756572 | for(int lyr = 2; lyr > -1; --lyr) //Top-down, in case of stacked push blocks |
| 21232 | { | ||
| 21233 |
4/4✓ Branch 0 taken 6347866 times.
✓ Branch 1 taken 3696697 times.
✓ Branch 2 taken 1456401 times.
✓ Branch 3 taken 4891465 times.
|
10044563 | if(get_qr(qr_HESITANTPUSHBLOCKS)&&(pushing<4)) break; |
| 21234 |
4/4✓ Branch 0 taken 3434927 times.
✓ Branch 1 taken 1718171 times.
✓ Branch 2 taken 89013 times.
✓ Branch 3 taken 3345914 times.
|
5153098 | if(lyr && !get_qr(qr_PUSHBLOCK_LAYER_1_2)) |
| 21235 | 3345914 | continue; | |
| 21236 | 1807184 | cpos_info& cpinfo = cpos_get(lyr, combopos); | |
| 21237 | 1807184 | mapscr* m = FFCore.tempScreens[lyr]; | |
| 21238 |
2/2✓ Branch 0 taken 89749 times.
✓ Branch 1 taken 1717435 times.
|
1807184 | int cid = lyr == 0 ? MAPCOMBO(bx,by) : MAPCOMBOL(lyr,bx,by); |
| 21239 | 1807184 | newcombo const& cmb = combobuf[cid]; | |
| 21240 | 1807184 | int f = MAPFLAG2(lyr-1,bx,by); | |
| 21241 | 1807184 | int f2 = cmb.flag; | |
| 21242 | 1807184 | int t = cmb.type; | |
| 21243 | |||
| 21244 |
6/6✓ Branch 0 taken 1691582 times.
✓ Branch 1 taken 115602 times.
✓ Branch 2 taken 1687049 times.
✓ Branch 3 taken 4533 times.
✓ Branch 4 taken 2464 times.
✓ Branch 5 taken 1684585 times.
|
3491769 | bool waitblock = (t==cPUSH_WAIT || t==cPUSH_HW || t==cPUSH_HW2) || |
| 21245 |
2/2✓ Branch 0 taken 1683723 times.
✓ Branch 1 taken 862 times.
|
1684585 | (t == cPUSHBLOCK && (cmb.usrflags&cflag6)); |
| 21246 | 1807184 | int heavy = 0; | |
| 21247 |
4/4✓ Branch 0 taken 1801915 times.
✓ Branch 1 taken 5269 times.
✓ Branch 2 taken 15029 times.
✓ Branch 3 taken 1786886 times.
|
1807184 | if(t==cPUSH_HW || t==cPUSH_HEAVY) |
| 21248 | 20298 | heavy = 1; | |
| 21249 |
4/4✓ Branch 0 taken 1782989 times.
✓ Branch 1 taken 3897 times.
✓ Branch 2 taken 2464 times.
✓ Branch 3 taken 1780525 times.
|
1786886 | else if(t==cPUSH_HEAVY2 || t==cPUSH_HW2) |
| 21250 | 6361 | heavy = 2; | |
| 21251 |
2/2✓ Branch 0 taken 1779663 times.
✓ Branch 1 taken 862 times.
|
1780525 | else if(t == cPUSHBLOCK) |
| 21252 | 862 | heavy = cmb.attribytes[0]; | |
| 21253 | |||
| 21254 |
6/6✓ Branch 0 taken 121863 times.
✓ Branch 1 taken 1685321 times.
✓ Branch 2 taken 39413 times.
✓ Branch 3 taken 82450 times.
✓ Branch 4 taken 3708 times.
✓ Branch 5 taken 35705 times.
|
1807184 | if(waitblock && (pushing<16 || hasMainGuy())) continue; |
| 21255 | |||
| 21256 |
8/8✓ Branch 0 taken 1699567 times.
✓ Branch 1 taken 21459 times.
✓ Branch 2 taken 18606 times.
✓ Branch 3 taken 2853 times.
✓ Branch 4 taken 3028 times.
✓ Branch 5 taken 15578 times.
✓ Branch 6 taken 6256 times.
✓ Branch 7 taken 1714770 times.
|
1758063 | if(heavy && (itemid<0 || glove->power < heavy || |
| 21257 |
3/4✓ Branch 0 taken 12678 times.
✓ Branch 1 taken 2900 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2900 times.
|
21834 | (limitedpush && usecounts[itemid] >= zc_max(1, glove->misc3)))) continue; |
| 21258 | |||
| 21259 | 1714770 | bool doit=false; | |
| 21260 | 1714770 | bool changecombo=false; | |
| 21261 | |||
| 21262 | 1714770 | int blockdir = dir; | |
| 21263 |
1/2✓ Branch 0 taken 1714770 times.
✗ Branch 1 not taken.
|
1714770 | if(blockdir > 3) blockdir = Y_DIR(dir); |
| 21264 |
6/6✓ Branch 0 taken 862 times.
✓ Branch 1 taken 1713908 times.
✓ Branch 2 taken 779 times.
✓ Branch 3 taken 83 times.
✓ Branch 4 taken 476 times.
✓ Branch 5 taken 303 times.
|
1714770 | if(t == cPUSHBLOCK && (get_qr(qr_BROKEN_GENERIC_PUSHBLOCK_LOCKING) || (f!=mfPUSHED))) |
| 21265 | { | ||
| 21266 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 64 times.
✓ Branch 2 taken 181 times.
✓ Branch 3 taken 191 times.
✓ Branch 4 taken 123 times.
|
559 | switch(blockdir) |
| 21267 | { | ||
| 21268 | case up: | ||
| 21269 | 64 | doit = cmb.usrflags & cflag1; | |
| 21270 | 64 | break; | |
| 21271 | case down: | ||
| 21272 | 181 | doit = cmb.usrflags & cflag2; | |
| 21273 | 181 | break; | |
| 21274 | case left: | ||
| 21275 | 191 | doit = cmb.usrflags & cflag3; | |
| 21276 | 191 | break; | |
| 21277 | case right: | ||
| 21278 | 123 | doit = cmb.usrflags & cflag4; | |
| 21279 | 123 | break; | |
| 21280 | } | ||
| 21281 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 559 times.
|
559 | if(cmb.usrflags & cflag5) //Separate directions |
| 21282 | { | ||
| 21283 | ✗ | if(int limit = cmb.attribytes[4+blockdir]) | |
| 21284 | { | ||
| 21285 | ✗ | if(cpinfo.pushes[blockdir] >= limit) | |
| 21286 | ✗ | doit = false; | |
| 21287 | ✗ | } | |
| 21288 | ✗ | else if(cmb.usrflags & cflag9) | |
| 21289 | ✗ | doit = false; | |
| 21290 | ✗ | } | |
| 21291 | else | ||
| 21292 | { | ||
| 21293 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 559 times.
|
559 | if(int limit = cmb.attribytes[4]) |
| 21294 | { | ||
| 21295 | ✗ | if(cpinfo.sumpush() >= limit) | |
| 21296 | ✗ | doit = false; | |
| 21297 | ✗ | } | |
| 21298 |
1/2✓ Branch 0 taken 559 times.
✗ Branch 1 not taken.
|
559 | else if(cmb.usrflags & cflag9) |
| 21299 | ✗ | doit = false; | |
| 21300 | } | ||
| 21301 | 559 | } | |
| 21302 | else | ||
| 21303 | { | ||
| 21304 |
2/2✓ Branch 0 taken 1705767 times.
✓ Branch 1 taken 8444 times.
|
1714211 | if(is_push_flag(f,dir)) |
| 21305 | { | ||
| 21306 | 8444 | doit=true; | |
| 21307 | 8444 | } | |
| 21308 | |||
| 21309 |
7/8✓ Branch 0 taken 1713475 times.
✓ Branch 1 taken 736 times.
✓ Branch 2 taken 1713475 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 460 times.
✓ Branch 5 taken 1713751 times.
✓ Branch 6 taken 1712956 times.
✓ Branch 7 taken 519 times.
|
3427226 | if((((f2==mfPUSHUD || f2==mfPUSHUDNS|| f2==mfPUSHUDINS) && dir<=down) || |
| 21310 |
3/4✓ Branch 0 taken 1713463 times.
✓ Branch 1 taken 288 times.
✓ Branch 2 taken 1713463 times.
✗ Branch 3 not taken.
|
1713751 | ((f2==mfPUSHLR || f2==mfPUSHLRNS|| f2==mfPUSHLRINS) && dir>=left) || |
| 21311 |
3/4✓ Branch 0 taken 1713463 times.
✓ Branch 1 taken 288 times.
✓ Branch 2 taken 1713463 times.
✗ Branch 3 not taken.
|
1713751 | ((f2==mfPUSHU || f2==mfPUSHUNS || f2==mfPUSHUINS) && dir==up) || |
| 21312 |
3/4✓ Branch 0 taken 1713149 times.
✓ Branch 1 taken 46 times.
✓ Branch 2 taken 1713149 times.
✗ Branch 3 not taken.
|
1713195 | ((f2==mfPUSHD || f2==mfPUSHDNS || f2==mfPUSHDINS) && dir==down) || |
| 21313 |
3/4✓ Branch 0 taken 1713094 times.
✓ Branch 1 taken 67 times.
✓ Branch 2 taken 1713094 times.
✗ Branch 3 not taken.
|
1713161 | ((f2==mfPUSHL || f2==mfPUSHLNS || f2==mfPUSHLINS) && dir==left) || |
| 21314 |
3/4✓ Branch 0 taken 1713088 times.
✓ Branch 1 taken 73 times.
✓ Branch 2 taken 1713088 times.
✗ Branch 3 not taken.
|
1713161 | ((f2==mfPUSHR || f2==mfPUSHRNS || f2==mfPUSHRINS) && dir==right) || |
| 21315 |
2/2✓ Branch 0 taken 1712761 times.
✓ Branch 1 taken 254 times.
|
1713475 | f2==mfPUSH4 || f2==mfPUSH4NS || f2==mfPUSH4INS)&&(f!=mfPUSHED)) |
| 21316 | { | ||
| 21317 | 519 | changecombo=true; | |
| 21318 | 519 | doit=true; | |
| 21319 | 519 | } | |
| 21320 | } | ||
| 21321 | |||
| 21322 |
2/2✓ Branch 0 taken 881423 times.
✓ Branch 1 taken 832611 times.
|
1714034 | if(get_qr(qr_SOLIDBLK)) |
| 21323 | { | ||
| 21324 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 242331 times.
✓ Branch 2 taken 202855 times.
✓ Branch 3 taken 169198 times.
✓ Branch 4 taken 218227 times.
|
832611 | switch(blockdir) |
| 21325 | { | ||
| 21326 | case up: | ||
| 21327 |
7/10✗ Branch 0 not taken.
✓ Branch 1 taken 242331 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 242331 times.
✓ Branch 4 taken 144460 times.
✓ Branch 5 taken 97871 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 97871 times.
✓ Branch 8 taken 144468 times.
✓ Branch 9 taken 97863 times.
|
242331 | if(_walkflag(bx,by-8,2,SWITCHBLOCK_STATE)&&!(MAPFLAG2(lyr-1,bx,by-8)==mfBLOCKHOLE||MAPCOMBOFLAG2(lyr-1,bx,by-8)==mfBLOCKHOLE)) doit=false; |
| 21328 | |||
| 21329 | 242331 | break; | |
| 21330 | |||
| 21331 | case down: | ||
| 21332 |
7/10✗ Branch 0 not taken.
✓ Branch 1 taken 202855 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 202855 times.
✓ Branch 4 taken 111197 times.
✓ Branch 5 taken 91658 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 91658 times.
✓ Branch 8 taken 111207 times.
✓ Branch 9 taken 91648 times.
|
202855 | if(_walkflag(bx,by+24,2,SWITCHBLOCK_STATE)&&!(MAPFLAG2(lyr-1,bx,by+24)==mfBLOCKHOLE||MAPCOMBOFLAG2(lyr-1,bx,by+24)==mfBLOCKHOLE)) doit=false; |
| 21333 | |||
| 21334 | 202855 | break; | |
| 21335 | |||
| 21336 | case left: | ||
| 21337 |
7/10✗ Branch 0 not taken.
✓ Branch 1 taken 169198 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 169198 times.
✓ Branch 4 taken 75899 times.
✓ Branch 5 taken 93299 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 93299 times.
✓ Branch 8 taken 75915 times.
✓ Branch 9 taken 93283 times.
|
169198 | if(_walkflag(bx-16,by+8,2,SWITCHBLOCK_STATE)&&!(MAPFLAG2(lyr-1,bx-16,by+8)==mfBLOCKHOLE||MAPCOMBOFLAG2(lyr-1,bx-16,by+8)==mfBLOCKHOLE)) doit=false; |
| 21338 | |||
| 21339 | 169198 | break; | |
| 21340 | |||
| 21341 | case right: | ||
| 21342 |
7/10✗ Branch 0 not taken.
✓ Branch 1 taken 218227 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 218227 times.
✓ Branch 4 taken 99165 times.
✓ Branch 5 taken 119062 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 119062 times.
✓ Branch 8 taken 99212 times.
✓ Branch 9 taken 119015 times.
|
218227 | if(_walkflag(bx+16,by+8,2,SWITCHBLOCK_STATE)&&!(MAPFLAG2(lyr-1,bx+16,by+8)==mfBLOCKHOLE||MAPCOMBOFLAG2(lyr-1,bx+16,by+8)==mfBLOCKHOLE)) doit=false; |
| 21343 | |||
| 21344 | 218227 | break; | |
| 21345 | } | ||
| 21346 | 832611 | } | |
| 21347 | |||
| 21348 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 607582 times.
✓ Branch 2 taken 501116 times.
✓ Branch 3 taken 275754 times.
✓ Branch 4 taken 329582 times.
|
1714034 | switch(blockdir) |
| 21349 | { | ||
| 21350 | case up: | ||
| 21351 |
4/4✓ Branch 0 taken 606342 times.
✓ Branch 1 taken 1240 times.
✓ Branch 2 taken 340 times.
✓ Branch 3 taken 606002 times.
|
607582 | if((MAPFLAG2(lyr-1,bx,by-8)==mfNOBLOCKS||MAPCOMBOFLAG2(lyr-1,bx,by-8)==mfNOBLOCKS)) doit=false; |
| 21352 | |||
| 21353 | 607582 | break; | |
| 21354 | |||
| 21355 | case down: | ||
| 21356 |
4/4✓ Branch 0 taken 499876 times.
✓ Branch 1 taken 1240 times.
✓ Branch 2 taken 378 times.
✓ Branch 3 taken 499498 times.
|
501116 | if((MAPFLAG2(lyr-1,bx,by+24)==mfNOBLOCKS||MAPCOMBOFLAG2(lyr-1,bx,by+24)==mfNOBLOCKS)) doit=false; |
| 21357 | |||
| 21358 | 501116 | break; | |
| 21359 | |||
| 21360 | case left: | ||
| 21361 |
4/4✓ Branch 0 taken 274878 times.
✓ Branch 1 taken 876 times.
✓ Branch 2 taken 210 times.
✓ Branch 3 taken 274668 times.
|
275754 | if((MAPFLAG2(lyr-1,bx-16,by+8)==mfNOBLOCKS||MAPCOMBOFLAG2(lyr-1,bx-16,by+8)==mfNOBLOCKS)) doit=false; |
| 21362 | |||
| 21363 | 275754 | break; | |
| 21364 | |||
| 21365 | case right: | ||
| 21366 |
4/4✓ Branch 0 taken 328238 times.
✓ Branch 1 taken 1344 times.
✓ Branch 2 taken 377 times.
✓ Branch 3 taken 327861 times.
|
329582 | if((MAPFLAG2(lyr-1,bx+16,by+8)==mfNOBLOCKS||MAPCOMBOFLAG2(lyr-1,bx+16,by+8)==mfNOBLOCKS)) doit=false; |
| 21367 | |||
| 21368 | 329582 | break; | |
| 21369 | } | ||
| 21370 | |||
| 21371 |
2/2✓ Branch 0 taken 1709312 times.
✓ Branch 1 taken 4722 times.
|
1714034 | if(doit) |
| 21372 | { | ||
| 21373 |
2/2✓ Branch 0 taken 4669 times.
✓ Branch 1 taken 53 times.
|
4722 | if(limitedpush) |
| 21374 | 53 | ++usecounts[itemid]; | |
| 21375 | |||
| 21376 | // for(int32_t i=0; i<1; i++) | ||
| 21377 |
2/2✓ Branch 0 taken 657 times.
✓ Branch 1 taken 4065 times.
|
4722 | if(!mblock2.active()) |
| 21378 | { | ||
| 21379 |
2/2✓ Branch 0 taken 463 times.
✓ Branch 1 taken 3602 times.
|
4065 | if(is_push_flag(f,dir)) |
| 21380 | { | ||
| 21381 | 3602 | m->sflag[combopos]=0; | |
| 21382 | 3602 | } | |
| 21383 | |||
| 21384 | 4065 | mblock2.blockLayer = lyr; | |
| 21385 | |||
| 21386 |
2/2✓ Branch 0 taken 205 times.
✓ Branch 1 taken 3860 times.
|
4065 | if(t == cPUSHBLOCK) |
| 21387 | { | ||
| 21388 | 205 | zfix blockstep = 0.5; | |
| 21389 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 205 times.
|
205 | if(cmb.attrishorts[0] > 0) |
| 21390 | 205 | blockstep = zslongToFix(cmb.attrishorts[0]*100); | |
| 21391 | 205 | mblock2.push_new(zfix(bx),zfix(by),blockdir,f,blockstep); | |
| 21392 | 205 | mblock2.blockinfo = cpinfo; | |
| 21393 | 205 | mblock2.blockinfo.push(blockdir, cmb.usrflags&cflag8); | |
| 21394 | 205 | cpinfo.clearInfo(); | |
| 21395 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 205 times.
|
205 | if(cmb.attribytes[1]) |
| 21396 | 205 | sfx(cmb.attribytes[1],(int32_t)x); | |
| 21397 | 205 | } | |
| 21398 | else | ||
| 21399 | { | ||
| 21400 | 3860 | mblock2.push((zfix)bx,(zfix)by,blockdir,f); | |
| 21401 | |||
| 21402 |
2/2✓ Branch 0 taken 1052 times.
✓ Branch 1 taken 2808 times.
|
3860 | if(get_qr(qr_MORESOUNDS)) |
| 21403 | 1052 | sfx(WAV_ZN1PUSHBLOCK,(int32_t)x); | |
| 21404 | } | ||
| 21405 | 4065 | } | |
| 21406 | 4722 | break; | |
| 21407 | } | ||
| 21408 | 1709312 | } | |
| 21409 | 14128548 | } | |
| 21410 | |||
| 21411 | 847 | bool usekey() | |
| 21412 | { | ||
| 21413 | 847 | int32_t itemid = current_item_id(itype_magickey); | |
| 21414 | |||
| 21415 |
3/4✓ Branch 0 taken 787 times.
✓ Branch 1 taken 60 times.
✓ Branch 2 taken 60 times.
✗ Branch 3 not taken.
|
847 | if(itemid<0 || |
| 21416 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 60 times.
|
60 | (itemsbuf[itemid].flags & item_flag1 ? itemsbuf[itemid].power<dlevel |
| 21417 | ✗ | : itemsbuf[itemid].power!=dlevel)) | |
| 21418 | { | ||
| 21419 |
2/2✓ Branch 0 taken 119 times.
✓ Branch 1 taken 668 times.
|
787 | if(game->lvlkeys[dlevel]!=0) |
| 21420 | { | ||
| 21421 | 119 | game->lvlkeys[dlevel]--; | |
| 21422 | //run script for level key item | ||
| 21423 | 119 | int32_t key_item = 0; //current_item_id(itype_lkey); //not possible | |
| 21424 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9065 times.
|
9065 | for ( int32_t q = 0; q < MAXITEMS; ++q ) |
| 21425 | { | ||
| 21426 |
2/2✓ Branch 0 taken 8946 times.
✓ Branch 1 taken 119 times.
|
9065 | if ( itemsbuf[q].family == itype_lkey ) |
| 21427 | { | ||
| 21428 | 119 | key_item = q; break; | |
| 21429 | } | ||
| 21430 | 8946 | } | |
| 21431 | |||
| 21432 |
2/8✓ Branch 0 taken 119 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 119 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
119 | if ( key_item > 0 && itemsbuf[key_item].script && !(FFCore.doscript(ScriptType::Item, key_item) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING)) ) |
| 21433 | { | ||
| 21434 | ✗ | int i = key_item; | |
| 21435 | ✗ | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 21436 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[i].script, i); | |
| 21437 | ✗ | FFCore.deallocateAllScriptOwned(ScriptType::Item,(key_item)); | |
| 21438 | ✗ | } | |
| 21439 | 119 | return true; | |
| 21440 | } | ||
| 21441 | else | ||
| 21442 | { | ||
| 21443 |
2/2✓ Branch 0 taken 336 times.
✓ Branch 1 taken 332 times.
|
668 | if(game->get_keys()==0) |
| 21444 | { | ||
| 21445 | 332 | return false; | |
| 21446 | } | ||
| 21447 | else | ||
| 21448 | { | ||
| 21449 | //run script for key item | ||
| 21450 | 336 | int32_t key_item = 0; //current_item_id(itype_key); //not possible | |
| 21451 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3360 times.
|
3360 | for ( int32_t q = 0; q < MAXITEMS; ++q ) |
| 21452 | { | ||
| 21453 |
2/2✓ Branch 0 taken 3024 times.
✓ Branch 1 taken 336 times.
|
3360 | if ( itemsbuf[q].family == itype_key ) |
| 21454 | { | ||
| 21455 | 336 | key_item = q; break; | |
| 21456 | } | ||
| 21457 | 3024 | } | |
| 21458 |
2/8✓ Branch 0 taken 336 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 336 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
336 | if ( key_item > 0 && itemsbuf[key_item].script && !(FFCore.doscript(ScriptType::Item, key_item) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING)) ) |
| 21459 | { | ||
| 21460 | ✗ | int i = key_item; | |
| 21461 | ✗ | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 21462 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[i].script, i); | |
| 21463 | ✗ | FFCore.deallocateAllScriptOwned(ScriptType::Item,(key_item)); | |
| 21464 | ✗ | } | |
| 21465 | 336 | game->change_keys(-1); | |
| 21466 | } | ||
| 21467 | } | ||
| 21468 | 336 | } | |
| 21469 | |||
| 21470 | 396 | return true; | |
| 21471 | 847 | } | |
| 21472 | |||
| 21473 | 11 | bool canUseKey(int32_t num) | |
| 21474 | { | ||
| 21475 | 11 | int32_t itemid = current_item_id(itype_magickey); | |
| 21476 | |||
| 21477 |
1/4✓ Branch 0 taken 11 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
11 | if(itemid<0 || |
| 21478 | ✗ | (itemsbuf[itemid].flags & item_flag1 ? itemsbuf[itemid].power<dlevel | |
| 21479 | ✗ | : itemsbuf[itemid].power!=dlevel)) | |
| 21480 | { | ||
| 21481 | 11 | return game->lvlkeys[dlevel] + game->get_keys() >= num; | |
| 21482 | } | ||
| 21483 | |||
| 21484 | ✗ | return true; | |
| 21485 | 11 | } | |
| 21486 | |||
| 21487 | 11 | bool usekey(int32_t num) | |
| 21488 | { | ||
| 21489 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 8 times.
|
11 | if(!canUseKey(num)) return false; |
| 21490 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 8 times.
|
16 | for(auto q = 0; q < num; ++q) |
| 21491 | { | ||
| 21492 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | if(!usekey()) return false; //should never return false here, but, just to be safe.... |
| 21493 | 8 | } | |
| 21494 | 8 | return true; | |
| 21495 | 11 | } | |
| 21496 | |||
| 21497 | |||
| 21498 | 1262 | bool islockeddoor(int32_t x, int32_t y, int32_t lock) | |
| 21499 | { | ||
| 21500 | 1262 | int32_t mc = (y&0xF0)+(x>>4); | |
| 21501 |
4/6✓ Branch 0 taken 1262 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1262 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1176 times.
✓ Branch 5 taken 86 times.
|
2524 | bool ret = (((mc==7||mc==8||mc==23||mc==24) && tmpscr->door[up]==lock) |
| 21502 |
4/8✗ Branch 0 not taken.
✓ Branch 1 taken 1262 times.
✓ Branch 2 taken 1262 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1262 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1262 times.
✗ Branch 7 not taken.
|
1262 | || ((mc==151||mc==152||mc==167||mc==168) && tmpscr->door[down]==lock) |
| 21503 |
3/6✓ Branch 0 taken 1262 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1262 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1262 times.
✗ Branch 5 not taken.
|
1262 | || ((mc==64||mc==65||mc==80||mc==81) && tmpscr->door[left]==lock) |
| 21504 |
5/8✓ Branch 0 taken 1253 times.
✓ Branch 1 taken 9 times.
✓ Branch 2 taken 1253 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1253 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1253 times.
|
1262 | || ((mc==78||mc==79||mc==94||mc==95) && tmpscr->door[right]==lock)); |
| 21505 | 1262 | return ret; | |
| 21506 | } | ||
| 21507 | |||
| 21508 | 13581125 | void HeroClass::oldchecklockblock() | |
| 21509 | { | ||
| 21510 |
2/2✓ Branch 0 taken 14355 times.
✓ Branch 1 taken 13566770 times.
|
13581125 | if(toogam) return; |
| 21511 | |||
| 21512 | 13566770 | int32_t bx = x.getInt()&0xF0; | |
| 21513 | 13566770 | int32_t bx2 = int32_t(x+8)&0xF0; | |
| 21514 | 13566770 | int32_t by = y.getInt()&0xF0; | |
| 21515 | |||
| 21516 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 3356291 times.
✓ Branch 2 taken 2693583 times.
✓ Branch 3 taken 3630160 times.
✓ Branch 4 taken 3886736 times.
|
13566770 | switch(dir) |
| 21517 | { | ||
| 21518 | case up: | ||
| 21519 |
4/4✓ Branch 0 taken 581547 times.
✓ Branch 1 taken 2774744 times.
✓ Branch 2 taken 11800 times.
✓ Branch 3 taken 569747 times.
|
3356291 | if(!((int32_t)y&15)&&y!=0) by-=bigHitbox ? 16 : 0; |
| 21520 | |||
| 21521 | 3356291 | break; | |
| 21522 | |||
| 21523 | case down: | ||
| 21524 | 2693583 | by+=16; | |
| 21525 | 2693583 | break; | |
| 21526 | |||
| 21527 | case left: | ||
| 21528 |
2/2✓ Branch 0 taken 1602869 times.
✓ Branch 1 taken 2027291 times.
|
3630160 | if((((int32_t)x)&0x0F)<8) |
| 21529 | 2027291 | bx-=16; | |
| 21530 | |||
| 21531 |
2/2✓ Branch 0 taken 2223695 times.
✓ Branch 1 taken 1406465 times.
|
3630160 | if(y.getInt()&8) |
| 21532 | { | ||
| 21533 | 1406465 | by+=16; | |
| 21534 | 1406465 | } | |
| 21535 | |||
| 21536 | 3630160 | bx2=bx; | |
| 21537 | 3630160 | break; | |
| 21538 | |||
| 21539 | case right: | ||
| 21540 | 3886736 | bx+=16; | |
| 21541 | |||
| 21542 |
2/2✓ Branch 0 taken 2390832 times.
✓ Branch 1 taken 1495904 times.
|
3886736 | if(y.getInt()&8) |
| 21543 | { | ||
| 21544 | 1495904 | by+=16; | |
| 21545 | 1495904 | } | |
| 21546 | |||
| 21547 | 3886736 | bx2=bx; | |
| 21548 | 3886736 | break; | |
| 21549 | } | ||
| 21550 | |||
| 21551 | 13566770 | bool found1=false; | |
| 21552 | 13566770 | bool found2=false; | |
| 21553 | 13566770 | int32_t foundlayer = -1; | |
| 21554 | 13566770 | int32_t cid1 = MAPCOMBO(bx, by), cid2 = MAPCOMBO(bx2, by); | |
| 21555 | 13566770 | newcombo const& cmb = combobuf[cid1]; | |
| 21556 | 13566770 | newcombo const& cmb2 = combobuf[cid2]; | |
| 21557 |
4/6✓ Branch 0 taken 2512 times.
✓ Branch 1 taken 13564258 times.
✓ Branch 2 taken 2512 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2512 times.
|
13566770 | if((cmb.type==cLOCKBLOCK && !(cmb.triggerflags[0] & combotriggerONLYGENTRIG) && _effectflag(bx,by,1, -1))) |
| 21558 | { | ||
| 21559 | // Context: https://discord.com/channels/876899628556091432/1278165595321405554 | ||
| 21560 | // Layer 0 is overridden by Locked Doors (but only for dungeons) - in that case, checklocked will clear these combos | ||
| 21561 |
2/2✓ Branch 0 taken 1593 times.
✓ Branch 1 taken 919 times.
|
2512 | bool ignore_layer_0 = isdungeon() && islockeddoor(bx,by,dLOCKED); |
| 21562 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2512 times.
|
2512 | if (!ignore_layer_0) |
| 21563 | { | ||
| 21564 | 2512 | found1=true; | |
| 21565 | 2512 | foundlayer = 0; | |
| 21566 | 2512 | } | |
| 21567 | 2512 | } | |
| 21568 |
4/6✓ Branch 0 taken 205 times.
✓ Branch 1 taken 13564053 times.
✓ Branch 2 taken 205 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 205 times.
|
13564258 | else if (cmb2.type==cLOCKBLOCK && !(cmb2.triggerflags[0] & combotriggerONLYGENTRIG) && _effectflag(bx2,by,1, -1)) |
| 21569 | { | ||
| 21570 |
1/2✓ Branch 0 taken 205 times.
✗ Branch 1 not taken.
|
205 | bool ignore_layer_0 = isdungeon() && islockeddoor(bx2,by,dLOCKED); |
| 21571 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 205 times.
|
205 | if (!ignore_layer_0) |
| 21572 | { | ||
| 21573 | 205 | found2=true; | |
| 21574 | 205 | foundlayer = 0; | |
| 21575 | 205 | } | |
| 21576 | 205 | } | |
| 21577 | |||
| 21578 |
2/2✓ Branch 0 taken 27133540 times.
✓ Branch 1 taken 13566770 times.
|
40700310 | for (int32_t i = 0; i <= 1; ++i) |
| 21579 | { | ||
| 21580 |
2/2✓ Branch 0 taken 20053641 times.
✓ Branch 1 taken 7079899 times.
|
27133540 | if(tmpscr2[i].valid!=0) |
| 21581 | { | ||
| 21582 |
2/2✓ Branch 0 taken 6719162 times.
✓ Branch 1 taken 360737 times.
|
7079899 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 21583 | { | ||
| 21584 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 6719162 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
6719162 | if (combobuf[MAPCOMBO2(i,bx,by)].type == cBRIDGE && !_walkflag_layer(bx,by,1, &(tmpscr2[i]))) found1 = false; |
| 21585 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 6719162 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
6719162 | if (combobuf[MAPCOMBO2(i,bx2,by)].type == cBRIDGE && !_walkflag_layer(bx2,by,1, &(tmpscr2[i]))) found2 = false; |
| 21586 | 6719162 | } | |
| 21587 | else | ||
| 21588 | { | ||
| 21589 |
3/4✓ Branch 0 taken 1365 times.
✓ Branch 1 taken 359372 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1365 times.
|
360737 | if (combobuf[MAPCOMBO2(i,bx,by)].type == cBRIDGE && _effectflag_layer(bx,by,1, &(tmpscr2[i]))) found1 = false; |
| 21590 |
3/4✓ Branch 0 taken 1365 times.
✓ Branch 1 taken 359372 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1365 times.
|
360737 | if (combobuf[MAPCOMBO2(i,bx2,by)].type == cBRIDGE && _effectflag_layer(bx2,by,1, &(tmpscr2[i]))) found2 = false; |
| 21591 | } | ||
| 21592 | 7079899 | } | |
| 21593 | 27133540 | } | |
| 21594 | |||
| 21595 | |||
| 21596 | // Layers | ||
| 21597 |
4/4✓ Branch 0 taken 13564258 times.
✓ Branch 1 taken 2512 times.
✓ Branch 2 taken 205 times.
✓ Branch 3 taken 13564053 times.
|
13566770 | if(!(found1 || found2)) |
| 21598 | { | ||
| 21599 | 13564053 | foundlayer = -1; | |
| 21600 |
2/2✓ Branch 0 taken 13563968 times.
✓ Branch 1 taken 27128072 times.
|
40692040 | for(int32_t i=0; i<2; i++) |
| 21601 | { | ||
| 21602 | 27128072 | cid1 = MAPCOMBO2(i, bx, by); | |
| 21603 | 27128072 | cid2 = MAPCOMBO2(i, bx2, by); | |
| 21604 | 27128072 | newcombo const& cmb = combobuf[cid1]; | |
| 21605 | 27128072 | newcombo const& cmb2 = combobuf[cid2]; | |
| 21606 |
2/2✓ Branch 0 taken 13564019 times.
✓ Branch 1 taken 13564053 times.
|
27128072 | if (i == 0) |
| 21607 | { | ||
| 21608 |
2/2✓ Branch 0 taken 11685217 times.
✓ Branch 1 taken 1878836 times.
|
13564053 | if(tmpscr2[1].valid!=0) |
| 21609 | { | ||
| 21610 |
2/2✓ Branch 0 taken 1756772 times.
✓ Branch 1 taken 122064 times.
|
1878836 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 21611 | { | ||
| 21612 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1756772 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1756772 | if (combobuf[cid1].type == cBRIDGE && !_walkflag_layer(bx,by,1, &(tmpscr2[1]))) continue; //Continue, because It didn't find any on layer 0, and if you're checking |
| 21613 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1756772 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1756772 | if (combobuf[cid2].type == cBRIDGE && !_walkflag_layer(bx2,by,1, &(tmpscr2[1]))) continue; //layer 1 and there's a bridge on layer 2, stop checking layer 1. |
| 21614 | 1756772 | } | |
| 21615 | else | ||
| 21616 | { | ||
| 21617 |
3/4✓ Branch 0 taken 452 times.
✓ Branch 1 taken 121612 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 452 times.
|
122064 | if (combobuf[cid1].type == cBRIDGE && _effectflag_layer(bx,by,1, &(tmpscr2[1]))) continue; |
| 21618 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 121612 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
121612 | if (combobuf[cid2].type == cBRIDGE && _effectflag_layer(bx2,by,1, &(tmpscr2[1]))) continue; |
| 21619 | } | ||
| 21620 | 1878384 | } | |
| 21621 | 13563601 | } | |
| 21622 |
4/6✓ Branch 0 taken 82 times.
✓ Branch 1 taken 27127538 times.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 82 times.
|
27127620 | if(cmb.type==cLOCKBLOCK && !(cmb.triggerflags[0] & combotriggerONLYGENTRIG) && _effectflag(bx,by,1, i)) |
| 21623 | { | ||
| 21624 | 82 | found1=true; | |
| 21625 | 82 | foundlayer = i+1; | |
| 21626 | 82 | break; | |
| 21627 | } | ||
| 21628 |
4/6✓ Branch 0 taken 3 times.
✓ Branch 1 taken 27127535 times.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 3 times.
|
27127538 | else if(cmb2.type==cLOCKBLOCK && !(cmb2.triggerflags[0] & combotriggerONLYGENTRIG) && _effectflag(bx2,by,1, i)) |
| 21629 | { | ||
| 21630 | 3 | found2=true; | |
| 21631 | 3 | foundlayer = i+1; | |
| 21632 | 3 | break; | |
| 21633 | } | ||
| 21634 | 27127535 | } | |
| 21635 | 13564053 | } | |
| 21636 | |||
| 21637 |
4/4✓ Branch 0 taken 13564176 times.
✓ Branch 1 taken 2594 times.
✓ Branch 2 taken 13566370 times.
✓ Branch 3 taken 400 times.
|
13566770 | if(!(found1 || found2) || pushing<8) |
| 21638 | { | ||
| 21639 | 13566370 | return; | |
| 21640 | } | ||
| 21641 |
2/2✓ Branch 0 taken 349 times.
✓ Branch 1 taken 51 times.
|
400 | newcombo const& cmb3 = combobuf[found1 ? cid1 : cid2]; |
| 21642 |
2/2✓ Branch 0 taken 138 times.
✓ Branch 1 taken 262 times.
|
400 | if(!try_locked_combo(cmb3)) |
| 21643 | 262 | return; | |
| 21644 | |||
| 21645 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 138 times.
|
138 | if(cmb.usrflags&cflag16) |
| 21646 | { | ||
| 21647 | ✗ | setxmapflag(1<<cmb.attribytes[5]); | |
| 21648 | ✗ | remove_xstatecombos((currscr>=128)?1:0, 1<<cmb.attribytes[5]); | |
| 21649 | ✗ | } | |
| 21650 | else | ||
| 21651 | { | ||
| 21652 | 138 | setmapflag(mLOCKBLOCK); | |
| 21653 | 138 | remove_lockblocks((currscr>=128)?1:0); | |
| 21654 | } | ||
| 21655 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 138 times.
|
138 | if ( cmb3.usrflags&cflag3 ) |
| 21656 | { | ||
| 21657 | ✗ | if ( (cmb3.attribytes[3]) ) | |
| 21658 | ✗ | sfx(cmb3.attribytes[3]); | |
| 21659 | ✗ | } | |
| 21660 | 138 | else sfx(WAV_DOOR); | |
| 21661 | 13581125 | } | |
| 21662 | |||
| 21663 | 13581125 | void HeroClass::oldcheckbosslockblock() | |
| 21664 | { | ||
| 21665 |
2/2✓ Branch 0 taken 14355 times.
✓ Branch 1 taken 13566770 times.
|
13581125 | if(toogam) return; |
| 21666 | |||
| 21667 | 13566770 | int32_t bx = x.getInt()&0xF0; | |
| 21668 | 13566770 | int32_t bx2 = int32_t(x+8)&0xF0; | |
| 21669 | 13566770 | int32_t by = y.getInt()&0xF0; | |
| 21670 | |||
| 21671 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 3356291 times.
✓ Branch 2 taken 2693583 times.
✓ Branch 3 taken 3630160 times.
✓ Branch 4 taken 3886736 times.
|
13566770 | switch(dir) |
| 21672 | { | ||
| 21673 | case up: | ||
| 21674 |
4/4✓ Branch 0 taken 581547 times.
✓ Branch 1 taken 2774744 times.
✓ Branch 2 taken 11800 times.
✓ Branch 3 taken 569747 times.
|
3356291 | if(!((int32_t)y&15)&&y!=0) by-=bigHitbox ? 16 : 0; |
| 21675 | |||
| 21676 | 3356291 | break; | |
| 21677 | |||
| 21678 | case down: | ||
| 21679 | 2693583 | by+=16; | |
| 21680 | 2693583 | break; | |
| 21681 | |||
| 21682 | case left: | ||
| 21683 |
2/2✓ Branch 0 taken 1602869 times.
✓ Branch 1 taken 2027291 times.
|
3630160 | if((((int32_t)x)&0x0F)<8) |
| 21684 | 2027291 | bx-=16; | |
| 21685 | |||
| 21686 |
2/2✓ Branch 0 taken 2223695 times.
✓ Branch 1 taken 1406465 times.
|
3630160 | if(y.getInt()&8) |
| 21687 | { | ||
| 21688 | 1406465 | by+=16; | |
| 21689 | 1406465 | } | |
| 21690 | |||
| 21691 | 3630160 | bx2=bx; | |
| 21692 | 3630160 | break; | |
| 21693 | |||
| 21694 | case right: | ||
| 21695 | 3886736 | bx+=16; | |
| 21696 | |||
| 21697 |
2/2✓ Branch 0 taken 2390832 times.
✓ Branch 1 taken 1495904 times.
|
3886736 | if(y.getInt()&8) |
| 21698 | { | ||
| 21699 | 1495904 | by+=16; | |
| 21700 | 1495904 | } | |
| 21701 | |||
| 21702 | 3886736 | bx2=bx; | |
| 21703 | 3886736 | break; | |
| 21704 | } | ||
| 21705 | |||
| 21706 | |||
| 21707 | 13566770 | bool found1 = false; | |
| 21708 | 13566770 | bool found2 = false; | |
| 21709 | 13566770 | int32_t foundlayer = -1; | |
| 21710 | 13566770 | int32_t cid1 = MAPCOMBO(bx, by), cid2 = MAPCOMBO(bx2, by); | |
| 21711 | 13566770 | newcombo const& cmb = combobuf[cid1]; | |
| 21712 | 13566770 | newcombo const& cmb2 = combobuf[cid2]; | |
| 21713 | |||
| 21714 |
4/6✓ Branch 0 taken 1327 times.
✓ Branch 1 taken 13565443 times.
✓ Branch 2 taken 1327 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1327 times.
|
13566770 | if((cmb.type==cBOSSLOCKBLOCK && !(cmb.triggerflags[0] & combotriggerONLYGENTRIG) && _effectflag(bx,by,1, -1))) |
| 21715 | { | ||
| 21716 | // Context: https://discord.com/channels/876899628556091432/1278165595321405554 | ||
| 21717 | // Layer 0 is overridden by Locked Doors (but only for dungeons) - in that case, checklocked will clear these combos | ||
| 21718 |
2/2✓ Branch 0 taken 1006 times.
✓ Branch 1 taken 321 times.
|
1327 | bool ignore_layer_0 = isdungeon() && islockeddoor(bx,by,dBOSS); |
| 21719 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1327 times.
|
1327 | if (!ignore_layer_0) |
| 21720 | { | ||
| 21721 | 1327 | found1=true; | |
| 21722 | 1327 | foundlayer = 0; | |
| 21723 | 1327 | } | |
| 21724 | 1327 | } | |
| 21725 |
4/6✓ Branch 0 taken 31 times.
✓ Branch 1 taken 13565412 times.
✓ Branch 2 taken 31 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 31 times.
|
13565443 | else if (cmb2.type==cBOSSLOCKBLOCK && !(cmb2.triggerflags[0] & combotriggerONLYGENTRIG) && _effectflag(bx2,by,1, -1)) |
| 21726 | { | ||
| 21727 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 22 times.
|
31 | bool ignore_layer_0 = isdungeon() && islockeddoor(bx2,by,dBOSS); |
| 21728 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 31 times.
|
31 | if (!ignore_layer_0) |
| 21729 | { | ||
| 21730 | 31 | found2=true; | |
| 21731 | 31 | foundlayer = 0; | |
| 21732 | 31 | } | |
| 21733 | 31 | } | |
| 21734 | |||
| 21735 |
2/2✓ Branch 0 taken 27133540 times.
✓ Branch 1 taken 13566770 times.
|
40700310 | for (int32_t i = 0; i <= 1; ++i) |
| 21736 | { | ||
| 21737 |
2/2✓ Branch 0 taken 20053641 times.
✓ Branch 1 taken 7079899 times.
|
27133540 | if (tmpscr2[i].valid != 0) |
| 21738 | { | ||
| 21739 |
2/2✓ Branch 0 taken 6719162 times.
✓ Branch 1 taken 360737 times.
|
7079899 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 21740 | { | ||
| 21741 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 6719162 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
6719162 | if (combobuf[MAPCOMBO2(i, bx, by)].type == cBRIDGE && !_walkflag_layer(bx, by, 1, &(tmpscr2[i]))) found1 = false; |
| 21742 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 6719162 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
6719162 | if (combobuf[MAPCOMBO2(i, bx2, by)].type == cBRIDGE && !_walkflag_layer(bx2, by, 1, &(tmpscr2[i]))) found2 = false; |
| 21743 | 6719162 | } | |
| 21744 | else | ||
| 21745 | { | ||
| 21746 |
3/4✓ Branch 0 taken 1365 times.
✓ Branch 1 taken 359372 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1365 times.
|
360737 | if (combobuf[MAPCOMBO2(i, bx, by)].type == cBRIDGE && _effectflag_layer(bx, by, 1, &(tmpscr2[i]))) found1 = false; |
| 21747 |
3/4✓ Branch 0 taken 1365 times.
✓ Branch 1 taken 359372 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1365 times.
|
360737 | if (combobuf[MAPCOMBO2(i, bx2, by)].type == cBRIDGE && _effectflag_layer(bx2, by, 1, &(tmpscr2[i]))) found2 = false; |
| 21748 | } | ||
| 21749 | 7079899 | } | |
| 21750 | 27133540 | } | |
| 21751 | |||
| 21752 | |||
| 21753 | // Layers | ||
| 21754 |
4/4✓ Branch 0 taken 13565443 times.
✓ Branch 1 taken 1327 times.
✓ Branch 2 taken 31 times.
✓ Branch 3 taken 13565412 times.
|
13566770 | if (!(found1 || found2)) |
| 21755 | { | ||
| 21756 | 13565412 | foundlayer = -1; | |
| 21757 |
2/2✓ Branch 0 taken 13565412 times.
✓ Branch 1 taken 27130824 times.
|
40696236 | for (int32_t i = 0; i < 2; i++) |
| 21758 | { | ||
| 21759 | 27130824 | cid1 = MAPCOMBO2(i, bx, by); | |
| 21760 | 27130824 | cid2 = MAPCOMBO2(i, bx2, by); | |
| 21761 | 27130824 | newcombo const& cmb = combobuf[cid1]; | |
| 21762 | 27130824 | newcombo const& cmb2 = combobuf[cid2]; | |
| 21763 |
2/2✓ Branch 0 taken 13565412 times.
✓ Branch 1 taken 13565412 times.
|
27130824 | if (i == 0) |
| 21764 | { | ||
| 21765 |
2/2✓ Branch 0 taken 11686224 times.
✓ Branch 1 taken 1879188 times.
|
13565412 | if (tmpscr2[1].valid != 0) |
| 21766 | { | ||
| 21767 |
2/2✓ Branch 0 taken 1757060 times.
✓ Branch 1 taken 122128 times.
|
1879188 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 21768 | { | ||
| 21769 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1757060 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1757060 | if (combobuf[cid1].type == cBRIDGE && !_walkflag_layer(bx, by, 1, &(tmpscr2[1]))) continue; |
| 21770 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1757060 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1757060 | if (combobuf[cid2].type == cBRIDGE && !_walkflag_layer(bx2, by, 1, &(tmpscr2[1]))) continue; |
| 21771 | 1757060 | } | |
| 21772 | else | ||
| 21773 | { | ||
| 21774 |
3/4✓ Branch 0 taken 452 times.
✓ Branch 1 taken 121676 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 452 times.
|
122128 | if (combobuf[cid1].type == cBRIDGE && _effectflag_layer(bx, by, 1, &(tmpscr2[1]))) continue; |
| 21775 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 121676 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
121676 | if (combobuf[cid2].type == cBRIDGE && _effectflag_layer(bx2, by, 1, &(tmpscr2[1]))) continue; |
| 21776 | } | ||
| 21777 | 1878736 | } | |
| 21778 | 13564960 | } | |
| 21779 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 27130372 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
27130372 | if (cmb.type == cBOSSLOCKBLOCK && !(cmb.triggerflags[0] & combotriggerONLYGENTRIG) && _effectflag(bx, by, 1, i)) |
| 21780 | { | ||
| 21781 | ✗ | found1 = true; | |
| 21782 | ✗ | foundlayer = i; | |
| 21783 | ✗ | break; | |
| 21784 | } | ||
| 21785 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 27130372 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
27130372 | else if (cmb2.type == cBOSSLOCKBLOCK && !(cmb2.triggerflags[0] & combotriggerONLYGENTRIG) && _effectflag(bx2, by, 1, i)) |
| 21786 | { | ||
| 21787 | ✗ | found2 = true; | |
| 21788 | ✗ | foundlayer = i; | |
| 21789 | ✗ | break; | |
| 21790 | } | ||
| 21791 | 27130372 | } | |
| 21792 | 13565412 | } | |
| 21793 | |||
| 21794 |
4/4✓ Branch 0 taken 13565443 times.
✓ Branch 1 taken 1327 times.
✓ Branch 2 taken 13566299 times.
✓ Branch 3 taken 471 times.
|
13566770 | if (!(found1 || found2) || pushing < 8) |
| 21795 | { | ||
| 21796 | 13566299 | return; | |
| 21797 | } | ||
| 21798 |
2/2✓ Branch 0 taken 468 times.
✓ Branch 1 taken 3 times.
|
471 | int32_t cid = found1 ? cid1 : cid2; |
| 21799 | |||
| 21800 |
2/2✓ Branch 0 taken 35 times.
✓ Branch 1 taken 436 times.
|
471 | if(!(game->lvlitems[dlevel]&liBOSSKEY)) return; |
| 21801 | |||
| 21802 | |||
| 21803 | // Run Boss Key Script | ||
| 21804 | 35 | int32_t key_item = 0; //current_item_id(itype_bosskey); //not possible | |
| 21805 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2380 times.
|
2380 | for ( int32_t q = 0; q < MAXITEMS; ++q ) |
| 21806 | { | ||
| 21807 |
2/2✓ Branch 0 taken 2345 times.
✓ Branch 1 taken 35 times.
|
2380 | if ( itemsbuf[q].family == itype_bosskey ) |
| 21808 | { | ||
| 21809 | 35 | key_item = q; break; | |
| 21810 | } | ||
| 21811 | 2345 | } | |
| 21812 |
2/8✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 35 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
35 | if ( key_item > 0 && itemsbuf[key_item].script && !(FFCore.doscript(ScriptType::Item, key_item) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING)) ) |
| 21813 | { | ||
| 21814 | ✗ | int i = key_item; | |
| 21815 | ✗ | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 21816 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[i].script, i); | |
| 21817 | ✗ | FFCore.deallocateAllScriptOwned(ScriptType::Item,(key_item)); | |
| 21818 | ✗ | } | |
| 21819 | |||
| 21820 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 35 times.
|
35 | if(cmb.usrflags&cflag16) |
| 21821 | { | ||
| 21822 | ✗ | setxmapflag(1<<cmb.attribytes[5]); | |
| 21823 | ✗ | remove_xstatecombos((currscr>=128)?1:0, 1<<cmb.attribytes[5]); | |
| 21824 | ✗ | } | |
| 21825 | else | ||
| 21826 | { | ||
| 21827 | 35 | setmapflag(mBOSSLOCKBLOCK); | |
| 21828 | 35 | remove_bosslockblocks((currscr>=128)?1:0); | |
| 21829 | } | ||
| 21830 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 35 times.
|
35 | if ( (combobuf[cid].attribytes[3]) ) |
| 21831 | 35 | sfx(combobuf[cid].attribytes[3]); | |
| 21832 | 13581125 | } | |
| 21833 | |||
| 21834 | 39433320 | void HeroClass::oldcheckchest(int32_t type) | |
| 21835 | { | ||
| 21836 | // chests aren't affected by tmpscr->flags2&fAIRCOMBOS | ||
| 21837 |
5/6✓ Branch 0 taken 39393102 times.
✓ Branch 1 taken 40218 times.
✓ Branch 2 taken 39352353 times.
✓ Branch 3 taken 40749 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 39352353 times.
|
39433320 | if(toogam || z>0 || fakez > 0) return; |
| 21838 |
2/2✓ Branch 0 taken 37749786 times.
✓ Branch 1 taken 1602567 times.
|
39352353 | if(pushing<8) return; |
| 21839 | 1602567 | int32_t bx = x.getInt()&0xF0; | |
| 21840 | 1602567 | int32_t bx2 = int32_t(x+8)&0xF0; | |
| 21841 | 1602567 | int32_t by = y.getInt()&0xF0; | |
| 21842 | |||
| 21843 |
3/4✓ Branch 0 taken 867771 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 339834 times.
✓ Branch 3 taken 394962 times.
|
1602567 | switch(dir) |
| 21844 | { | ||
| 21845 | case up: | ||
| 21846 |
2/2✓ Branch 0 taken 40752 times.
✓ Branch 1 taken 354210 times.
|
394962 | if(isSideViewHero()) return; |
| 21847 | |||
| 21848 |
4/4✓ Branch 0 taken 81006 times.
✓ Branch 1 taken 273204 times.
✓ Branch 2 taken 78609 times.
✓ Branch 3 taken 2397 times.
|
354210 | if(!((int32_t)y&15)&&y!=0) by-=bigHitbox ? 16 : 0; |
| 21849 | |||
| 21850 | 354210 | break; | |
| 21851 | |||
| 21852 | case left: | ||
| 21853 | case right: | ||
| 21854 |
2/2✓ Branch 0 taken 16173 times.
✓ Branch 1 taken 851598 times.
|
867771 | if(isSideViewHero()) break; |
| 21855 | [[fallthrough]]; | ||
| 21856 | case down: | ||
| 21857 | 1191432 | return; | |
| 21858 | } | ||
| 21859 | |||
| 21860 | 370383 | bool found=false; | |
| 21861 | 370383 | bool itemflag=false; | |
| 21862 | |||
| 21863 |
3/4✓ Branch 0 taken 137 times.
✓ Branch 1 taken 370246 times.
✓ Branch 2 taken 137 times.
✗ Branch 3 not taken.
|
370418 | if((combobuf[MAPCOMBO(bx,by)].type==type && _effectflag(bx,by,1, -1))|| |
| 21864 |
2/2✓ Branch 0 taken 35 times.
✓ Branch 1 taken 370211 times.
|
370246 | (combobuf[MAPCOMBO(bx2,by)].type==type && _effectflag(bx2,by,1, -1))) |
| 21865 | { | ||
| 21866 | 172 | found=true; | |
| 21867 | 172 | } | |
| 21868 |
2/2✓ Branch 0 taken 740766 times.
✓ Branch 1 taken 370383 times.
|
1111149 | for (int32_t i = 0; i <= 1; ++i) |
| 21869 | { | ||
| 21870 |
2/2✓ Branch 0 taken 571848 times.
✓ Branch 1 taken 168918 times.
|
740766 | if(tmpscr2[i].valid!=0) |
| 21871 | { | ||
| 21872 |
2/2✓ Branch 0 taken 168057 times.
✓ Branch 1 taken 861 times.
|
168918 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 21873 | { | ||
| 21874 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 168057 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
168057 | if (combobuf[MAPCOMBO2(i,bx,by)].type == cBRIDGE && !_walkflag_layer(bx,by,1, &(tmpscr2[i]))) found = false; |
| 21875 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 168057 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
168057 | if (combobuf[MAPCOMBO2(i,bx2,by)].type == cBRIDGE && !_walkflag_layer(bx2,by,1, &(tmpscr2[i]))) found = false; |
| 21876 | 168057 | } | |
| 21877 | else | ||
| 21878 | { | ||
| 21879 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 861 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
861 | if (combobuf[MAPCOMBO2(i,bx,by)].type == cBRIDGE && _effectflag_layer(bx,by,1, &(tmpscr2[i]))) found = false; |
| 21880 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 861 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
861 | if (combobuf[MAPCOMBO2(i,bx2,by)].type == cBRIDGE && _effectflag_layer(bx2,by,1, &(tmpscr2[i]))) found = false; |
| 21881 | } | ||
| 21882 | 168918 | } | |
| 21883 | 740766 | } | |
| 21884 | |||
| 21885 |
2/2✓ Branch 0 taken 172 times.
✓ Branch 1 taken 370211 times.
|
370383 | if(!found) |
| 21886 | { | ||
| 21887 |
2/2✓ Branch 0 taken 370211 times.
✓ Branch 1 taken 740422 times.
|
1110633 | for(int32_t i=0; i<2; i++) |
| 21888 | { | ||
| 21889 |
2/2✓ Branch 0 taken 370211 times.
✓ Branch 1 taken 370211 times.
|
740422 | if (i == 0) |
| 21890 | { | ||
| 21891 |
2/2✓ Branch 0 taken 335422 times.
✓ Branch 1 taken 34789 times.
|
370211 | if(tmpscr2[1].valid!=0) |
| 21892 | { | ||
| 21893 |
2/2✓ Branch 0 taken 34408 times.
✓ Branch 1 taken 381 times.
|
34789 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 21894 | { | ||
| 21895 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 34408 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
34408 | if (combobuf[MAPCOMBO2(1,bx,by)].type == cBRIDGE && !_walkflag_layer(bx,by,1, &(tmpscr2[1]))) continue; |
| 21896 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 34408 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
34408 | if (combobuf[MAPCOMBO2(1,bx2,by)].type == cBRIDGE && !_walkflag_layer(bx2,by,1, &(tmpscr2[1]))) continue; |
| 21897 | 34408 | } | |
| 21898 | else | ||
| 21899 | { | ||
| 21900 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 381 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
381 | if (combobuf[MAPCOMBO2(1,bx,by)].type == cBRIDGE && _effectflag_layer(bx,by,1, &(tmpscr2[1]))) continue; |
| 21901 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 381 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
381 | if (combobuf[MAPCOMBO2(1,bx2,by)].type == cBRIDGE && _effectflag_layer(bx2,by,1, &(tmpscr2[1]))) continue; |
| 21902 | } | ||
| 21903 | 34789 | } | |
| 21904 | 370211 | } | |
| 21905 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 740422 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
740422 | if((combobuf[MAPCOMBO2(i,bx,by)].type==type && _effectflag(bx,by,1, i))|| |
| 21906 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 740422 times.
|
740422 | (combobuf[MAPCOMBO2(i,bx2,by)].type==type && _effectflag(bx2,by,1, i))) |
| 21907 | { | ||
| 21908 | ✗ | found=true; | |
| 21909 | ✗ | break; | |
| 21910 | } | ||
| 21911 | 740422 | } | |
| 21912 | 370211 | } | |
| 21913 | |||
| 21914 |
2/2✓ Branch 0 taken 172 times.
✓ Branch 1 taken 370211 times.
|
370383 | if(!found) |
| 21915 | { | ||
| 21916 | 370211 | return; | |
| 21917 | } | ||
| 21918 | |||
| 21919 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 101 times.
✓ Branch 3 taken 2 times.
|
172 | switch(type) |
| 21920 | { | ||
| 21921 | case cLOCKEDCHEST: | ||
| 21922 |
2/2✓ Branch 0 taken 13 times.
✓ Branch 1 taken 56 times.
|
69 | if(!usekey()) return; |
| 21923 | |||
| 21924 | 13 | setmapflag(mLOCKEDCHEST); | |
| 21925 | 13 | break; | |
| 21926 | |||
| 21927 | case cCHEST: | ||
| 21928 | 101 | setmapflag(mCHEST); | |
| 21929 | 101 | break; | |
| 21930 | |||
| 21931 | case cBOSSCHEST: | ||
| 21932 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if(!(game->lvlitems[dlevel]&liBOSSKEY)) return; |
| 21933 | // Run Boss Key Script | ||
| 21934 | 2 | int32_t key_item = 0; //current_item_id(itype_bosskey); //not possible | |
| 21935 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 136 times.
|
136 | for ( int32_t q = 0; q < MAXITEMS; ++q ) |
| 21936 | { | ||
| 21937 |
2/2✓ Branch 0 taken 134 times.
✓ Branch 1 taken 2 times.
|
136 | if ( itemsbuf[q].family == itype_bosskey ) |
| 21938 | { | ||
| 21939 | 2 | key_item = q; break; | |
| 21940 | } | ||
| 21941 | 134 | } | |
| 21942 |
2/8✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
2 | if ( key_item > 0 && itemsbuf[key_item].script && !(FFCore.doscript(ScriptType::Item, key_item) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING)) ) |
| 21943 | { | ||
| 21944 | ✗ | int i = key_item; | |
| 21945 | ✗ | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 21946 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[i].script, i); | |
| 21947 | ✗ | FFCore.deallocateAllScriptOwned(ScriptType::Item,(key_item)); | |
| 21948 | ✗ | } | |
| 21949 | 2 | setmapflag(mBOSSCHEST); | |
| 21950 | 2 | break; | |
| 21951 | } | ||
| 21952 | |||
| 21953 | 116 | itemflag |= MAPCOMBOFLAG(bx,by)==mfARMOS_ITEM; | |
| 21954 | 116 | itemflag |= MAPCOMBOFLAG(bx2,by)==mfARMOS_ITEM; | |
| 21955 | 116 | itemflag |= MAPFLAG(bx,by)==mfARMOS_ITEM; | |
| 21956 | 116 | itemflag |= MAPFLAG(bx2,by)==mfARMOS_ITEM; | |
| 21957 | 116 | itemflag |= MAPCOMBOFLAG(bx,by)==mfARMOS_ITEM; | |
| 21958 | 116 | itemflag |= MAPCOMBOFLAG(bx2,by)==mfARMOS_ITEM; | |
| 21959 | |||
| 21960 |
1/2✓ Branch 0 taken 116 times.
✗ Branch 1 not taken.
|
116 | if(!itemflag) |
| 21961 | { | ||
| 21962 | ✗ | for(int32_t i=0; i<2; i++) | |
| 21963 | { | ||
| 21964 | ✗ | itemflag |= MAPFLAG2(i,bx,by)==mfARMOS_ITEM; | |
| 21965 | ✗ | itemflag |= MAPFLAG2(i,bx2,by)==mfARMOS_ITEM; | |
| 21966 | ✗ | itemflag |= MAPCOMBOFLAG2(i,bx,by)==mfARMOS_ITEM; | |
| 21967 | ✗ | itemflag |= MAPCOMBOFLAG2(i,bx2,by)==mfARMOS_ITEM; | |
| 21968 | ✗ | } | |
| 21969 | ✗ | } | |
| 21970 | |||
| 21971 |
3/6✓ Branch 0 taken 116 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 116 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 116 times.
|
116 | if(itemflag && !getmapflag((currscr < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM)) |
| 21972 | { | ||
| 21973 |
4/8✓ Branch 0 taken 116 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 116 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 116 times.
✗ Branch 7 not taken.
|
116 | items.add(new item(x, y,(zfix)0, tmpscr->catchall, ipONETIME2 + ipBIGRANGE + ipHOLDUP | ((tmpscr->flags8&fITEMSECRET) ? ipSECRETS : 0), 0)); |
| 21974 | 116 | } | |
| 21975 | 39433320 | } | |
| 21976 | |||
| 21977 | 4050186 | void HeroClass::checkchest(int32_t type) | |
| 21978 | { | ||
| 21979 |
4/4✓ Branch 0 taken 3065482 times.
✓ Branch 1 taken 984704 times.
✓ Branch 2 taken 984704 times.
✓ Branch 3 taken 2080778 times.
|
4050186 | bool ischest = type == cCHEST || type == cLOCKEDCHEST || type == cBOSSCHEST; |
| 21980 |
2/2✓ Branch 0 taken 548037 times.
✓ Branch 1 taken 3502149 times.
|
4050186 | bool islockblock = type == cLOCKBLOCK || type == cBOSSLOCKBLOCK; |
| 21981 |
2/2✓ Branch 0 taken 548037 times.
✓ Branch 1 taken 3502149 times.
|
4050186 | bool islocked = type == cLOCKBLOCK || type == cLOCKEDCHEST; |
| 21982 |
2/2✓ Branch 0 taken 548037 times.
✓ Branch 1 taken 3502149 times.
|
4050186 | bool isbosslocked = type == cBOSSLOCKBLOCK || type == cBOSSCHEST; |
| 21983 |
2/2✓ Branch 0 taken 1096074 times.
✓ Branch 1 taken 2954112 times.
|
4050186 | if(ischest) |
| 21984 | { | ||
| 21985 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2954112 times.
|
2954112 | if(get_qr(qr_OLD_CHEST_COLLISION)) |
| 21986 | { | ||
| 21987 | ✗ | oldcheckchest(type); | |
| 21988 | ✗ | return; | |
| 21989 | } | ||
| 21990 | 2954112 | } | |
| 21991 |
3/4✓ Branch 0 taken 1096074 times.
✓ Branch 1 taken 2954112 times.
✓ Branch 2 taken 1096074 times.
✗ Branch 3 not taken.
|
4050186 | if(islockblock && get_qr(qr_OLD_LOCKBLOCK_COLLISION)) |
| 21992 | { | ||
| 21993 | ✗ | if(type == cLOCKBLOCK) | |
| 21994 | ✗ | oldchecklockblock(); | |
| 21995 | ✗ | else if(type == cBOSSLOCKBLOCK) | |
| 21996 | ✗ | oldcheckbosslockblock(); | |
| 21997 | ✗ | return; | |
| 21998 | } | ||
| 21999 |
5/6✓ Branch 0 taken 4045644 times.
✓ Branch 1 taken 4542 times.
✓ Branch 2 taken 4028863 times.
✓ Branch 3 taken 16781 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 4028863 times.
|
4050186 | if(toogam || z>0 || fakez > 0) return; |
| 22000 | 4028863 | zfix bx, by; | |
| 22001 | 4028863 | zfix bx2, by2; | |
| 22002 | 4028863 | zfix fx(-1), fy(-1); | |
| 22003 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 876864 times.
✓ Branch 2 taken 892257 times.
✓ Branch 3 taken 1111630 times.
✓ Branch 4 taken 1148112 times.
|
4028863 | switch(dir) |
| 22004 | { | ||
| 22005 | case up: | ||
| 22006 | 876864 | by = y + (bigHitbox ? -2 : 6); | |
| 22007 | 876864 | by2 = by; | |
| 22008 | 876864 | bx = x + 4; | |
| 22009 | 876864 | bx2 = bx + 8; | |
| 22010 | 876864 | break; | |
| 22011 | case down: | ||
| 22012 | 892257 | by = y + 17; | |
| 22013 | 892257 | by2 = by; | |
| 22014 | 892257 | bx = x + 4; | |
| 22015 | 892257 | bx2 = bx + 8; | |
| 22016 | 892257 | break; | |
| 22017 | case left: | ||
| 22018 | 1111630 | by = y + (bigHitbox ? 0 : 8); | |
| 22019 | 1111630 | by2 = y + 8; | |
| 22020 | 1111630 | bx = x - 2; | |
| 22021 | 1111630 | bx2 = x - 2; | |
| 22022 | 1111630 | break; | |
| 22023 | case right: | ||
| 22024 | 1148112 | by = y + (bigHitbox ? 0 : 8); | |
| 22025 | 1148112 | by2 = y + 8; | |
| 22026 | 1148112 | bx = x + 17; | |
| 22027 | 1148112 | bx2 = x + 17; | |
| 22028 | 1148112 | break; | |
| 22029 | } | ||
| 22030 | |||
| 22031 | 4028863 | int32_t found = -1; | |
| 22032 | 4028863 | int32_t foundlayer = 0; | |
| 22033 | |||
| 22034 | 4028863 | newcombo const* cmb = &combobuf[MAPCOMBO(bx,by)]; | |
| 22035 | |||
| 22036 |
4/6✓ Branch 0 taken 2434 times.
✓ Branch 1 taken 4026429 times.
✓ Branch 2 taken 2434 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2434 times.
|
4028863 | if(cmb->type==type && !(cmb->triggerflags[0] & combotriggerONLYGENTRIG) && _effectflag(bx,by,1, -1)) |
| 22037 | { | ||
| 22038 | 2434 | found = MAPCOMBO(bx,by); | |
| 22039 | 2434 | fx = bx; fy = by; | |
| 22040 |
2/2✓ Branch 0 taken 4868 times.
✓ Branch 1 taken 2434 times.
|
7302 | for (int32_t i = 0; i <= 1; ++i) |
| 22041 | { | ||
| 22042 |
2/2✓ Branch 0 taken 1157 times.
✓ Branch 1 taken 3711 times.
|
4868 | if(tmpscr2[i].valid!=0) |
| 22043 | { | ||
| 22044 |
2/2✓ Branch 0 taken 2714 times.
✓ Branch 1 taken 997 times.
|
3711 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 22045 | { | ||
| 22046 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2714 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2714 | if (combobuf[MAPCOMBO2(i,bx,by)].type == cBRIDGE && !_walkflag_layer(bx,by,1, &(tmpscr2[i]))) found = -1; |
| 22047 | 2714 | } | |
| 22048 | else | ||
| 22049 | { | ||
| 22050 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 997 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
997 | if (combobuf[MAPCOMBO2(i,bx,by)].type == cBRIDGE && _effectflag_layer(bx,by,1, &(tmpscr2[i]))) found = -1; |
| 22051 | } | ||
| 22052 | 3711 | } | |
| 22053 | 4868 | } | |
| 22054 | 2434 | } | |
| 22055 |
2/2✓ Branch 0 taken 2434 times.
✓ Branch 1 taken 4026429 times.
|
4028863 | if(found<0) |
| 22056 | { | ||
| 22057 | 4026429 | cmb = &combobuf[MAPCOMBO(bx2,by2)]; | |
| 22058 |
4/6✓ Branch 0 taken 76 times.
✓ Branch 1 taken 4026353 times.
✓ Branch 2 taken 76 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 76 times.
|
4026429 | if(cmb->type==type && !(cmb->triggerflags[0] & combotriggerONLYGENTRIG) && _effectflag(bx2,by2,1, -1)) |
| 22059 | { | ||
| 22060 | 76 | found = MAPCOMBO(bx2,by2); | |
| 22061 |
2/2✓ Branch 0 taken 76 times.
✓ Branch 1 taken 532 times.
|
608 | for (int32_t i = 0; i <= 6; ++i) |
| 22062 | { | ||
| 22063 |
2/2✓ Branch 0 taken 320 times.
✓ Branch 1 taken 212 times.
|
532 | if(tmpscr2[i].valid!=0) |
| 22064 | { | ||
| 22065 |
2/2✓ Branch 0 taken 92 times.
✓ Branch 1 taken 120 times.
|
212 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 22066 | { | ||
| 22067 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 92 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
92 | if (combobuf[MAPCOMBO2(i,bx2,by2)].type == cBRIDGE && !_walkflag_layer(bx2,by2,1, &(tmpscr2[i]))) |
| 22068 | { | ||
| 22069 | ✗ | found = -1; | |
| 22070 | ✗ | break; | |
| 22071 | } | ||
| 22072 | 92 | } | |
| 22073 | else | ||
| 22074 | { | ||
| 22075 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 120 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
120 | if (combobuf[MAPCOMBO2(i,bx2,by2)].type == cBRIDGE && _effectflag_layer(bx2,by2,1, &(tmpscr2[i]))) |
| 22076 | { | ||
| 22077 | ✗ | found = -1; | |
| 22078 | ✗ | break; | |
| 22079 | } | ||
| 22080 | } | ||
| 22081 | 212 | } | |
| 22082 | 532 | } | |
| 22083 |
1/2✓ Branch 0 taken 76 times.
✗ Branch 1 not taken.
|
76 | if(found != -1) |
| 22084 | { | ||
| 22085 | 76 | fx = bx2; fy = by2; | |
| 22086 | 76 | } | |
| 22087 | 76 | } | |
| 22088 | 4026429 | } | |
| 22089 | |||
| 22090 |
2/2✓ Branch 0 taken 2510 times.
✓ Branch 1 taken 4026353 times.
|
4028863 | if(found<0) |
| 22091 | { | ||
| 22092 |
2/2✓ Branch 0 taken 4026154 times.
✓ Branch 1 taken 24157123 times.
|
28183277 | for(int32_t i=0; i<6; i++) |
| 22093 | { | ||
| 22094 | 24157123 | cmb = &combobuf[MAPCOMBO2(i,bx,by)]; | |
| 22095 |
4/6✓ Branch 0 taken 199 times.
✓ Branch 1 taken 24156924 times.
✓ Branch 2 taken 199 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 199 times.
|
24157123 | if(combobuf[MAPCOMBO2(i,bx,by)].type==type && !(cmb->triggerflags[0] & combotriggerONLYGENTRIG) && _effectflag(bx,by,1, i)) |
| 22096 | { | ||
| 22097 | 199 | found = MAPCOMBO2(i,bx,by); | |
| 22098 |
2/2✓ Branch 0 taken 199 times.
✓ Branch 1 taken 995 times.
|
1194 | for(int32_t j = i+1; j < 6; ++j) |
| 22099 | { | ||
| 22100 |
2/2✓ Branch 0 taken 750 times.
✓ Branch 1 taken 245 times.
|
995 | if (tmpscr2[j].valid!=0) |
| 22101 | { | ||
| 22102 |
2/2✓ Branch 0 taken 106 times.
✓ Branch 1 taken 139 times.
|
245 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 22103 | { | ||
| 22104 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 106 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
106 | if (combobuf[MAPCOMBO2(j,bx,by)].type == cBRIDGE && !_walkflag_layer(bx,by,1, &(tmpscr2[j]))) |
| 22105 | { | ||
| 22106 | ✗ | found = -1; | |
| 22107 | ✗ | break; | |
| 22108 | } | ||
| 22109 | 106 | } | |
| 22110 | else | ||
| 22111 | { | ||
| 22112 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 139 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
139 | if (combobuf[MAPCOMBO2(j,bx,by)].type == cBRIDGE && _effectflag_layer(bx,by,1, &(tmpscr2[j]))) |
| 22113 | { | ||
| 22114 | ✗ | found = -1; | |
| 22115 | ✗ | break; | |
| 22116 | } | ||
| 22117 | } | ||
| 22118 | 245 | } | |
| 22119 | 995 | } | |
| 22120 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 199 times.
|
199 | if(found>-1) |
| 22121 | { | ||
| 22122 | 199 | foundlayer = i+1; | |
| 22123 | 199 | fx = bx; fy = by; | |
| 22124 | 199 | break; | |
| 22125 | } | ||
| 22126 | ✗ | } | |
| 22127 | 24156924 | cmb = &combobuf[MAPCOMBO2(i,bx2,by2)]; | |
| 22128 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 24156924 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
24156924 | if(combobuf[MAPCOMBO2(i,bx2,by2)].type==type && !(cmb->triggerflags[0] & combotriggerONLYGENTRIG) && _effectflag(bx2,by2,1, i)) |
| 22129 | { | ||
| 22130 | ✗ | found = MAPCOMBO2(i,bx2,by2); | |
| 22131 | ✗ | for(int32_t j = i+1; j < 6; ++j) | |
| 22132 | { | ||
| 22133 | ✗ | if (tmpscr2[j].valid!=0) | |
| 22134 | { | ||
| 22135 | ✗ | if (get_qr(qr_OLD_BRIDGE_COMBOS)) | |
| 22136 | { | ||
| 22137 | ✗ | if (combobuf[MAPCOMBO2(j,bx2,by2)].type == cBRIDGE && !_walkflag_layer(bx2,by2,1, &(tmpscr2[j]))) | |
| 22138 | { | ||
| 22139 | ✗ | found = -1; | |
| 22140 | ✗ | break; | |
| 22141 | } | ||
| 22142 | ✗ | } | |
| 22143 | else | ||
| 22144 | { | ||
| 22145 | ✗ | if (combobuf[MAPCOMBO2(j,bx2,by2)].type == cBRIDGE && _effectflag_layer(bx2,by2,1, &(tmpscr2[j]))) | |
| 22146 | { | ||
| 22147 | ✗ | found = -1; | |
| 22148 | ✗ | break; | |
| 22149 | } | ||
| 22150 | } | ||
| 22151 | ✗ | } | |
| 22152 | ✗ | } | |
| 22153 | ✗ | if(found>-1) | |
| 22154 | { | ||
| 22155 | ✗ | foundlayer = i+1; | |
| 22156 | ✗ | fx = bx2; fy = by2; | |
| 22157 | ✗ | break; | |
| 22158 | } | ||
| 22159 | ✗ | } | |
| 22160 | 24156924 | } | |
| 22161 | 4026353 | } | |
| 22162 | |||
| 22163 |
2/2✓ Branch 0 taken 2709 times.
✓ Branch 1 taken 4026154 times.
|
4028863 | if(found<0) return; |
| 22164 | 2709 | cmb = &combobuf[found]; | |
| 22165 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 2531 times.
✓ Branch 2 taken 78 times.
✓ Branch 3 taken 22 times.
✓ Branch 4 taken 78 times.
|
2709 | switch(dir) |
| 22166 | { | ||
| 22167 | case up: | ||
| 22168 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2531 times.
|
2531 | if(cmb->usrflags&cflag10) |
| 22169 | ✗ | return; | |
| 22170 | 2531 | break; | |
| 22171 | case down: | ||
| 22172 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 9 times.
|
78 | if(cmb->usrflags&cflag9) |
| 22173 | 69 | return; | |
| 22174 | 9 | break; | |
| 22175 | case left: | ||
| 22176 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22 times.
|
22 | if(cmb->usrflags&cflag12) |
| 22177 | ✗ | return; | |
| 22178 | 22 | break; | |
| 22179 | case right: | ||
| 22180 |
2/2✓ Branch 0 taken 61 times.
✓ Branch 1 taken 17 times.
|
78 | if(cmb->usrflags&cflag11) |
| 22181 | 61 | return; | |
| 22182 | 17 | break; | |
| 22183 | } | ||
| 22184 | 2579 | int32_t intbtn = cmb->attribytes[2]; | |
| 22185 | |||
| 22186 |
2/2✓ Branch 0 taken 2498 times.
✓ Branch 1 taken 81 times.
|
2579 | if(intbtn) // |
| 22187 | { | ||
| 22188 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2498 times.
|
2498 | if(cmb->usrflags & cflag13) //display prompt |
| 22189 | { | ||
| 22190 | 2498 | int altcmb = cmb->attributes[2]/10000; | |
| 22191 | 2498 | prompt_combo = cmb->attributes[1]/10000; | |
| 22192 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2498 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2498 | if(altcmb && ((islocked && !can_locked_combo(*cmb)) |
| 22193 | ✗ | || (isbosslocked && !(game->lvlitems[dlevel]&liBOSSKEY)))) | |
| 22194 | ✗ | prompt_combo = altcmb; | |
| 22195 | 2498 | prompt_cset = cmb->attribytes[4]; | |
| 22196 | 2498 | prompt_x = cmb->attrishorts[0]; | |
| 22197 | 2498 | prompt_y = cmb->attrishorts[1]; | |
| 22198 | 2498 | } | |
| 22199 |
2/2✓ Branch 0 taken 54 times.
✓ Branch 1 taken 2444 times.
|
2498 | if(!getIntBtnInput(intbtn, true, true, false, false)) |
| 22200 | { | ||
| 22201 | 2444 | return; //Button not pressed | |
| 22202 | } | ||
| 22203 | 54 | } | |
| 22204 |
4/4✓ Branch 0 taken 12 times.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 9 times.
|
81 | else if(pushing < 8 || pushing % 8) return; //Not pushing against chest enough |
| 22205 | |||
| 22206 |
2/2✓ Branch 0 taken 42 times.
✓ Branch 1 taken 21 times.
|
63 | if(ischest) |
| 22207 | { | ||
| 22208 |
1/2✓ Branch 0 taken 42 times.
✗ Branch 1 not taken.
|
42 | if(!trigger_chest(foundlayer, COMBOPOS(fx,fy))) return; |
| 22209 | 42 | } | |
| 22210 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
|
21 | else if(islockblock) |
| 22211 | { | ||
| 22212 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 3 times.
|
21 | if(!trigger_lockblock(foundlayer, COMBOPOS(fx,fy))) return; |
| 22213 | 18 | } | |
| 22214 |
3/4✓ Branch 0 taken 51 times.
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 51 times.
|
60 | if(intbtn && (cmb->usrflags & cflag13)) |
| 22215 | 51 | prompt_combo = 0; | |
| 22216 | 4050186 | } | |
| 22217 | |||
| 22218 | 14153429 | void HeroClass::checkgenpush() | |
| 22219 | { | ||
| 22220 | 14153429 | zfix bx, by; | |
| 22221 | 14153429 | zfix bx2, by2; | |
| 22222 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 3476128 times.
✓ Branch 2 taken 2816298 times.
✓ Branch 3 taken 3790977 times.
✓ Branch 4 taken 4070026 times.
|
14153429 | switch(dir) |
| 22223 | { | ||
| 22224 | case up: | ||
| 22225 | 3476128 | by = y + (bigHitbox ? -2 : 6); | |
| 22226 | 3476128 | by2 = by; | |
| 22227 | 3476128 | bx = x + 4; | |
| 22228 | 3476128 | bx2 = bx + 8; | |
| 22229 | 3476128 | break; | |
| 22230 | case down: | ||
| 22231 | 2816298 | by = y + 17; | |
| 22232 | 2816298 | by2 = by; | |
| 22233 | 2816298 | bx = x + 4; | |
| 22234 | 2816298 | bx2 = bx + 8; | |
| 22235 | 2816298 | break; | |
| 22236 | case left: | ||
| 22237 | 3790977 | by = y + (bigHitbox ? 0 : 8); | |
| 22238 | 3790977 | by2 = y + 8; | |
| 22239 | 3790977 | bx = x - 2; | |
| 22240 | 3790977 | bx2 = x - 2; | |
| 22241 | 3790977 | break; | |
| 22242 | case right: | ||
| 22243 | 4070026 | by = y + (bigHitbox ? 0 : 8); | |
| 22244 | 4070026 | by2 = y + 8; | |
| 22245 | 4070026 | bx = x + 17; | |
| 22246 | 4070026 | bx2 = x + 17; | |
| 22247 | 4070026 | break; | |
| 22248 | } | ||
| 22249 | 14153429 | auto pos1 = COMBOPOS(bx,by); | |
| 22250 | 14153429 | auto pos2 = COMBOPOS(bx2,by2); | |
| 22251 |
2/2✓ Branch 0 taken 14153429 times.
✓ Branch 1 taken 99074003 times.
|
113227432 | for(auto layer = 0; layer < 7; ++layer) |
| 22252 | { | ||
| 22253 | 99074003 | mapscr* tmp = FFCore.tempScreens[layer]; | |
| 22254 | |||
| 22255 | 99074003 | newcombo const& cmb1 = combobuf[tmp->data[pos1]]; | |
| 22256 |
2/2✓ Branch 0 taken 99072800 times.
✓ Branch 1 taken 1203 times.
|
99074003 | if(cmb1.triggerflags[1] & combotriggerPUSH) |
| 22257 |
5/6✓ Branch 0 taken 1188 times.
✓ Branch 1 taken 15 times.
✓ Branch 2 taken 15 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 14 times.
|
1204 | if(pushing && !(pushing % zc_max(1,cmb1.trig_pushtime))) |
| 22258 | 1 | do_trigger_combo(layer,pos1); | |
| 22259 | |||
| 22260 |
2/2✓ Branch 0 taken 81445427 times.
✓ Branch 1 taken 17628576 times.
|
99074003 | if(pos1==pos2) continue; |
| 22261 | |||
| 22262 | 17628576 | newcombo const& cmb2 = combobuf[tmp->data[pos2]]; | |
| 22263 |
2/2✓ Branch 0 taken 17628301 times.
✓ Branch 1 taken 275 times.
|
17628576 | if(cmb2.triggerflags[1] & combotriggerPUSH) |
| 22264 |
4/6✓ Branch 0 taken 270 times.
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
|
275 | if(pushing && !(pushing % zc_max(1,cmb2.trig_pushtime))) |
| 22265 | ✗ | do_trigger_combo(layer,pos2); | |
| 22266 | 17628576 | } | |
| 22267 |
2/2✓ Branch 0 taken 13165400 times.
✓ Branch 1 taken 988029 times.
|
14153429 | if (!get_qr(qr_OLD_FFC_FUNCTIONALITY)) |
| 22268 | { | ||
| 22269 | 988029 | word c = tmpscr->numFFC(); | |
| 22270 |
2/2✓ Branch 0 taken 988029 times.
✓ Branch 1 taken 2542017 times.
|
3530046 | for(word i=0; i<c; i++) |
| 22271 | { | ||
| 22272 |
4/4✓ Branch 0 taken 2510667 times.
✓ Branch 1 taken 31350 times.
✓ Branch 2 taken 1278 times.
✓ Branch 3 taken 2509389 times.
|
2542017 | if (ffcIsAt(i, bx, by) || ffcIsAt(i, bx2, by2)) |
| 22273 | { | ||
| 22274 | 32628 | ffcdata& ffc = tmpscr->ffcs[i]; | |
| 22275 | 32628 | newcombo const& cmb3 = combobuf[ffc.data]; | |
| 22276 |
1/2✓ Branch 0 taken 32628 times.
✗ Branch 1 not taken.
|
32628 | if(cmb3.triggerflags[1] & combotriggerPUSH) |
| 22277 | { | ||
| 22278 | ✗ | if(pushing && !(pushing % zc_max(1,cmb3.trig_pushtime))) | |
| 22279 | { | ||
| 22280 | ✗ | do_trigger_combo_ffc(i); | |
| 22281 | ✗ | break; | |
| 22282 | } | ||
| 22283 | ✗ | } | |
| 22284 | 32628 | } | |
| 22285 | 2542017 | } | |
| 22286 | 988029 | } | |
| 22287 | 14153429 | } | |
| 22288 | |||
| 22289 | 14153431 | void HeroClass::checksigns() //Also checks for generic trigger buttons | |
| 22290 | { | ||
| 22291 |
5/6✓ Branch 0 taken 14138737 times.
✓ Branch 1 taken 14694 times.
✓ Branch 2 taken 14121041 times.
✓ Branch 3 taken 17696 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 14121041 times.
|
14153431 | if(toogam || z>0 || fakez>0) return; |
| 22292 |
5/6✓ Branch 0 taken 14001495 times.
✓ Branch 1 taken 119546 times.
✓ Branch 2 taken 236865 times.
✓ Branch 3 taken 13764630 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 236865 times.
|
14121041 | if(msg_active || (msg_onscreen && get_qr(qr_MSGDISAPPEAR))) |
| 22293 | 119546 | return; //Don't overwrite a message waiting to be dismissed | |
| 22294 | 14001495 | zfix bx, by; | |
| 22295 | 14001495 | zfix bx2, by2; | |
| 22296 | 14001495 | zfix fx(-1), fy(-1); | |
| 22297 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 3376446 times.
✓ Branch 2 taken 2803983 times.
✓ Branch 3 taken 3775509 times.
✓ Branch 4 taken 4045557 times.
|
14001495 | switch(dir) |
| 22298 | { | ||
| 22299 | case up: | ||
| 22300 | 3376446 | by = y + (bigHitbox ? -2 : 6); | |
| 22301 | 3376446 | by2 = by; | |
| 22302 | 3376446 | bx = x + 4; | |
| 22303 | 3376446 | bx2 = bx + 8; | |
| 22304 | 3376446 | break; | |
| 22305 | case down: | ||
| 22306 | 2803983 | by = y + 17; | |
| 22307 | 2803983 | by2 = by; | |
| 22308 | 2803983 | bx = x + 4; | |
| 22309 | 2803983 | bx2 = bx + 8; | |
| 22310 | 2803983 | break; | |
| 22311 | case left: | ||
| 22312 | 3775509 | by = y + (bigHitbox ? 0 : 8); | |
| 22313 | 3775509 | by2 = y + 8; | |
| 22314 | 3775509 | bx = x - 2; | |
| 22315 | 3775509 | bx2 = x - 2; | |
| 22316 | 3775509 | break; | |
| 22317 | case right: | ||
| 22318 | 4045557 | by = y + (bigHitbox ? 0 : 8); | |
| 22319 | 4045557 | by2 = y + 8; | |
| 22320 | 4045557 | bx = x + 17; | |
| 22321 | 4045557 | bx2 = x + 17; | |
| 22322 | 4045557 | break; | |
| 22323 | } | ||
| 22324 | |||
| 22325 | 14001495 | int32_t found = -1; | |
| 22326 | 14001495 | int32_t foundffc = -1; | |
| 22327 | 14001495 | int32_t found_lyr = 0; | |
| 22328 | 14001495 | bool found_sign = false; | |
| 22329 | 14001495 | int32_t tmp_cid = MAPCOMBO(bx,by); | |
| 22330 | 14001495 | newcombo const* tmp_cmb = &combobuf[tmp_cid]; | |
| 22331 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 14001495 times.
✓ Branch 2 taken 13995809 times.
✓ Branch 3 taken 5686 times.
|
28002990 | if(((tmp_cmb->type==cSIGNPOST && !(tmp_cmb->triggerflags[0] & combotriggerONLYGENTRIG)) |
| 22332 | 14001495 | || tmp_cmb->triggerbtn) && _effectflag(bx,by,1, -1)) | |
| 22333 | { | ||
| 22334 | 5686 | found = tmp_cid; | |
| 22335 | 5686 | fx = bx; fy = by; | |
| 22336 |
2/2✓ Branch 0 taken 11372 times.
✓ Branch 1 taken 5686 times.
|
17058 | for (int32_t i = 0; i <= 1; ++i) |
| 22337 | { | ||
| 22338 |
2/2✓ Branch 0 taken 8387 times.
✓ Branch 1 taken 2985 times.
|
11372 | if(tmpscr2[i].valid!=0) |
| 22339 | { | ||
| 22340 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2985 times.
|
2985 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 22341 | { | ||
| 22342 | ✗ | if (combobuf[MAPCOMBO2(i,bx,by)].type == cBRIDGE && !_walkflag_layer(bx,by,1, &(tmpscr2[i]))) found = -1; | |
| 22343 | ✗ | } | |
| 22344 | else | ||
| 22345 | { | ||
| 22346 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2985 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2985 | if (combobuf[MAPCOMBO2(i,bx,by)].type == cBRIDGE && _effectflag_layer(bx,by,1, &(tmpscr2[i]))) found = -1; |
| 22347 | } | ||
| 22348 | 2985 | } | |
| 22349 | 11372 | } | |
| 22350 | 5686 | } | |
| 22351 | 14001495 | tmp_cid = MAPCOMBO(bx2,by2); | |
| 22352 | 14001495 | tmp_cmb = &combobuf[tmp_cid]; | |
| 22353 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 14001495 times.
✓ Branch 2 taken 13995681 times.
✓ Branch 3 taken 5814 times.
|
28002990 | if(((tmp_cmb->type==cSIGNPOST && !(tmp_cmb->triggerflags[0] & combotriggerONLYGENTRIG)) |
| 22354 | 14001495 | || tmp_cmb->triggerbtn) && _effectflag(bx2,by2,1, -1)) | |
| 22355 | { | ||
| 22356 | 5814 | found = tmp_cid; | |
| 22357 | 5814 | fx = bx2; fy = by2; | |
| 22358 |
2/2✓ Branch 0 taken 11628 times.
✓ Branch 1 taken 5814 times.
|
17442 | for (int32_t i = 0; i <= 1; ++i) |
| 22359 | { | ||
| 22360 |
2/2✓ Branch 0 taken 8731 times.
✓ Branch 1 taken 2897 times.
|
11628 | if(tmpscr2[i].valid!=0) |
| 22361 | { | ||
| 22362 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2897 times.
|
2897 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 22363 | { | ||
| 22364 | ✗ | if (combobuf[MAPCOMBO2(i,bx2,by2)].type == cBRIDGE && !_walkflag_layer(bx2,by2,1, &(tmpscr2[i]))) found = -1; | |
| 22365 | ✗ | } | |
| 22366 | else | ||
| 22367 | { | ||
| 22368 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2897 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2897 | if (combobuf[MAPCOMBO2(i,bx2,by2)].type == cBRIDGE && _effectflag_layer(bx2,by2,1, &(tmpscr2[i]))) found = -1; |
| 22369 | } | ||
| 22370 | 2897 | } | |
| 22371 | 11628 | } | |
| 22372 | 5814 | } | |
| 22373 | |||
| 22374 |
2/2✓ Branch 0 taken 13018935 times.
✓ Branch 1 taken 982560 times.
|
14001495 | if (!get_qr(qr_OLD_FFC_FUNCTIONALITY)) |
| 22375 | { | ||
| 22376 | 982560 | word c = tmpscr->numFFC(); | |
| 22377 |
2/2✓ Branch 0 taken 982560 times.
✓ Branch 1 taken 2523272 times.
|
3505832 | for(word i=0; i<c; i++) |
| 22378 | { | ||
| 22379 |
4/4✓ Branch 0 taken 2492116 times.
✓ Branch 1 taken 31156 times.
✓ Branch 2 taken 1278 times.
✓ Branch 3 taken 2490838 times.
|
2523272 | if (ffcIsAt(i, bx, by) || ffcIsAt(i, bx2, by2)) |
| 22380 | { | ||
| 22381 | 32434 | ffcdata& ffc = tmpscr->ffcs[i]; | |
| 22382 | 32434 | tmp_cmb = &combobuf[ffc.data]; | |
| 22383 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 32434 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 32434 times.
|
32434 | if(((tmp_cmb->type==cSIGNPOST && !(tmp_cmb->triggerflags[0] & combotriggerONLYGENTRIG)) |
| 22384 | 32434 | || tmp_cmb->triggerbtn) && true) //!TODO: FFC effect flag? | |
| 22385 | { | ||
| 22386 | ✗ | foundffc = i; | |
| 22387 | ✗ | break; | |
| 22388 | } | ||
| 22389 | 32434 | } | |
| 22390 | 2523272 | } | |
| 22391 | 982560 | } | |
| 22392 | |||
| 22393 |
3/4✓ Branch 0 taken 13995500 times.
✓ Branch 1 taken 5995 times.
✓ Branch 2 taken 13995500 times.
✗ Branch 3 not taken.
|
14001495 | if(found<0 && foundffc < 0) |
| 22394 | { | ||
| 22395 |
2/2✓ Branch 0 taken 13993509 times.
✓ Branch 1 taken 83963744 times.
|
97957253 | for(int32_t i=0; i<6; i++) |
| 22396 | { | ||
| 22397 | 83963744 | tmp_cid = MAPCOMBO2(i,bx,by); | |
| 22398 | 83963744 | tmp_cmb = &combobuf[tmp_cid]; | |
| 22399 |
4/4✓ Branch 0 taken 694 times.
✓ Branch 1 taken 83963050 times.
✓ Branch 2 taken 83961806 times.
✓ Branch 3 taken 1938 times.
|
167927488 | if(((tmp_cmb->type==cSIGNPOST && !(tmp_cmb->triggerflags[0] & combotriggerONLYGENTRIG)) |
| 22400 | 83963744 | || tmp_cmb->triggerbtn) && _effectflag(bx,by,1, i)) | |
| 22401 | { | ||
| 22402 | 1938 | found = tmp_cid; | |
| 22403 | 1938 | found_lyr = i+1; | |
| 22404 | 1938 | fx = bx; fy = by; | |
| 22405 |
4/4✓ Branch 0 taken 1277 times.
✓ Branch 1 taken 661 times.
✓ Branch 2 taken 360 times.
✓ Branch 3 taken 917 times.
|
1938 | if (i == 0 && tmpscr2[1].valid!=0) |
| 22406 | { | ||
| 22407 |
2/2✓ Branch 0 taken 880 times.
✓ Branch 1 taken 37 times.
|
917 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 22408 | { | ||
| 22409 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 880 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
880 | if (combobuf[MAPCOMBO2(1,bx,by)].type == cBRIDGE && !_walkflag_layer(bx,by,1, &(tmpscr2[1]))) found = -1; |
| 22410 | 880 | } | |
| 22411 | else | ||
| 22412 | { | ||
| 22413 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 37 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
37 | if (combobuf[MAPCOMBO2(1,bx,by)].type == cBRIDGE && _effectflag_layer(bx,by,1, &(tmpscr2[1]))) found = -1; |
| 22414 | } | ||
| 22415 | 917 | } | |
| 22416 | 1938 | } | |
| 22417 | 83963744 | tmp_cid = MAPCOMBO2(i,bx2,by2); | |
| 22418 | 83963744 | tmp_cmb = &combobuf[tmp_cid]; | |
| 22419 |
4/4✓ Branch 0 taken 686 times.
✓ Branch 1 taken 83963058 times.
✓ Branch 2 taken 83961913 times.
✓ Branch 3 taken 1831 times.
|
167927488 | if(((tmp_cmb->type==cSIGNPOST && !(tmp_cmb->triggerflags[0] & combotriggerONLYGENTRIG)) |
| 22420 | 83963744 | || tmp_cmb->triggerbtn) && _effectflag(bx2,by2,1, i)) | |
| 22421 | { | ||
| 22422 | 1831 | found = tmp_cid; | |
| 22423 | 1831 | found_lyr = i+1; | |
| 22424 | 1831 | fx = bx2; fy = by2; | |
| 22425 |
4/4✓ Branch 0 taken 1178 times.
✓ Branch 1 taken 653 times.
✓ Branch 2 taken 363 times.
✓ Branch 3 taken 815 times.
|
1831 | if (i == 0 && tmpscr2[1].valid!=0) |
| 22426 | { | ||
| 22427 |
2/2✓ Branch 0 taken 780 times.
✓ Branch 1 taken 35 times.
|
815 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 22428 | { | ||
| 22429 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 780 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
780 | if (combobuf[MAPCOMBO2(1,bx2,by2)].type == cBRIDGE && !_walkflag_layer(bx2,by2,1, &(tmpscr2[1]))) found = -1; |
| 22430 | 780 | } | |
| 22431 | else | ||
| 22432 | { | ||
| 22433 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 35 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
35 | if (combobuf[MAPCOMBO2(1,bx2,by2)].type == cBRIDGE && _effectflag_layer(bx2,by2,1, &(tmpscr2[1]))) found = -1; |
| 22434 | } | ||
| 22435 | 815 | } | |
| 22436 | 1831 | } | |
| 22437 |
2/2✓ Branch 0 taken 83961753 times.
✓ Branch 1 taken 1991 times.
|
83963744 | if(found>-1) break; |
| 22438 | 83961753 | } | |
| 22439 | 13995500 | } | |
| 22440 | |||
| 22441 |
3/4✓ Branch 0 taken 13993509 times.
✓ Branch 1 taken 7986 times.
✓ Branch 2 taken 13993509 times.
✗ Branch 3 not taken.
|
14001495 | if(found<0&&foundffc<0) return; |
| 22442 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7986 times.
|
7986 | newcombo const& cmb = (foundffc<0?combobuf[found]:combobuf[tmpscr->ffcs[foundffc].data]); |
| 22443 | |||
| 22444 | 7986 | byte signInput = 0; | |
| 22445 | 7986 | bool didsign = false, didprompt = false; | |
| 22446 |
3/4✓ Branch 0 taken 732 times.
✓ Branch 1 taken 7254 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 732 times.
|
8005 | if(cmb.type == cSIGNPOST && !(cmb.triggerflags[0] & combotriggerONLYGENTRIG)) |
| 22447 | { | ||
| 22448 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 577 times.
✓ Branch 2 taken 116 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 35 times.
|
732 | switch(dir) |
| 22449 | { | ||
| 22450 | case up: | ||
| 22451 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 577 times.
|
577 | if(cmb.usrflags&cflag10) |
| 22452 | ✗ | goto endsigns; | |
| 22453 | 577 | break; | |
| 22454 | case down: | ||
| 22455 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 116 times.
|
116 | if(cmb.usrflags&cflag9) |
| 22456 | ✗ | goto endsigns; | |
| 22457 | 116 | break; | |
| 22458 | case left: | ||
| 22459 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | if(cmb.usrflags&cflag12) |
| 22460 | ✗ | goto endsigns; | |
| 22461 | 4 | break; | |
| 22462 | case right: | ||
| 22463 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 35 times.
|
35 | if(cmb.usrflags&cflag11) |
| 22464 | ✗ | goto endsigns; | |
| 22465 | 35 | break; | |
| 22466 | } | ||
| 22467 | 732 | int32_t intbtn = cmb.attribytes[2]; | |
| 22468 | |||
| 22469 |
1/2✓ Branch 0 taken 732 times.
✗ Branch 1 not taken.
|
732 | if(intbtn) // |
| 22470 | { | ||
| 22471 | 732 | signInput = getIntBtnInput(intbtn, true, true, false, false); | |
| 22472 |
2/2✓ Branch 0 taken 19 times.
✓ Branch 1 taken 713 times.
|
732 | if(!signInput) |
| 22473 | { | ||
| 22474 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 713 times.
|
713 | if(cmb.usrflags & cflag13) //display prompt |
| 22475 | { | ||
| 22476 | 713 | prompt_combo = cmb.attributes[1]/10000; | |
| 22477 | 713 | prompt_cset = cmb.attribytes[4]; | |
| 22478 | 713 | prompt_x = cmb.attrishorts[0]; | |
| 22479 | 713 | prompt_y = cmb.attrishorts[1]; | |
| 22480 | 713 | didprompt = true; | |
| 22481 | 713 | } | |
| 22482 | 713 | goto endsigns; //Button not pressed | |
| 22483 | } | ||
| 22484 | 19 | } | |
| 22485 | ✗ | else if(pushing < 8 || pushing%8) goto endsigns; //Not pushing against sign enough | |
| 22486 | |||
| 22487 | 19 | trigger_sign(cmb); | |
| 22488 | 19 | didsign = true; | |
| 22489 | 19 | } | |
| 22490 | endsigns: | ||
| 22491 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7986 times.
|
7986 | if(cpos_get(found_lyr, COMBOPOS(fx,fy)).trig_cd) return; |
| 22492 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 521 times.
✓ Branch 2 taken 6497 times.
✓ Branch 3 taken 470 times.
✓ Branch 4 taken 498 times.
|
7986 | switch(dir) |
| 22493 | { | ||
| 22494 | case down: | ||
| 22495 |
2/2✓ Branch 0 taken 405 times.
✓ Branch 1 taken 116 times.
|
521 | if(!(cmb.triggerflags[0] & combotriggerBTN_TOP)) |
| 22496 | 116 | return; | |
| 22497 | 405 | break; | |
| 22498 | case up: | ||
| 22499 |
2/2✓ Branch 0 taken 5920 times.
✓ Branch 1 taken 577 times.
|
6497 | if(!(cmb.triggerflags[0] & combotriggerBTN_BOTTOM)) |
| 22500 | 577 | return; | |
| 22501 | 5920 | break; | |
| 22502 | case right: | ||
| 22503 |
2/2✓ Branch 0 taken 435 times.
✓ Branch 1 taken 35 times.
|
470 | if(!(cmb.triggerflags[0] & combotriggerBTN_LEFT)) |
| 22504 | 35 | return; | |
| 22505 | 435 | break; | |
| 22506 | case left: | ||
| 22507 |
2/2✓ Branch 0 taken 419 times.
✓ Branch 1 taken 79 times.
|
498 | if(!(cmb.triggerflags[0] & combotriggerBTN_RIGHT)) |
| 22508 | 79 | return; | |
| 22509 | 419 | break; | |
| 22510 | } | ||
| 22511 |
4/6✓ Branch 0 taken 7179 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7010 times.
✓ Branch 3 taken 169 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 7010 times.
|
7179 | if(cmb.triggerbtn && (getIntBtnInput(cmb.triggerbtn, true, true, false, false) || checkIntBtnVal(cmb.triggerbtn, signInput))) |
| 22512 | { | ||
| 22513 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 169 times.
|
169 | if (foundffc >= 0) |
| 22514 | ✗ | do_trigger_combo_ffc(foundffc, didsign ? ctrigIGNORE_SIGN : 0); | |
| 22515 | else | ||
| 22516 | 169 | do_trigger_combo(found_lyr, COMBOPOS(fx,fy), didsign ? ctrigIGNORE_SIGN : 0); | |
| 22517 | 169 | } | |
| 22518 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7010 times.
|
7010 | else if(didprompt) |
| 22519 | ✗ | return; | |
| 22520 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7010 times.
|
7010 | else if(cmb.type == cBUTTONPROMPT) |
| 22521 | { | ||
| 22522 | ✗ | prompt_combo = cmb.attributes[0]/10000; | |
| 22523 | ✗ | prompt_cset = cmb.attribytes[0]; | |
| 22524 | ✗ | prompt_x = cmb.attrishorts[0]; | |
| 22525 | ✗ | prompt_y = cmb.attrishorts[1]; | |
| 22526 | ✗ | } | |
| 22527 |
2/2✓ Branch 0 taken 6000 times.
✓ Branch 1 taken 1010 times.
|
7010 | else if(cmb.prompt_cid) |
| 22528 | { | ||
| 22529 | 6000 | prompt_combo = cmb.prompt_cid; | |
| 22530 | 6000 | prompt_cset = cmb.prompt_cs; | |
| 22531 | 6000 | prompt_x = cmb.prompt_x; | |
| 22532 | 6000 | prompt_y = cmb.prompt_y; | |
| 22533 | 6000 | } | |
| 22534 | 14153431 | } | |
| 22535 | |||
| 22536 | 14129284 | void HeroClass::checklocked() | |
| 22537 | { | ||
| 22538 |
2/2✓ Branch 0 taken 14694 times.
✓ Branch 1 taken 14114590 times.
|
14129284 | if(toogam) return; //Walk through walls. |
| 22539 |
2/2✓ Branch 0 taken 6255570 times.
✓ Branch 1 taken 7859020 times.
|
14114590 | if(!isdungeon()) return; |
| 22540 |
4/4✓ Branch 0 taken 6203318 times.
✓ Branch 1 taken 52252 times.
✓ Branch 2 taken 12798 times.
✓ Branch 3 taken 6190520 times.
|
6255570 | if( !diagonalMovement && pushing!=8) return; |
| 22541 | //This is required to allow the player to open a door, while sliding along a wall (pressing in the direction of the door, and sliding left or right) | ||
| 22542 |
4/4✓ Branch 0 taken 52252 times.
✓ Branch 1 taken 12798 times.
✓ Branch 2 taken 2677 times.
✓ Branch 3 taken 49575 times.
|
65050 | if ( diagonalMovement && pushing < 8 ) return; //Allow wall walking Should I add a quest rule for this? -Z |
| 22543 | |||
| 22544 | 15475 | optional<int> openDir; | |
| 22545 |
3/4✓ Branch 0 taken 12798 times.
✓ Branch 1 taken 2677 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 12798 times.
|
15475 | if ( diagonalMovement || get_qr(qr_DISABLE_4WAY_GRIDLOCK)) |
| 22546 | { | ||
| 22547 |
8/8✓ Branch 0 taken 143 times.
✓ Branch 1 taken 2534 times.
✓ Branch 2 taken 97 times.
✓ Branch 3 taken 46 times.
✓ Branch 4 taken 56 times.
✓ Branch 5 taken 41 times.
✓ Branch 6 taken 24 times.
✓ Branch 7 taken 32 times.
|
2677 | if(y <= 32 && x >= 112 && x <= 128 && Y_DIR(dir) == up) |
| 22548 | 32 | openDir = up; | |
| 22549 |
8/8✓ Branch 0 taken 320 times.
✓ Branch 1 taken 2325 times.
✓ Branch 2 taken 196 times.
✓ Branch 3 taken 124 times.
✓ Branch 4 taken 87 times.
✓ Branch 5 taken 109 times.
✓ Branch 6 taken 56 times.
✓ Branch 7 taken 31 times.
|
2645 | else if(y >= 128 && x >= 112 && x <= 128 && Y_DIR(dir) == down) |
| 22550 | 31 | openDir = down; | |
| 22551 |
5/8✓ Branch 0 taken 1468 times.
✓ Branch 1 taken 1146 times.
✓ Branch 2 taken 279 times.
✓ Branch 3 taken 1189 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 279 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
2614 | else if(y > 72 && y < 88 && x <= 32 && X_DIR(dir) == left) |
| 22552 | ✗ | openDir = left; | |
| 22553 |
5/8✓ Branch 0 taken 1468 times.
✓ Branch 1 taken 1146 times.
✓ Branch 2 taken 279 times.
✓ Branch 3 taken 1189 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 279 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
2614 | else if(y > 72 && y < 88 && x >= 208 && X_DIR(dir) == right) |
| 22554 | ✗ | openDir = right; | |
| 22555 | 2677 | } | |
| 22556 | else | ||
| 22557 | { | ||
| 22558 |
6/6✓ Branch 0 taken 1751 times.
✓ Branch 1 taken 11047 times.
✓ Branch 2 taken 474 times.
✓ Branch 3 taken 1277 times.
✓ Branch 4 taken 61 times.
✓ Branch 5 taken 413 times.
|
12798 | if(y <= 32 && x == 120 && Y_DIR(dir) == up) |
| 22559 | 413 | openDir = up; | |
| 22560 |
6/6✓ Branch 0 taken 1806 times.
✓ Branch 1 taken 10579 times.
✓ Branch 2 taken 252 times.
✓ Branch 3 taken 1554 times.
✓ Branch 4 taken 25 times.
✓ Branch 5 taken 227 times.
|
12385 | else if(y >= 128 && x == 120 && Y_DIR(dir) == down) |
| 22561 | 227 | openDir = down; | |
| 22562 |
6/6✓ Branch 0 taken 1831 times.
✓ Branch 1 taken 10327 times.
✓ Branch 2 taken 339 times.
✓ Branch 3 taken 1492 times.
✓ Branch 4 taken 114 times.
✓ Branch 5 taken 225 times.
|
12158 | else if(y == 80 && x <= 32 && X_DIR(dir) == left) |
| 22563 | 225 | openDir = left; | |
| 22564 |
6/6✓ Branch 0 taken 1606 times.
✓ Branch 1 taken 10327 times.
✓ Branch 2 taken 423 times.
✓ Branch 3 taken 1183 times.
✓ Branch 4 taken 67 times.
✓ Branch 5 taken 356 times.
|
11933 | else if(y == 80 && x >= 208 && X_DIR(dir) == right) |
| 22565 | 356 | openDir = right; | |
| 22566 | } | ||
| 22567 |
2/2✓ Branch 0 taken 14191 times.
✓ Branch 1 taken 1284 times.
|
15475 | if(openDir) |
| 22568 | { | ||
| 22569 | 1284 | int d = *openDir; | |
| 22570 |
2/2✓ Branch 0 taken 364 times.
✓ Branch 1 taken 920 times.
|
1284 | if(tmpscr->door[d]==dLOCKED) |
| 22571 | { | ||
| 22572 |
2/2✓ Branch 0 taken 350 times.
✓ Branch 1 taken 14 times.
|
364 | if(usekey()) |
| 22573 | { | ||
| 22574 | 350 | putdoor(scrollbuf,0,d,dUNLOCKED); | |
| 22575 | 350 | tmpscr->door[d]=dUNLOCKED; | |
| 22576 | 350 | set_doorstate(d); | |
| 22577 | 350 | sfx(WAV_DOOR); | |
| 22578 | 350 | markBmap(-1); | |
| 22579 | 350 | } | |
| 22580 | 14 | else return; | |
| 22581 | 350 | } | |
| 22582 |
2/2✓ Branch 0 taken 864 times.
✓ Branch 1 taken 56 times.
|
920 | else if(tmpscr->door[d]==dBOSS) |
| 22583 | { | ||
| 22584 |
2/2✓ Branch 0 taken 51 times.
✓ Branch 1 taken 5 times.
|
56 | if(game->lvlitems[dlevel]&liBOSSKEY) |
| 22585 | { | ||
| 22586 | 51 | putdoor(scrollbuf,0,d,dOPENBOSS); | |
| 22587 | 51 | tmpscr->door[d]=dOPENBOSS; | |
| 22588 | 51 | set_doorstate(d); | |
| 22589 | 51 | sfx(WAV_DOOR); | |
| 22590 | 51 | markBmap(-1); | |
| 22591 | // Run Boss Key Script | ||
| 22592 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3468 times.
|
3468 | for ( int32_t q = 0; q < MAXITEMS; ++q ) |
| 22593 |
2/2✓ Branch 0 taken 3417 times.
✓ Branch 1 taken 51 times.
|
3468 | if ( itemsbuf[q].family == itype_bosskey ) |
| 22594 | { | ||
| 22595 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 51 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
51 | if (itemsbuf[q].script && !(FFCore.doscript(ScriptType::Item, q) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING))) |
| 22596 | { | ||
| 22597 | ✗ | FFCore.reset_script_engine_data(ScriptType::Item, q); | |
| 22598 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[q].script, q); | |
| 22599 | ✗ | FFCore.deallocateAllScriptOwned(ScriptType::Item, q); | |
| 22600 | ✗ | } | |
| 22601 | 51 | break; | |
| 22602 | } | ||
| 22603 | 51 | } | |
| 22604 | 5 | else return; | |
| 22605 | 51 | } | |
| 22606 | 1265 | } | |
| 22607 | 14129284 | } | |
| 22608 | |||
| 22609 | 14129284 | void HeroClass::checkswordtap() | |
| 22610 | { | ||
| 22611 |
6/6✓ Branch 0 taken 6863422 times.
✓ Branch 1 taken 7265862 times.
✓ Branch 2 taken 40969 times.
✓ Branch 3 taken 6822453 times.
✓ Branch 4 taken 40006 times.
✓ Branch 5 taken 963 times.
|
14129284 | if(attack!=wSword || charging<=0 || pushing<8) return; |
| 22612 | |||
| 22613 | 963 | int32_t bx=x; | |
| 22614 | 963 | int32_t by=y+8; | |
| 22615 | |||
| 22616 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 282 times.
✓ Branch 2 taken 112 times.
✓ Branch 3 taken 307 times.
✓ Branch 4 taken 262 times.
|
963 | switch(dir) |
| 22617 | { | ||
| 22618 | case up: | ||
| 22619 |
2/2✓ Branch 0 taken 217 times.
✓ Branch 1 taken 65 times.
|
282 | if(!Up()) return; |
| 22620 | |||
| 22621 | 217 | by-=16; | |
| 22622 | 217 | break; | |
| 22623 | |||
| 22624 | case down: | ||
| 22625 |
2/2✓ Branch 0 taken 92 times.
✓ Branch 1 taken 20 times.
|
112 | if(!Down()) return; |
| 22626 | |||
| 22627 | 92 | by+=16; | |
| 22628 | 92 | bx+=8; | |
| 22629 | 92 | break; | |
| 22630 | |||
| 22631 | case left: | ||
| 22632 |
2/2✓ Branch 0 taken 168 times.
✓ Branch 1 taken 139 times.
|
307 | if(!Left()) return; |
| 22633 | |||
| 22634 | 168 | bx-=16; | |
| 22635 | 168 | by+=8; | |
| 22636 | 168 | break; | |
| 22637 | |||
| 22638 | case right: | ||
| 22639 |
2/2✓ Branch 0 taken 190 times.
✓ Branch 1 taken 72 times.
|
262 | if(!Right()) return; |
| 22640 | |||
| 22641 | 190 | bx+=16; | |
| 22642 | 190 | by+=8; | |
| 22643 | 190 | break; | |
| 22644 | } | ||
| 22645 | |||
| 22646 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 667 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 667 times.
✓ Branch 4 taken 513 times.
✓ Branch 5 taken 154 times.
|
667 | if(!_walkflag(bx,by,0,SWITCHBLOCK_STATE)) return; |
| 22647 | |||
| 22648 | 513 | attackclk=SWORDTAPFRAME; | |
| 22649 | 513 | pushing=-8; //16 frames between taps | |
| 22650 | 513 | tapping=true; | |
| 22651 | |||
| 22652 | 513 | int32_t type = COMBOTYPE(bx,by); | |
| 22653 | |||
| 22654 |
2/2✓ Branch 0 taken 13 times.
✓ Branch 1 taken 500 times.
|
513 | if(!isCuttableType(type)) |
| 22655 | { | ||
| 22656 | 500 | int tap_sfx = -1; | |
| 22657 | 500 | auto pos = COMBOPOS(bx,by); | |
| 22658 | 500 | bool hollow = false; | |
| 22659 |
2/2✓ Branch 0 taken 500 times.
✓ Branch 1 taken 4000 times.
|
4500 | for(int lyr = 7; lyr >= 0; --lyr) |
| 22660 | { | ||
| 22661 | 4000 | mapscr* m = FFCore.tempScreens[lyr]; | |
| 22662 | 4000 | newcombo const& cmb = combobuf[m->data[pos]]; | |
| 22663 |
1/2✓ Branch 0 taken 4000 times.
✗ Branch 1 not taken.
|
4000 | if(cmb.sfx_tap) |
| 22664 | { | ||
| 22665 | ✗ | tap_sfx = cmb.sfx_tap; | |
| 22666 | ✗ | break; | |
| 22667 | } | ||
| 22668 |
3/4✓ Branch 0 taken 3991 times.
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3991 times.
|
7991 | if(m->sflag[pos] == mfBOMB || m->sflag[pos] == mfSBOMB |
| 22669 |
2/4✓ Branch 0 taken 3991 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3991 times.
✗ Branch 3 not taken.
|
3991 | || cmb.flag == mfBOMB || cmb.flag == mfSBOMB) |
| 22670 | 9 | hollow = true; | |
| 22671 | 4000 | } | |
| 22672 |
2/4✓ Branch 0 taken 500 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 500 times.
|
500 | if(tap_sfx < 0 && get_qr(qr_SEPARATE_BOMBABLE_TAPPING_SFX)) |
| 22673 | { | ||
| 22674 |
3/10✓ Branch 0 taken 491 times.
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 491 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
500 | if(hollow || (tmpscr->door[dir]==dBOMB && ((dir==up||dir==down) |
| 22675 | ✗ | ? (bx>=112 && bx<144 && (by>=144 || by<=32)) | |
| 22676 | ✗ | : by>=72 && by<104 && (bx>=224 || bx<=32)))) | |
| 22677 | 9 | tap_sfx = QMisc.miscsfx[sfxTAP_HOLLOW]; | |
| 22678 | 500 | } | |
| 22679 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 491 times.
|
500 | if(tap_sfx < 0) |
| 22680 | 491 | tap_sfx = QMisc.miscsfx[sfxTAP]; | |
| 22681 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 500 times.
|
500 | if(tap_sfx) |
| 22682 | 500 | sfx(tap_sfx,pan(x.getInt())); | |
| 22683 | 500 | } | |
| 22684 | 14129284 | } | |
| 22685 | |||
| 22686 | 27606 | void HeroClass::fairycircle(int32_t type) | |
| 22687 | { | ||
| 22688 |
2/2✓ Branch 0 taken 23253 times.
✓ Branch 1 taken 4353 times.
|
27606 | if(fairyclk==0) |
| 22689 | { | ||
| 22690 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 4333 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 19 times.
|
4353 | switch(type) |
| 22691 | { | ||
| 22692 | case REFILL_LIFE: | ||
| 22693 |
2/2✓ Branch 0 taken 4177 times.
✓ Branch 1 taken 156 times.
|
4333 | if(didstuff&did_fairy) return; |
| 22694 | |||
| 22695 | 156 | didstuff|=did_fairy; | |
| 22696 | 156 | break; | |
| 22697 | |||
| 22698 | case REFILL_MAGIC: | ||
| 22699 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if(didstuff&did_magic) return; |
| 22700 | |||
| 22701 | 1 | didstuff|=did_magic; | |
| 22702 | 1 | break; | |
| 22703 | |||
| 22704 | case REFILL_ALL: | ||
| 22705 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 2 times.
|
19 | if(didstuff&did_all) return; |
| 22706 | |||
| 22707 | 2 | didstuff|=did_all; | |
| 22708 | 2 | } | |
| 22709 | |||
| 22710 | 159 | refill_what=type; | |
| 22711 | 159 | refill_why=REFILL_FAIRY; | |
| 22712 | 159 | StartRefill(type); | |
| 22713 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 159 times.
|
159 | if (IsSideSwim()) {action=sideswimfreeze; FFCore.setHeroAction(sideswimfreeze);} |
| 22714 | 159 | else {action=freeze; FFCore.setHeroAction(freeze);} | |
| 22715 | 159 | holdclk=0; | |
| 22716 | 159 | hopclk=0; | |
| 22717 | 159 | } | |
| 22718 | |||
| 22719 | 23412 | ++fairyclk; | |
| 22720 | |||
| 22721 |
2/2✓ Branch 0 taken 10557 times.
✓ Branch 1 taken 12855 times.
|
23412 | if(refilling!=REFILL_FAIRYDONE) |
| 22722 | { | ||
| 22723 |
2/2✓ Branch 0 taken 10398 times.
✓ Branch 1 taken 159 times.
|
10557 | if(!refill()) |
| 22724 | 159 | refilling=REFILL_FAIRYDONE; | |
| 22725 | 10557 | } | |
| 22726 | |||
| 22727 |
2/2✓ Branch 0 taken 12697 times.
✓ Branch 1 taken 158 times.
|
12855 | else if(++holdclk>80) |
| 22728 | { | ||
| 22729 | 158 | reset_swordcharge(); | |
| 22730 | 158 | attackclk=0; | |
| 22731 | 158 | action=none; FFCore.setHeroAction(none); | |
| 22732 | 158 | fairyclk=0; | |
| 22733 | 158 | holdclk=0; | |
| 22734 | 158 | refill_why = 0; | |
| 22735 | 158 | refilling=REFILL_NONE; | |
| 22736 | 158 | map_bkgsfx(true); | |
| 22737 | 158 | } | |
| 22738 | 27606 | } | |
| 22739 | |||
| 22740 | 1391371 | int32_t touchcombo(int32_t x,int32_t y) | |
| 22741 | { | ||
| 22742 |
2/2✓ Branch 0 taken 2782674 times.
✓ Branch 1 taken 1391303 times.
|
4173977 | for (int32_t i = 0; i <= 1; ++i) |
| 22743 | { | ||
| 22744 |
2/2✓ Branch 0 taken 1951196 times.
✓ Branch 1 taken 831478 times.
|
2782674 | if(tmpscr2[i].valid!=0) |
| 22745 | { | ||
| 22746 |
2/2✓ Branch 0 taken 667069 times.
✓ Branch 1 taken 164409 times.
|
831478 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 22747 | { | ||
| 22748 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 667069 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
667069 | if (combobuf[MAPCOMBO2(i,x,y)].type == cBRIDGE && !_walkflag_layer(x,y,1, &(tmpscr2[i]))) return 0; |
| 22749 | 667069 | } | |
| 22750 | else | ||
| 22751 | { | ||
| 22752 |
4/4✓ Branch 0 taken 101 times.
✓ Branch 1 taken 164308 times.
✓ Branch 2 taken 33 times.
✓ Branch 3 taken 68 times.
|
164409 | if (combobuf[MAPCOMBO2(i,x,y)].type == cBRIDGE && _effectflag_layer(x,y,1, &(tmpscr2[i]))) return 0; |
| 22753 | } | ||
| 22754 | 831410 | } | |
| 22755 | 2782606 | } | |
| 22756 |
2/2✓ Branch 0 taken 1389685 times.
✓ Branch 1 taken 1618 times.
|
1391303 | if (!_effectflag(x,y,1, -1)) return 0; |
| 22757 | 1389685 | newcombo const& cmb = combobuf[MAPCOMBO(x,y)]; | |
| 22758 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 1389637 times.
|
1389685 | if(cmb.triggerflags[0] & combotriggerONLYGENTRIG) |
| 22759 | 48 | return 0; | |
| 22760 |
3/3✓ Branch 0 taken 3242 times.
✓ Branch 1 taken 1384468 times.
✓ Branch 2 taken 1927 times.
|
1389637 | switch(cmb.type) |
| 22761 | { | ||
| 22762 | case cBSGRAVE: | ||
| 22763 | case cGRAVE: | ||
| 22764 |
3/4✓ Branch 0 taken 2255 times.
✓ Branch 1 taken 987 times.
✓ Branch 2 taken 2255 times.
✗ Branch 3 not taken.
|
3242 | if(MAPFLAG(x,y)||MAPCOMBOFLAG(x,y)) //!DIMITODO: all flags break graves, not just push flags |
| 22765 | { | ||
| 22766 | 987 | break; | |
| 22767 | } | ||
| 22768 | |||
| 22769 | [[fallthrough]]; | ||
| 22770 | case cARMOS: | ||
| 22771 | { | ||
| 22772 | 4182 | return cmb.type; | |
| 22773 | } | ||
| 22774 | } | ||
| 22775 | |||
| 22776 | 1385455 | return 0; | |
| 22777 | 1391371 | } | |
| 22778 | |||
| 22779 | //static int32_t COMBOX(int32_t pos) { return ((pos)%16*16); } | ||
| 22780 | //static int32_t COMBOY(int32_t pos) { return ((pos)&0xF0); } | ||
| 22781 | |||
| 22782 | ✗ | static int32_t GridX(int32_t x) | |
| 22783 | { | ||
| 22784 | ✗ | return (x >> 4) << 4; | |
| 22785 | } | ||
| 22786 | |||
| 22787 | //Snaps 'y' to the combo grid | ||
| 22788 | //Equivalent to calling ComboY(ComboAt(foo,y)); | ||
| 22789 | ✗ | static int32_t GridY(int32_t y) | |
| 22790 | { | ||
| 22791 | ✗ | return (y >> 4) << 4; | |
| 22792 | } | ||
| 22793 | |||
| 22794 | 9 | int32_t grabComboFromPos(int32_t pos, int32_t type) | |
| 22795 | { | ||
| 22796 |
1/2✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
|
63 | for(int32_t lyr = 6; lyr > -1; --lyr) |
| 22797 | { | ||
| 22798 | 63 | int32_t id = FFCore.tempScreens[lyr]->data[pos]; | |
| 22799 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 54 times.
|
63 | if(combobuf[id].type == type) |
| 22800 | 9 | return id; | |
| 22801 | 54 | } | |
| 22802 | ✗ | return -1; | |
| 22803 | 9 | } | |
| 22804 | |||
| 22805 | typedef word spot_t; | ||
| 22806 | static int32_t typeMap[176]; | ||
| 22807 | static int32_t customTypeMap[176]; | ||
| 22808 | static int32_t istrig[176]; | ||
| 22809 | static int32_t heropos = -1; | ||
| 22810 | static const int32_t SPTYPE_SOLID = -1; | ||
| 22811 | enum | ||
| 22812 | { | ||
| 22813 | beamoffs_gr, beamoffs_up, beamoffs_down, beamoffs_left, beamoffs_right, | ||
| 22814 | beamoffs_uleft, beamoffs_uright, beamoffs_dleft, beamoffs_dright, beamoffs_vert, | ||
| 22815 | beamoffs_horz, beamoffs_notup, beamoffs_notdown, beamoffs_notleft, beamoffs_notright, | ||
| 22816 | beamoffs_all, beamoffs_max | ||
| 22817 | }; | ||
| 22818 | struct lightbeam_xy | ||
| 22819 | { | ||
| 22820 | int16_t x; | ||
| 22821 | int16_t y; | ||
| 22822 | ✗ | lightbeam_xy(int32_t nx, int32_t ny) | |
| 22823 | { | ||
| 22824 | ✗ | x = vbound(nx,-32768,32767); | |
| 22825 | ✗ | y = vbound(ny,-32768,32767); | |
| 22826 | ✗ | } | |
| 22827 | ✗ | lightbeam_xy(dword ffpos) | |
| 22828 | { | ||
| 22829 | ✗ | x = int16_t(ffpos >> 16); | |
| 22830 | ✗ | y = int16_t(ffpos & 0xFFFF); | |
| 22831 | ✗ | } | |
| 22832 | ✗ | bool valid() const | |
| 22833 | { | ||
| 22834 | ✗ | return valid(x,y); | |
| 22835 | } | ||
| 22836 | void bound() | ||
| 22837 | { | ||
| 22838 | x = vbound(x,0-16,255+16); | ||
| 22839 | y = vbound(y,0-16,175+16); | ||
| 22840 | } | ||
| 22841 | ✗ | dword ffpos() const | |
| 22842 | { | ||
| 22843 | ✗ | return (word(x)<<16)|word(y&0xFFFF); | |
| 22844 | } | ||
| 22845 | ✗ | size_t pos() const | |
| 22846 | { | ||
| 22847 | ✗ | return COMBOPOS(vbound(x,0,255),vbound(y,0,175)); | |
| 22848 | } | ||
| 22849 | ✗ | bool herocollide(byte beamwid) | |
| 22850 | { | ||
| 22851 | ✗ | int bx = x-beamwid/2, by = y-beamwid/2; | |
| 22852 | ✗ | int hx = Hero.x.getInt(), hy = Hero.y.getInt(); | |
| 22853 | ✗ | return hx+15 >= bx && hx < bx+beamwid | |
| 22854 | ✗ | && hy+15 >= by && hy < by+beamwid; | |
| 22855 | } | ||
| 22856 | ✗ | static bool valid(int32_t x, int32_t y) | |
| 22857 | { | ||
| 22858 | ✗ | return x+16 >= 0 && x-16 < 256 && y+16 >= 0 && y-16 < 176; | |
| 22859 | } | ||
| 22860 | }; | ||
| 22861 | #define SP_VISITED 0x1 | ||
| 22862 | #define SP_FLAGS 0x01E | ||
| 22863 | #define SP_GOFLAGS 0x1E0 | ||
| 22864 | #define SP_MASK (SP_VISITED|SP_FLAGS) | ||
| 22865 | #define SP_FLAG(dir) (0x2<<dir) | ||
| 22866 | #define SP_GOFLAG(dir) (0x20<<dir) | ||
| 22867 | #define BEAM_AGE_LIMIT 512 | ||
| 22868 | 14283 | static void handleBeam(spot_t* grid, size_t age, byte spotdir, int32_t curpos, byte set, bool block, bool refl) | |
| 22869 | { | ||
| 22870 |
2/2✓ Branch 0 taken 7620 times.
✓ Branch 1 taken 6663 times.
|
14283 | if(spotdir > 3) return; //invalid dir |
| 22871 |
2/2✓ Branch 0 taken 5429 times.
✓ Branch 1 taken 1234 times.
|
6663 | int32_t trigflag = set ? (1 << (set-1)) : ~0; |
| 22872 | 6663 | bool doAge = true; | |
| 22873 | 6663 | spot_t f = 0; | |
| 22874 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 70632 times.
|
70632 | while(unsigned(curpos) < 176) |
| 22875 | { | ||
| 22876 | 70632 | bool block_light = false; | |
| 22877 | 70632 | f = SP_GOFLAG(spotdir); | |
| 22878 |
2/2✓ Branch 0 taken 70177 times.
✓ Branch 1 taken 455 times.
|
70632 | if((grid[curpos] & f) == f) |
| 22879 | 455 | return; | |
| 22880 | 70177 | else grid[curpos] |= f; | |
| 22881 | 70177 | f = SP_FLAG(spotdir); | |
| 22882 |
2/2✓ Branch 0 taken 153 times.
✓ Branch 1 taken 70024 times.
|
70177 | if((grid[curpos] & f) != f) |
| 22883 | { | ||
| 22884 | 70024 | grid[curpos] |= f; | |
| 22885 | 70024 | istrig[curpos] |= trigflag; | |
| 22886 | 70024 | doAge = false; | |
| 22887 | 70024 | age = 0; | |
| 22888 | 70024 | } | |
| 22889 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 16931 times.
✓ Branch 2 taken 9603 times.
✓ Branch 3 taken 23595 times.
✓ Branch 4 taken 20048 times.
|
70177 | switch(spotdir) |
| 22890 | { | ||
| 22891 | case up: | ||
| 22892 | 16931 | curpos -= 0x10; | |
| 22893 | 16931 | break; | |
| 22894 | case down: | ||
| 22895 | 9603 | curpos += 0x10; | |
| 22896 | 9603 | break; | |
| 22897 | case left: | ||
| 22898 |
1/2✓ Branch 0 taken 23595 times.
✗ Branch 1 not taken.
|
23595 | if(!(curpos%0x10)) |
| 22899 | ✗ | curpos = -1; | |
| 22900 | 23595 | else --curpos; | |
| 22901 | 23595 | break; | |
| 22902 | case right: | ||
| 22903 | 20048 | ++curpos; | |
| 22904 |
1/2✓ Branch 0 taken 20048 times.
✗ Branch 1 not taken.
|
20048 | if(!(curpos%0x10)) |
| 22905 | ✗ | curpos = -1; | |
| 22906 | 20048 | break; | |
| 22907 | } | ||
| 22908 |
1/2✓ Branch 0 taken 70177 times.
✗ Branch 1 not taken.
|
70177 | if(unsigned(curpos) >= 176) return; |
| 22909 |
2/2✓ Branch 0 taken 6208 times.
✓ Branch 1 taken 63969 times.
|
70177 | switch(typeMap[curpos]) |
| 22910 | { | ||
| 22911 | case SPTYPE_SOLID: case cBLOCKALL: | ||
| 22912 | 6208 | curpos = -1; | |
| 22913 | 6208 | break; | |
| 22914 | } | ||
| 22915 |
3/6✓ Branch 0 taken 1061 times.
✓ Branch 1 taken 69116 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1061 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
70177 | if((curpos==heropos) && block && (spotdir == oppositeDir[Hero.getDir()])) |
| 22916 | ✗ | curpos = -1; | |
| 22917 |
2/2✓ Branch 0 taken 63969 times.
✓ Branch 1 taken 6208 times.
|
70177 | if(unsigned(curpos) >= 176) return; |
| 22918 | |||
| 22919 | 63969 | f = SP_FLAG(oppositeDir[spotdir]); | |
| 22920 |
2/2✓ Branch 0 taken 153 times.
✓ Branch 1 taken 63816 times.
|
63969 | if((grid[curpos] & f) != f) |
| 22921 | { | ||
| 22922 | 63816 | grid[curpos] |= f; | |
| 22923 | 63816 | istrig[curpos] |= trigflag; | |
| 22924 | 63816 | doAge = false; | |
| 22925 | 63816 | age = 0; | |
| 22926 | 63816 | } | |
| 22927 |
2/2✓ Branch 0 taken 153 times.
✓ Branch 1 taken 63816 times.
|
63969 | if(doAge) |
| 22928 | { | ||
| 22929 |
1/2✓ Branch 0 taken 153 times.
✗ Branch 1 not taken.
|
153 | if(++age > BEAM_AGE_LIMIT) |
| 22930 | ✗ | return; | |
| 22931 | 153 | } | |
| 22932 | 63816 | else doAge = true; | |
| 22933 | |||
| 22934 |
4/4✓ Branch 0 taken 875 times.
✓ Branch 1 taken 63094 times.
✓ Branch 2 taken 147 times.
✓ Branch 3 taken 728 times.
|
63969 | if(curpos==heropos && refl) |
| 22935 | 728 | spotdir = Hero.getDir(); | |
| 22936 |
4/8✓ Branch 0 taken 46363 times.
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 9088 times.
✓ Branch 4 taken 7781 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
63241 | else switch(typeMap[curpos]) |
| 22937 | { | ||
| 22938 | case cLIGHTTARGET: | ||
| 22939 | { | ||
| 22940 | 9 | auto cid = grabComboFromPos(curpos, cLIGHTTARGET); | |
| 22941 |
2/4✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✗ Branch 3 not taken.
|
9 | if(cid > -1 && combobuf[cid].usrflags&cflag3) //Blocks light |
| 22942 | ✗ | return; | |
| 22943 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 6 times.
|
9 | if(get_qr(qr_BROKEN_LIGHTBEAM_HITBOX)) |
| 22944 | 6 | spotdir = oppositeDir[spotdir]; | |
| 22945 | 9 | break; | |
| 22946 | } | ||
| 22947 | case cMIRROR: | ||
| 22948 | ✗ | spotdir = oppositeDir[spotdir]; | |
| 22949 | ✗ | break; | |
| 22950 | case cMIRRORSLASH: | ||
| 22951 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 2991 times.
✓ Branch 2 taken 3402 times.
✓ Branch 3 taken 1726 times.
✓ Branch 4 taken 969 times.
|
9088 | switch(spotdir) |
| 22952 | { | ||
| 22953 | case up: | ||
| 22954 | 2991 | spotdir = right; break; | |
| 22955 | case right: | ||
| 22956 | 3402 | spotdir = up; break; | |
| 22957 | case down: | ||
| 22958 | 1726 | spotdir = left; break; | |
| 22959 | case left: | ||
| 22960 | 969 | spotdir = down; break; | |
| 22961 | } | ||
| 22962 | 9088 | break; | |
| 22963 | case cMIRRORBACKSLASH: | ||
| 22964 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 1927 times.
✓ Branch 2 taken 1814 times.
✓ Branch 3 taken 1522 times.
✓ Branch 4 taken 2518 times.
|
7781 | switch(spotdir) |
| 22965 | { | ||
| 22966 | case up: | ||
| 22967 | 1927 | spotdir = left; break; | |
| 22968 | case left: | ||
| 22969 | 1814 | spotdir = up; break; | |
| 22970 | case down: | ||
| 22971 | 1522 | spotdir = right; break; | |
| 22972 | case right: | ||
| 22973 | 2518 | spotdir = down; break; | |
| 22974 | } | ||
| 22975 | 7781 | break; | |
| 22976 | case cMAGICPRISM: | ||
| 22977 | ✗ | for(byte d = 0; d < 4; ++d) | |
| 22978 | { | ||
| 22979 | ✗ | if(d == oppositeDir[spotdir]) continue; | |
| 22980 | ✗ | handleBeam(grid, age, d, curpos, set, block, refl); | |
| 22981 | ✗ | } | |
| 22982 | ✗ | return; | |
| 22983 | case cMAGICPRISM4: | ||
| 22984 | ✗ | for(byte d = 0; d < 4; ++d) | |
| 22985 | { | ||
| 22986 | ✗ | handleBeam(grid, age, d, curpos, set, block, refl); | |
| 22987 | ✗ | } | |
| 22988 | ✗ | return; | |
| 22989 | case cMIRRORNEW: | ||
| 22990 | { | ||
| 22991 | ✗ | auto cid = customTypeMap[curpos]; | |
| 22992 | ✗ | if(unsigned(cid) >= MAXCOMBOS) break; | |
| 22993 | ✗ | newcombo const& cmb = combobuf[cid]; | |
| 22994 | ✗ | byte newdir = cmb.attribytes[spotdir]; | |
| 22995 | ✗ | if(newdir > 7) return; | |
| 22996 | ✗ | if(newdir > 3) break; | |
| 22997 | ✗ | spotdir = newdir; | |
| 22998 | ✗ | break; | |
| 22999 | } | ||
| 23000 | } | ||
| 23001 | } | ||
| 23002 | 14283 | } | |
| 23003 | ✗ | static void handleFFBeam(std::map<dword,spot_t>& grid, size_t age, byte spotdir, lightbeam_xy curxy, byte set, bool block, bool refl, byte beamwid) | |
| 23004 | { | ||
| 23005 | ✗ | if(spotdir > 3) return; //invalid dir | |
| 23006 | ✗ | int32_t trigflag = set ? (1 << (set-1)) : ~0; | |
| 23007 | ✗ | bool doAge = true; | |
| 23008 | ✗ | byte f = 0; | |
| 23009 | ✗ | while(curxy.valid()) | |
| 23010 | { | ||
| 23011 | ✗ | bool block_light = false; | |
| 23012 | ✗ | f = SP_FLAG(spotdir); | |
| 23013 | ✗ | if((grid[curxy.ffpos()] & f) != f) | |
| 23014 | { | ||
| 23015 | ✗ | grid[curxy.ffpos()] |= f; | |
| 23016 | ✗ | istrig[curxy.pos()] |= trigflag; | |
| 23017 | ✗ | doAge = false; | |
| 23018 | ✗ | age = 0; | |
| 23019 | ✗ | } | |
| 23020 | ✗ | switch(spotdir) | |
| 23021 | { | ||
| 23022 | case up: | ||
| 23023 | ✗ | curxy.y -= 16; | |
| 23024 | ✗ | break; | |
| 23025 | case down: | ||
| 23026 | ✗ | curxy.y += 16; | |
| 23027 | ✗ | break; | |
| 23028 | case left: | ||
| 23029 | ✗ | curxy.x -= 16; | |
| 23030 | ✗ | break; | |
| 23031 | case right: | ||
| 23032 | ✗ | curxy.x += 16; | |
| 23033 | ✗ | break; | |
| 23034 | } | ||
| 23035 | ✗ | auto curpos = curxy.pos(); | |
| 23036 | ✗ | switch(typeMap[curpos]) | |
| 23037 | { | ||
| 23038 | case SPTYPE_SOLID: case cBLOCKALL: | ||
| 23039 | ✗ | return; | |
| 23040 | case cMIRRORNEW: | ||
| 23041 | { | ||
| 23042 | ✗ | auto cid = customTypeMap[curpos]; | |
| 23043 | ✗ | if(unsigned(cid) >= MAXCOMBOS) break; | |
| 23044 | ✗ | newcombo const& cmb = combobuf[cid]; | |
| 23045 | ✗ | byte newdir = cmb.attribytes[spotdir]; | |
| 23046 | ✗ | if(newdir > 7) return; | |
| 23047 | ✗ | break; | |
| 23048 | } | ||
| 23049 | } | ||
| 23050 | ✗ | bool collided_hero = heropos > -1 && curxy.herocollide(beamwid); | |
| 23051 | ✗ | if(block && (spotdir == oppositeDir[Hero.getDir()]) && collided_hero) | |
| 23052 | ✗ | return; | |
| 23053 | |||
| 23054 | ✗ | f = SP_FLAG(oppositeDir[spotdir]); | |
| 23055 | ✗ | if((grid[curxy.ffpos()] & f) != f) | |
| 23056 | { | ||
| 23057 | ✗ | grid[curxy.ffpos()] |= f; | |
| 23058 | ✗ | istrig[curpos] |= trigflag; | |
| 23059 | ✗ | doAge = false; | |
| 23060 | ✗ | age = 0; | |
| 23061 | ✗ | } | |
| 23062 | ✗ | if(!curxy.valid()) return; | |
| 23063 | ✗ | if(doAge) | |
| 23064 | { | ||
| 23065 | ✗ | if(++age > BEAM_AGE_LIMIT) | |
| 23066 | ✗ | return; | |
| 23067 | ✗ | } | |
| 23068 | ✗ | else doAge = true; | |
| 23069 | |||
| 23070 | ✗ | if(refl && collided_hero) | |
| 23071 | ✗ | spotdir = Hero.getDir(); | |
| 23072 | ✗ | else switch(typeMap[curpos]) | |
| 23073 | { | ||
| 23074 | case cLIGHTTARGET: | ||
| 23075 | { | ||
| 23076 | ✗ | auto cid = grabComboFromPos(curpos, cLIGHTTARGET); | |
| 23077 | ✗ | if(cid > -1 && combobuf[cid].usrflags&cflag3) //Blocks light | |
| 23078 | ✗ | return; | |
| 23079 | ✗ | if(get_qr(qr_BROKEN_LIGHTBEAM_HITBOX)) | |
| 23080 | ✗ | spotdir = oppositeDir[spotdir]; | |
| 23081 | ✗ | break; | |
| 23082 | } | ||
| 23083 | case cMIRROR: | ||
| 23084 | ✗ | spotdir = oppositeDir[spotdir]; | |
| 23085 | ✗ | break; | |
| 23086 | case cMIRRORSLASH: | ||
| 23087 | ✗ | switch(spotdir) | |
| 23088 | { | ||
| 23089 | case up: | ||
| 23090 | ✗ | spotdir = right; break; | |
| 23091 | case right: | ||
| 23092 | ✗ | spotdir = up; break; | |
| 23093 | case down: | ||
| 23094 | ✗ | spotdir = left; break; | |
| 23095 | case left: | ||
| 23096 | ✗ | spotdir = down; break; | |
| 23097 | } | ||
| 23098 | ✗ | break; | |
| 23099 | case cMIRRORBACKSLASH: | ||
| 23100 | ✗ | switch(spotdir) | |
| 23101 | { | ||
| 23102 | case up: | ||
| 23103 | ✗ | spotdir = left; break; | |
| 23104 | case left: | ||
| 23105 | ✗ | spotdir = up; break; | |
| 23106 | case down: | ||
| 23107 | ✗ | spotdir = right; break; | |
| 23108 | case right: | ||
| 23109 | ✗ | spotdir = down; break; | |
| 23110 | } | ||
| 23111 | ✗ | break; | |
| 23112 | case cMAGICPRISM: | ||
| 23113 | ✗ | for(byte d = 0; d < 4; ++d) | |
| 23114 | { | ||
| 23115 | ✗ | if(d == oppositeDir[spotdir]) continue; | |
| 23116 | ✗ | handleFFBeam(grid, age, d, curxy, set, block, refl, beamwid); | |
| 23117 | ✗ | } | |
| 23118 | ✗ | return; | |
| 23119 | case cMAGICPRISM4: | ||
| 23120 | ✗ | for(byte d = 0; d < 4; ++d) | |
| 23121 | { | ||
| 23122 | ✗ | handleFFBeam(grid, age, d, curxy, set, block, refl, beamwid); | |
| 23123 | ✗ | } | |
| 23124 | ✗ | return; | |
| 23125 | case cMIRRORNEW: | ||
| 23126 | { | ||
| 23127 | ✗ | auto cid = customTypeMap[curpos]; | |
| 23128 | ✗ | if(unsigned(cid) >= MAXCOMBOS) break; | |
| 23129 | ✗ | newcombo const& cmb = combobuf[cid]; | |
| 23130 | ✗ | byte newdir = cmb.attribytes[spotdir]; | |
| 23131 | ✗ | if(newdir > 3) break; | |
| 23132 | ✗ | spotdir = newdir; | |
| 23133 | ✗ | break; | |
| 23134 | } | ||
| 23135 | } | ||
| 23136 | } | ||
| 23137 | ✗ | } | |
| 23138 | |||
| 23139 | #define BEAMID_COLOR0 (1<<24) //must have rightmost 24 bits empty | ||
| 23140 | 14283 | static int get_beamid(newcombo const& cmb) | |
| 23141 | { | ||
| 23142 | //Positive ID is a tile, negative is a color trio. 0 is nil in either case. | ||
| 23143 |
2/2✓ Branch 0 taken 1234 times.
✓ Branch 1 taken 13049 times.
|
14283 | if(cmb.usrflags&cflag1) //use tile/cset style |
| 23144 | 1234 | return std::max(0,cmb.attributes[0]/10000)|(cmb.attribytes[1]%12)<<24; | |
| 23145 | else //use 3-color style | ||
| 23146 | { | ||
| 23147 | 13049 | auto id = -((cmb.attribytes[3]<<16)|(cmb.attribytes[2]<<8)|(cmb.attribytes[1])); | |
| 23148 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13049 times.
|
13049 | if(!id) //0 would clash with the tile/cset style |
| 23149 | ✗ | id = BEAMID_COLOR0; | |
| 23150 | 13049 | return id; | |
| 23151 | } | ||
| 23152 | 14283 | } | |
| 23153 | 14283 | static bool launch_lightbeam(newcombo const& cmb, int32_t pos, | |
| 23154 | std::map<int32_t, spot_t*>& maps, bool refl, bool block) | ||
| 23155 | { | ||
| 23156 | 14283 | int32_t id = get_beamid(cmb); | |
| 23157 | //Get the grid array for this tile/color | ||
| 23158 | spot_t* grid; | ||
| 23159 |
1/2✓ Branch 0 taken 14283 times.
✗ Branch 1 not taken.
|
14283 | if(maps[id]) |
| 23160 | ✗ | grid = maps[id]; | |
| 23161 | else | ||
| 23162 | { | ||
| 23163 | 14283 | grid = new spot_t[176]; | |
| 23164 | 14283 | memset(grid, 0, sizeof(spot_t)*176); | |
| 23165 | 14283 | maps[id] = grid; | |
| 23166 | } | ||
| 23167 | 14283 | byte spotdir = cmb.attribytes[0]; | |
| 23168 |
2/2✓ Branch 0 taken 3861 times.
✓ Branch 1 taken 10422 times.
|
14283 | if(spotdir > 3) |
| 23169 | { | ||
| 23170 | 10422 | grid[pos] |= SP_VISITED; | |
| 23171 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10422 times.
|
10422 | istrig[pos] |= cmb.attribytes[4] ? (1 << (cmb.attribytes[4]-1)) : ~0; |
| 23172 | 10422 | } | |
| 23173 |
4/4✓ Branch 0 taken 10892 times.
✓ Branch 1 taken 3391 times.
✓ Branch 2 taken 8090 times.
✓ Branch 3 taken 2802 times.
|
14283 | if(refl && pos == heropos) |
| 23174 | { | ||
| 23175 | 2802 | spotdir = Hero.getDir(); | |
| 23176 | 2802 | } | |
| 23177 | 14283 | handleBeam(grid, 0, spotdir, pos, cmb.attribytes[4], block, refl); | |
| 23178 | 14283 | return true; | |
| 23179 | } | ||
| 23180 | |||
| 23181 | ✗ | static bool launch_fflightbeam(ffcdata const& ffc, | |
| 23182 | std::map<int32_t, std::map<dword,spot_t>>& ffmaps, bool refl, bool block) | ||
| 23183 | { | ||
| 23184 | ✗ | newcombo const& cmb = combobuf[ffc.data]; | |
| 23185 | ✗ | int32_t id = get_beamid(cmb); | |
| 23186 | //Get the grid array for this tile/color | ||
| 23187 | ✗ | std::map<dword,spot_t>& grid = ffmaps[id]; // grid of (x<<16)|(y&0xFFFF) | |
| 23188 | ✗ | byte spotdir = cmb.attribytes[0]; | |
| 23189 | ✗ | lightbeam_xy sxy(ffc.x+(ffc.hit_width/2), ffc.y+(ffc.hit_height/2)); | |
| 23190 | ✗ | if(spotdir > 3 && sxy.valid()) | |
| 23191 | { | ||
| 23192 | ✗ | grid[sxy.ffpos()] |= SP_VISITED; | |
| 23193 | ✗ | int32_t trigflag = cmb.attribytes[4] ? (1 << (cmb.attribytes[4]-1)) : ~0; | |
| 23194 | ✗ | istrig[sxy.pos()] |= trigflag; | |
| 23195 | ✗ | } | |
| 23196 | ✗ | auto beamwid = cmb.attribytes[5] < 1 ? 8 : cmb.attribytes[5]; | |
| 23197 | ✗ | if(refl && heropos > -1 && sxy.herocollide(beamwid)) | |
| 23198 | { | ||
| 23199 | ✗ | spotdir = Hero.getDir(); | |
| 23200 | ✗ | } | |
| 23201 | ✗ | switch(spotdir) | |
| 23202 | { | ||
| 23203 | case up: | ||
| 23204 | ✗ | sxy.y = zc_min(175,sxy.y); | |
| 23205 | ✗ | break; | |
| 23206 | case down: | ||
| 23207 | ✗ | sxy.y = zc_max(0,sxy.y); | |
| 23208 | ✗ | break; | |
| 23209 | case left: | ||
| 23210 | ✗ | sxy.x = zc_min(255,sxy.x); | |
| 23211 | ✗ | break; | |
| 23212 | case right: | ||
| 23213 | ✗ | sxy.x = zc_max(0,sxy.x); | |
| 23214 | ✗ | break; | |
| 23215 | } | ||
| 23216 | ✗ | handleFFBeam(grid, 0, spotdir, sxy, cmb.attribytes[4], block, refl, beamwid); | |
| 23217 | ✗ | return true; | |
| 23218 | } | ||
| 23219 | |||
| 23220 | 14283 | static BITMAP* generate_beam_bitmap(int32_t id) | |
| 23221 | { | ||
| 23222 | 14283 | BITMAP* cbmp = create_bitmap_ex(8, 16*beamoffs_max, 16); | |
| 23223 | 14283 | clear_bitmap(cbmp); | |
| 23224 |
3/4✓ Branch 0 taken 1234 times.
✓ Branch 1 taken 13049 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1234 times.
|
14283 | if(id < 0 || id == BEAMID_COLOR0) |
| 23225 | { | ||
| 23226 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13049 times.
|
13049 | int cid = (id == BEAMID_COLOR0) ? 0 : abs(id); |
| 23227 | 13049 | byte c_inner = (cid & 0x0000FF); | |
| 23228 | 13049 | byte c_middle = (cid & 0x00FF00)>>8; | |
| 23229 | 13049 | byte c_outter = (cid & 0xFF0000)>>16; | |
| 23230 |
2/2✓ Branch 0 taken 195735 times.
✓ Branch 1 taken 13049 times.
|
208784 | for(size_t q = 1; q < beamoffs_max; ++q) |
| 23231 | { | ||
| 23232 | 195735 | circlefill(cbmp, 16*q+8, 8, 3, c_outter); | |
| 23233 | 195735 | circlefill(cbmp, 16*q+7, 8, 3, c_outter); | |
| 23234 | 195735 | circlefill(cbmp, 16*q+8, 7, 3, c_outter); | |
| 23235 | 195735 | circlefill(cbmp, 16*q+7, 7, 3, c_outter); | |
| 23236 | 195735 | circlefill(cbmp, 16*q+8, 8, 1, c_middle); | |
| 23237 | 195735 | circlefill(cbmp, 16*q+7, 8, 1, c_middle); | |
| 23238 | 195735 | circlefill(cbmp, 16*q+8, 7, 1, c_middle); | |
| 23239 | 195735 | circlefill(cbmp, 16*q+7, 7, 1, c_middle); | |
| 23240 | 195735 | circlefill(cbmp, 16*q+8, 8, 0, c_inner); | |
| 23241 | 195735 | circlefill(cbmp, 16*q+7, 8, 0, c_inner); | |
| 23242 | 195735 | circlefill(cbmp, 16*q+8, 7, 0, c_inner); | |
| 23243 | 195735 | circlefill(cbmp, 16*q+7, 7, 0, c_inner); | |
| 23244 | 195735 | } | |
| 23245 | //beamoffs_gr | ||
| 23246 | 13049 | circlefill(cbmp, 16*beamoffs_gr+8, 8, 7, c_outter); | |
| 23247 | 13049 | circlefill(cbmp, 16*beamoffs_gr+7, 8, 7, c_outter); | |
| 23248 | 13049 | circlefill(cbmp, 16*beamoffs_gr+8, 7, 7, c_outter); | |
| 23249 | 13049 | circlefill(cbmp, 16*beamoffs_gr+7, 7, 7, c_outter); | |
| 23250 | 13049 | circlefill(cbmp, 16*beamoffs_gr+8, 8, 5, c_middle); | |
| 23251 | 13049 | circlefill(cbmp, 16*beamoffs_gr+7, 8, 5, c_middle); | |
| 23252 | 13049 | circlefill(cbmp, 16*beamoffs_gr+8, 7, 5, c_middle); | |
| 23253 | 13049 | circlefill(cbmp, 16*beamoffs_gr+7, 7, 5, c_middle); | |
| 23254 | 13049 | circlefill(cbmp, 16*beamoffs_gr+8, 8, 3, c_inner); | |
| 23255 | 13049 | circlefill(cbmp, 16*beamoffs_gr+7, 8, 3, c_inner); | |
| 23256 | 13049 | circlefill(cbmp, 16*beamoffs_gr+8, 7, 3, c_inner); | |
| 23257 | 13049 | circlefill(cbmp, 16*beamoffs_gr+7, 7, 3, c_inner); | |
| 23258 | //beamoffs_up | ||
| 23259 | 13049 | rectfill(cbmp, 16*beamoffs_up+4, 0, 16*beamoffs_up+11, 7, c_outter); | |
| 23260 | 13049 | rectfill(cbmp, 16*beamoffs_up+6, 0, 16*beamoffs_up+9, 7, c_middle); | |
| 23261 | 13049 | rectfill(cbmp, 16*beamoffs_up+7, 0, 16*beamoffs_up+8, 7, c_inner); | |
| 23262 | //beamoffs_down | ||
| 23263 | 13049 | rectfill(cbmp, 16*beamoffs_down+4, 8, 16*beamoffs_down+11, 15, c_outter); | |
| 23264 | 13049 | rectfill(cbmp, 16*beamoffs_down+6, 8, 16*beamoffs_down+9, 15, c_middle); | |
| 23265 | 13049 | rectfill(cbmp, 16*beamoffs_down+7, 8, 16*beamoffs_down+8, 15, c_inner); | |
| 23266 | //beamoffs_left | ||
| 23267 | 13049 | rectfill(cbmp, 16*beamoffs_left, 4, 16*beamoffs_left+7, 11, c_outter); | |
| 23268 | 13049 | rectfill(cbmp, 16*beamoffs_left, 6, 16*beamoffs_left+7, 9, c_middle); | |
| 23269 | 13049 | rectfill(cbmp, 16*beamoffs_left, 7, 16*beamoffs_left+7, 8, c_inner); | |
| 23270 | //beamoffs_right | ||
| 23271 | 13049 | rectfill(cbmp, 16*beamoffs_right+8, 4, 16*beamoffs_right+15, 11, c_outter); | |
| 23272 | 13049 | rectfill(cbmp, 16*beamoffs_right+8, 6, 16*beamoffs_right+15, 9, c_middle); | |
| 23273 | 13049 | rectfill(cbmp, 16*beamoffs_right+8, 7, 16*beamoffs_right+15, 8, c_inner); | |
| 23274 | //beamoffs_uleft | ||
| 23275 | 13049 | rectfill(cbmp, 16*beamoffs_uleft+4, 0, 16*beamoffs_uleft+11, 7, c_outter); | |
| 23276 | 13049 | rectfill(cbmp, 16*beamoffs_uleft, 4, 16*beamoffs_uleft+7, 11, c_outter); | |
| 23277 | 13049 | rectfill(cbmp, 16*beamoffs_uleft, 6, 16*beamoffs_uleft+7, 9, c_middle); | |
| 23278 | 13049 | rectfill(cbmp, 16*beamoffs_uleft+6, 0, 16*beamoffs_uleft+9, 7, c_middle); | |
| 23279 | 13049 | rectfill(cbmp, 16*beamoffs_uleft+7, 0, 16*beamoffs_uleft+8, 7, c_inner); | |
| 23280 | 13049 | rectfill(cbmp, 16*beamoffs_uleft, 7, 16*beamoffs_uleft+7, 8, c_inner); | |
| 23281 | //beamoffs_uright | ||
| 23282 | 13049 | rectfill(cbmp, 16*beamoffs_uright+4, 0, 16*beamoffs_uright+11, 7, c_outter); | |
| 23283 | 13049 | rectfill(cbmp, 16*beamoffs_uright+8, 4, 16*beamoffs_uright+15, 11, c_outter); | |
| 23284 | 13049 | rectfill(cbmp, 16*beamoffs_uright+8, 6, 16*beamoffs_uright+15, 9, c_middle); | |
| 23285 | 13049 | rectfill(cbmp, 16*beamoffs_uright+6, 0, 16*beamoffs_uright+9, 7, c_middle); | |
| 23286 | 13049 | rectfill(cbmp, 16*beamoffs_uright+7, 0, 16*beamoffs_uright+8, 7, c_inner); | |
| 23287 | 13049 | rectfill(cbmp, 16*beamoffs_uright+8, 7, 16*beamoffs_uright+15, 8, c_inner); | |
| 23288 | //beamoffs_dleft | ||
| 23289 | 13049 | rectfill(cbmp, 16*beamoffs_dleft+4, 8, 16*beamoffs_dleft+11, 15, c_outter); | |
| 23290 | 13049 | rectfill(cbmp, 16*beamoffs_dleft, 4, 16*beamoffs_dleft+7, 11, c_outter); | |
| 23291 | 13049 | rectfill(cbmp, 16*beamoffs_dleft, 6, 16*beamoffs_dleft+7, 9, c_middle); | |
| 23292 | 13049 | rectfill(cbmp, 16*beamoffs_dleft+6, 8, 16*beamoffs_dleft+9, 15, c_middle); | |
| 23293 | 13049 | rectfill(cbmp, 16*beamoffs_dleft+7, 8, 16*beamoffs_dleft+8, 15, c_inner); | |
| 23294 | 13049 | rectfill(cbmp, 16*beamoffs_dleft, 7, 16*beamoffs_dleft+7, 8, c_inner); | |
| 23295 | //beamoffs_dright | ||
| 23296 | 13049 | rectfill(cbmp, 16*beamoffs_dright+4, 8, 16*beamoffs_dright+11, 15, c_outter); | |
| 23297 | 13049 | rectfill(cbmp, 16*beamoffs_dright+8, 4, 16*beamoffs_dright+15, 11, c_outter); | |
| 23298 | 13049 | rectfill(cbmp, 16*beamoffs_dright+8, 6, 16*beamoffs_dright+15, 9, c_middle); | |
| 23299 | 13049 | rectfill(cbmp, 16*beamoffs_dright+6, 8, 16*beamoffs_dright+9, 15, c_middle); | |
| 23300 | 13049 | rectfill(cbmp, 16*beamoffs_dright+7, 8, 16*beamoffs_dright+8, 15, c_inner); | |
| 23301 | 13049 | rectfill(cbmp, 16*beamoffs_dright+8, 7, 16*beamoffs_dright+15, 8, c_inner); | |
| 23302 | //beamoffs_vert | ||
| 23303 | 13049 | rectfill(cbmp, 16*beamoffs_vert+4, 0, 16*beamoffs_vert+11, 15, c_outter); | |
| 23304 | 13049 | rectfill(cbmp, 16*beamoffs_vert+6, 0, 16*beamoffs_vert+9, 15, c_middle); | |
| 23305 | 13049 | rectfill(cbmp, 16*beamoffs_vert+7, 0, 16*beamoffs_vert+8, 15, c_inner); | |
| 23306 | //beamoffs_horz | ||
| 23307 | 13049 | rectfill(cbmp, 16*beamoffs_horz, 4, 16*beamoffs_horz+15, 11, c_outter); | |
| 23308 | 13049 | rectfill(cbmp, 16*beamoffs_horz, 6, 16*beamoffs_horz+15, 9, c_middle); | |
| 23309 | 13049 | rectfill(cbmp, 16*beamoffs_horz, 7, 16*beamoffs_horz+15, 8, c_inner); | |
| 23310 | //beamoffs_notup | ||
| 23311 | 13049 | rectfill(cbmp, 16*beamoffs_notup, 4, 16*beamoffs_notup+15, 11, c_outter); | |
| 23312 | 13049 | rectfill(cbmp, 16*beamoffs_notup+4, 8, 16*beamoffs_notup+11, 15, c_outter); | |
| 23313 | 13049 | rectfill(cbmp, 16*beamoffs_notup+6, 8, 16*beamoffs_notup+9, 15, c_middle); | |
| 23314 | 13049 | rectfill(cbmp, 16*beamoffs_notup, 6, 16*beamoffs_notup+15, 9, c_middle); | |
| 23315 | 13049 | rectfill(cbmp, 16*beamoffs_notup, 7, 16*beamoffs_notup+15, 8, c_inner); | |
| 23316 | 13049 | rectfill(cbmp, 16*beamoffs_notup+7, 8, 16*beamoffs_notup+8, 15, c_inner); | |
| 23317 | //beamoffs_notdown | ||
| 23318 | 13049 | rectfill(cbmp, 16*beamoffs_notdown, 4, 16*beamoffs_notdown+15, 11, c_outter); | |
| 23319 | 13049 | rectfill(cbmp, 16*beamoffs_notdown+4, 0, 16*beamoffs_notdown+11, 7, c_outter); | |
| 23320 | 13049 | rectfill(cbmp, 16*beamoffs_notdown+6, 0, 16*beamoffs_notdown+9, 7, c_middle); | |
| 23321 | 13049 | rectfill(cbmp, 16*beamoffs_notdown, 6, 16*beamoffs_notdown+15, 9, c_middle); | |
| 23322 | 13049 | rectfill(cbmp, 16*beamoffs_notdown, 7, 16*beamoffs_notdown+15, 8, c_inner); | |
| 23323 | 13049 | rectfill(cbmp, 16*beamoffs_notdown+7, 0, 16*beamoffs_notdown+8, 7, c_inner); | |
| 23324 | //beamoffs_notleft | ||
| 23325 | 13049 | rectfill(cbmp, 16*beamoffs_notleft+4, 0, 16*beamoffs_notleft+11, 15, c_outter); | |
| 23326 | 13049 | rectfill(cbmp, 16*beamoffs_notleft+8, 4, 16*beamoffs_notleft+15, 11, c_outter); | |
| 23327 | 13049 | rectfill(cbmp, 16*beamoffs_notleft+8, 6, 16*beamoffs_notleft+15, 9, c_middle); | |
| 23328 | 13049 | rectfill(cbmp, 16*beamoffs_notleft+6, 0, 16*beamoffs_notleft+9, 15, c_middle); | |
| 23329 | 13049 | rectfill(cbmp, 16*beamoffs_notleft+7, 0, 16*beamoffs_notleft+8, 15, c_inner); | |
| 23330 | 13049 | rectfill(cbmp, 16*beamoffs_notleft+8, 7, 16*beamoffs_notleft+15, 8, c_inner); | |
| 23331 | //beamoffs_notright | ||
| 23332 | 13049 | rectfill(cbmp, 16*beamoffs_notright+4, 0, 16*beamoffs_notright+11, 15, c_outter); | |
| 23333 | 13049 | rectfill(cbmp, 16*beamoffs_notright, 4, 16*beamoffs_notright+7, 11, c_outter); | |
| 23334 | 13049 | rectfill(cbmp, 16*beamoffs_notright, 6, 16*beamoffs_notright+7, 9, c_middle); | |
| 23335 | 13049 | rectfill(cbmp, 16*beamoffs_notright+6, 0, 16*beamoffs_notright+9, 15, c_middle); | |
| 23336 | 13049 | rectfill(cbmp, 16*beamoffs_notright+7, 0, 16*beamoffs_notright+8, 15, c_inner); | |
| 23337 | 13049 | rectfill(cbmp, 16*beamoffs_notright, 7, 16*beamoffs_notright+7, 8, c_inner); | |
| 23338 | //beamoffs_all | ||
| 23339 | 13049 | rectfill(cbmp, 16*beamoffs_all+4, 0, 16*beamoffs_all+11, 15, c_outter); | |
| 23340 | 13049 | rectfill(cbmp, 16*beamoffs_all, 4, 16*beamoffs_all+15, 11, c_outter); | |
| 23341 | 13049 | rectfill(cbmp, 16*beamoffs_all, 6, 16*beamoffs_all+15, 9, c_middle); | |
| 23342 | 13049 | rectfill(cbmp, 16*beamoffs_all+6, 0, 16*beamoffs_all+9, 15, c_middle); | |
| 23343 | 13049 | rectfill(cbmp, 16*beamoffs_all+7, 0, 16*beamoffs_all+8, 15, c_inner); | |
| 23344 | 13049 | rectfill(cbmp, 16*beamoffs_all, 7, 16*beamoffs_all+15, 8, c_inner); | |
| 23345 | 13049 | } | |
| 23346 | else | ||
| 23347 | { | ||
| 23348 | 1234 | int32_t tile = (id&0xFFFFFF); | |
| 23349 | 1234 | int32_t cs = (id>>24); | |
| 23350 |
2/2✓ Branch 0 taken 19744 times.
✓ Branch 1 taken 1234 times.
|
20978 | for(size_t q = 0; q < beamoffs_max; ++q) |
| 23351 | 19744 | puttile16(cbmp, tile+q, q*16, 0, cs, 0); | |
| 23352 | } | ||
| 23353 | 14283 | return cbmp; | |
| 23354 | } | ||
| 23355 | |||
| 23356 | 2513808 | static int32_t get_beamoffs(spot_t val) | |
| 23357 | { | ||
| 23358 |
12/17✗ Branch 0 not taken.
✓ Branch 1 taken 2444313 times.
✓ Branch 2 taken 1469 times.
✓ Branch 3 taken 1188 times.
✓ Branch 4 taken 1795 times.
✓ Branch 5 taken 1768 times.
✓ Branch 6 taken 14821 times.
✓ Branch 7 taken 31678 times.
✓ Branch 8 taken 4877 times.
✓ Branch 9 taken 3412 times.
✓ Branch 10 taken 4161 times.
✓ Branch 11 taken 3791 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 535 times.
|
2513808 | switch((val&SP_MASK)>>1) |
| 23359 | { | ||
| 23360 | 2444313 | case 0: default: | |
| 23361 |
2/2✓ Branch 0 taken 7620 times.
✓ Branch 1 taken 2436693 times.
|
2444313 | if(val) |
| 23362 | 7620 | return beamoffs_gr; | |
| 23363 | 2436693 | return -1; | |
| 23364 | case 0b0001: | ||
| 23365 | 1469 | return beamoffs_up; | |
| 23366 | case 0b0010: | ||
| 23367 | 1188 | return beamoffs_down; | |
| 23368 | case 0b0100: | ||
| 23369 | 1795 | return beamoffs_left; | |
| 23370 | case 0b1000: | ||
| 23371 | 1768 | return beamoffs_right; | |
| 23372 | case 0b0011: | ||
| 23373 | 14821 | return beamoffs_vert; | |
| 23374 | case 0b1100: | ||
| 23375 | 31678 | return beamoffs_horz; | |
| 23376 | case 0b0101: | ||
| 23377 | 4877 | return beamoffs_uleft; | |
| 23378 | case 0b1001: | ||
| 23379 | 3412 | return beamoffs_uright; | |
| 23380 | case 0b0110: | ||
| 23381 | 4161 | return beamoffs_dleft; | |
| 23382 | case 0b1010: | ||
| 23383 | 3791 | return beamoffs_dright; | |
| 23384 | case 0b1110: | ||
| 23385 | ✗ | return beamoffs_notup; | |
| 23386 | case 0b1101: | ||
| 23387 | ✗ | return beamoffs_notdown; | |
| 23388 | case 0b1011: | ||
| 23389 | ✗ | return beamoffs_notleft; | |
| 23390 | case 0b0111: | ||
| 23391 | ✗ | return beamoffs_notright; | |
| 23392 | case 0b1111: | ||
| 23393 | 535 | return beamoffs_all; | |
| 23394 | } | ||
| 23395 | return -1; | ||
| 23396 | 2513808 | } | |
| 23397 | |||
| 23398 | 14151802 | void HeroClass::handleSpotlights() | |
| 23399 | { | ||
| 23400 | static bool had_spotlight = true; | ||
| 23401 | 14151802 | word c = tmpscr->numFFC(); | |
| 23402 |
2/2✓ Branch 0 taken 14283 times.
✓ Branch 1 taken 14137519 times.
|
14151802 | if(cpos_exists_spotlight()) |
| 23403 | { | ||
| 23404 | //Store each different tile/color as grids | ||
| 23405 | 14283 | std::map<int32_t, spot_t*> maps; | |
| 23406 | 14283 | std::map<int32_t, std::map<dword, spot_t>> ffmaps; | |
| 23407 |
1/2✓ Branch 0 taken 14283 times.
✗ Branch 1 not taken.
|
14283 | int32_t shieldid = getCurrentShield(false); |
| 23408 |
2/8✓ Branch 0 taken 14283 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 14283 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
14283 | if((itemsbuf[shieldid].flags & item_flag9) && !usingActiveShield(shieldid)) |
| 23409 | ✗ | shieldid = -1; | |
| 23410 |
2/2✓ Branch 0 taken 3391 times.
✓ Branch 1 taken 10892 times.
|
14283 | bool refl = shieldid > -1 && (itemsbuf[shieldid].misc2 & sh_lightbeam); |
| 23411 |
3/4✓ Branch 0 taken 3391 times.
✓ Branch 1 taken 10892 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3391 times.
|
14283 | bool block = !refl && shieldid > -1 && (itemsbuf[shieldid].misc1 & sh_lightbeam); |
| 23412 |
3/6✓ Branch 0 taken 14283 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14283 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 14283 times.
✗ Branch 5 not taken.
|
14283 | heropos = COMBOPOS_B(x.getInt()+8,y.getInt()+8); |
| 23413 | 14283 | memset(istrig, 0, sizeof(istrig)); | |
| 23414 |
1/2✓ Branch 0 taken 14283 times.
✗ Branch 1 not taken.
|
14283 | clear_bitmap(lightbeam_bmp); |
| 23415 | |||
| 23416 |
2/2✓ Branch 0 taken 2513808 times.
✓ Branch 1 taken 14283 times.
|
2528091 | for(size_t pos = 0; pos < 176; ++pos) |
| 23417 | { | ||
| 23418 | 2513808 | typeMap[pos] = 0; | |
| 23419 | 2513808 | customTypeMap[pos] = -1; | |
| 23420 |
2/2✓ Branch 0 taken 2334689 times.
✓ Branch 1 taken 17592933 times.
|
19927622 | for(int32_t lyr = 6; lyr > -1; --lyr) |
| 23421 | { | ||
| 23422 | 17592933 | auto cid = FFCore.tempScreens[lyr]->data[pos]; | |
| 23423 | 17592933 | newcombo const* cmb = &combobuf[cid]; | |
| 23424 |
3/4✓ Branch 0 taken 175417 times.
✓ Branch 1 taken 17413814 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3702 times.
|
17592933 | switch(cmb->type) |
| 23425 | { | ||
| 23426 | case cMIRROR: case cMIRRORSLASH: case cMIRRORBACKSLASH: | ||
| 23427 | case cMAGICPRISM: case cMAGICPRISM4: | ||
| 23428 | case cBLOCKALL: case cLIGHTTARGET: | ||
| 23429 | 175417 | typeMap[pos] = cmb->type; | |
| 23430 | 175417 | break; | |
| 23431 | case cMIRRORNEW: | ||
| 23432 | ✗ | typeMap[pos] = cMIRRORNEW; | |
| 23433 | ✗ | customTypeMap[pos] = cid; | |
| 23434 | ✗ | break; | |
| 23435 | case cGLASS: | ||
| 23436 | 3702 | typeMap[pos] = 0; | |
| 23437 | 3702 | break; | |
| 23438 | default: | ||
| 23439 | { | ||
| 23440 |
4/4✓ Branch 0 taken 7358582 times.
✓ Branch 1 taken 10055232 times.
✓ Branch 2 taken 6017045 times.
✓ Branch 3 taken 1341537 times.
|
17413814 | if(lyr < 3 && (cmb->walk & 0xF)) |
| 23441 | { | ||
| 23442 | 1341537 | typeMap[pos] = SPTYPE_SOLID; | |
| 23443 | 1341537 | } | |
| 23444 | 17413814 | continue; //next layer | |
| 23445 | } | ||
| 23446 | } | ||
| 23447 | 179119 | break; //hit a combo type | |
| 23448 | } | ||
| 23449 |
4/4✓ Branch 0 taken 2296624 times.
✓ Branch 1 taken 217184 times.
✓ Branch 2 taken 1421859 times.
✓ Branch 3 taken 874765 times.
|
2513808 | if(!get_qr(qr_SPOTLIGHT_IGNR_SOLIDOBJ) && !typeMap[pos]) |
| 23450 | { | ||
| 23451 |
8/16✓ Branch 0 taken 874765 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 874765 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 874765 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 874765 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 874765 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 874765 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 874765 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 874765 times.
✗ Branch 15 not taken.
|
874765 | if(collide_object(COMBOX(pos),COMBOY(pos),16,16,this)) |
| 23452 | ✗ | typeMap[pos] = SPTYPE_SOLID; | |
| 23453 | 874765 | } | |
| 23454 | 2513808 | } | |
| 23455 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14283 times.
|
14283 | if(unsigned(heropos) < 176) |
| 23456 | { | ||
| 23457 |
2/2✓ Branch 0 taken 252 times.
✓ Branch 1 taken 14031 times.
|
14283 | switch(typeMap[heropos]) |
| 23458 | { | ||
| 23459 | case SPTYPE_SOLID: case cBLOCKALL: | ||
| 23460 | 252 | heropos = -1; //Blocked from hitting player | |
| 23461 | 252 | } | |
| 23462 | 14283 | } | |
| 23463 | |||
| 23464 |
2/2✓ Branch 0 taken 99981 times.
✓ Branch 1 taken 14283 times.
|
114264 | for(size_t layer = 0; layer < 7; ++layer) |
| 23465 | { | ||
| 23466 | 99981 | mapscr* curlayer = FFCore.tempScreens[layer]; | |
| 23467 |
2/2✓ Branch 0 taken 17596656 times.
✓ Branch 1 taken 99981 times.
|
17696637 | for(size_t pos = 0; pos < 176; ++pos) |
| 23468 | { | ||
| 23469 | 17596656 | newcombo const& cmb = combobuf[curlayer->data[pos]]; | |
| 23470 |
2/2✓ Branch 0 taken 17582373 times.
✓ Branch 1 taken 14283 times.
|
17596656 | if(cmb.type == cSPOTLIGHT) |
| 23471 |
1/2✓ Branch 0 taken 14283 times.
✗ Branch 1 not taken.
|
14283 | launch_lightbeam(cmb,pos,maps,refl,block); |
| 23472 | 17596656 | } | |
| 23473 | 99981 | } | |
| 23474 |
2/2✓ Branch 0 taken 3702 times.
✓ Branch 1 taken 14283 times.
|
17985 | for(word i=0; i<c; i++) |
| 23475 | { | ||
| 23476 | 3702 | ffcdata& ffc = tmpscr->ffcs[i]; | |
| 23477 |
3/6✓ Branch 0 taken 3702 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3702 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 3702 times.
|
3702 | if(ffc.flags & (ffc_changer|ffc_ethereal)) |
| 23478 | ✗ | continue; | |
| 23479 | 3702 | newcombo const& cmb = combobuf[ffc.data]; | |
| 23480 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 3702 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
3702 | if(cmb.type == cSPOTLIGHT && (cmb.usrflags&cflag2)) |
| 23481 | ✗ | launch_fflightbeam(ffc,ffmaps,refl,block); | |
| 23482 | 3702 | } | |
| 23483 | |||
| 23484 |
1/2✓ Branch 0 taken 14283 times.
✗ Branch 1 not taken.
|
14283 | lightbeam_present = !maps.empty() || !ffmaps.empty(); |
| 23485 | |||
| 23486 | //Draw visuals | ||
| 23487 |
2/2✓ Branch 0 taken 14283 times.
✓ Branch 1 taken 14283 times.
|
28566 | for(auto it = maps.begin(); it != maps.end();) |
| 23488 | { | ||
| 23489 | 14283 | int32_t id = it->first; | |
| 23490 | 14283 | spot_t* grid = it->second; | |
| 23491 |
1/2✓ Branch 0 taken 14283 times.
✗ Branch 1 not taken.
|
14283 | BITMAP* cbmp = generate_beam_bitmap(id); |
| 23492 |
2/2✓ Branch 0 taken 14283 times.
✓ Branch 1 taken 2513808 times.
|
2528091 | for(size_t pos = 0; pos < 176; ++pos) |
| 23493 | { | ||
| 23494 |
1/2✓ Branch 0 taken 2513808 times.
✗ Branch 1 not taken.
|
2513808 | int32_t offs = get_beamoffs(grid[pos]); |
| 23495 |
2/2✓ Branch 0 taken 77115 times.
✓ Branch 1 taken 2436693 times.
|
2513808 | if(offs > -1) |
| 23496 |
3/6✓ Branch 0 taken 77115 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77115 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 77115 times.
✗ Branch 5 not taken.
|
77115 | masked_blit(cbmp, lightbeam_bmp, offs*16, 0, COMBOX(pos), COMBOY(pos), 16, 16); |
| 23497 | 2513808 | } | |
| 23498 |
1/2✓ Branch 0 taken 14283 times.
✗ Branch 1 not taken.
|
14283 | destroy_bitmap(cbmp); |
| 23499 |
1/2✓ Branch 0 taken 14283 times.
✗ Branch 1 not taken.
|
14283 | delete[] it->second; |
| 23500 |
1/2✓ Branch 0 taken 14283 times.
✗ Branch 1 not taken.
|
14283 | it = maps.erase(it); |
| 23501 | } | ||
| 23502 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14283 times.
|
14283 | for(auto it = ffmaps.begin(); it != ffmaps.end();) |
| 23503 | { | ||
| 23504 | ✗ | int32_t id = it->first; | |
| 23505 | ✗ | std::map<dword,spot_t> const& grid = it->second; | |
| 23506 | ✗ | BITMAP* cbmp = generate_beam_bitmap(id); | |
| 23507 | ✗ | for(auto it2 = grid.begin(); it2 != grid.end(); ++it2) | |
| 23508 | { | ||
| 23509 | ✗ | lightbeam_xy ffxy(it2->first); | |
| 23510 | ✗ | int32_t offs = get_beamoffs(it2->second); | |
| 23511 | ✗ | if(offs > -1) | |
| 23512 | ✗ | masked_blit(cbmp, lightbeam_bmp, offs*16, 0, ffxy.x-8, ffxy.y-8, 16, 16); | |
| 23513 | ✗ | } | |
| 23514 | ✗ | destroy_bitmap(cbmp); | |
| 23515 | ✗ | it = ffmaps.erase(it); | |
| 23516 | } | ||
| 23517 | 14283 | } | |
| 23518 | else | ||
| 23519 | { | ||
| 23520 |
2/2✓ Branch 0 taken 14137253 times.
✓ Branch 1 taken 266 times.
|
14137519 | if(had_spotlight) |
| 23521 | { | ||
| 23522 | 266 | memset(istrig, 0, sizeof(istrig)); | |
| 23523 | 266 | clear_bitmap(lightbeam_bmp); | |
| 23524 | 266 | } | |
| 23525 | 14137519 | lightbeam_present = false; | |
| 23526 | } | ||
| 23527 | 14151802 | had_spotlight = lightbeam_present; | |
| 23528 | //Check triggers | ||
| 23529 | 14151802 | bool hastrigs = false, istrigged = true; | |
| 23530 | 14151802 | bool alltrig = getmapflag(mLIGHTBEAM); | |
| 23531 |
2/2✓ Branch 0 taken 99062614 times.
✓ Branch 1 taken 14151802 times.
|
113214416 | for(size_t layer = 0; layer < 7; ++layer) |
| 23532 | { | ||
| 23533 | 99062614 | mapscr* curlayer = FFCore.tempScreens[layer]; | |
| 23534 |
2/2✓ Branch 0 taken 17435020064 times.
✓ Branch 1 taken 99062614 times.
|
17534082678 | for(size_t pos = 0; pos < 176; ++pos) |
| 23535 | { | ||
| 23536 | 17435020064 | newcombo const* cmb = &combobuf[curlayer->data[pos]]; | |
| 23537 |
2/2✓ Branch 0 taken 13121 times.
✓ Branch 1 taken 17435006943 times.
|
17435020064 | if(cmb->type == cLIGHTTARGET) |
| 23538 | { | ||
| 23539 |
2/2✓ Branch 0 taken 11887 times.
✓ Branch 1 taken 1234 times.
|
13121 | int32_t trigflag = cmb->attribytes[4] ? (1 << (cmb->attribytes[4]-1)) : ~0; |
| 23540 | 13121 | hastrigs = true; | |
| 23541 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13121 times.
|
13121 | bool trigged = lightbeam_present && (istrig[pos]&trigflag); |
| 23542 |
1/2✓ Branch 0 taken 13121 times.
✗ Branch 1 not taken.
|
13121 | if(cmb->usrflags&cflag2) //Invert |
| 23543 | ✗ | trigged = !trigged; | |
| 23544 |
2/2✓ Branch 0 taken 249 times.
✓ Branch 1 taken 12872 times.
|
13121 | if(cmb->usrflags&cflag1) //Solved Version |
| 23545 | { | ||
| 23546 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 249 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
249 | if(!(alltrig || trigged)) //Revert |
| 23547 | { | ||
| 23548 | ✗ | curlayer->data[pos] -= 1; | |
| 23549 | ✗ | istrigged = false; | |
| 23550 | ✗ | } | |
| 23551 | 249 | } | |
| 23552 | else //Unsolved version | ||
| 23553 | { | ||
| 23554 |
3/4✓ Branch 0 taken 12872 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 12868 times.
|
12872 | if(alltrig || trigged) //Light |
| 23555 | 4 | curlayer->data[pos] += 1; | |
| 23556 | 12868 | else istrigged = false; | |
| 23557 | } | ||
| 23558 | 13121 | } | |
| 23559 |
2/2✓ Branch 0 taken 17435003241 times.
✓ Branch 1 taken 3702 times.
|
17435006943 | else if(cmb->triggerflags[1] & (combotriggerLIGHTON|combotriggerLIGHTOFF)) |
| 23560 | { | ||
| 23561 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3702 times.
|
3702 | int32_t trigflag = cmb->triglbeam ? (1 << (cmb->triglbeam-1)) : ~0; |
| 23562 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3702 times.
|
3702 | bool trigged = lightbeam_present && (istrig[pos]&trigflag); |
| 23563 |
4/4✓ Branch 0 taken 105 times.
✓ Branch 1 taken 3597 times.
✓ Branch 2 taken 3696 times.
✓ Branch 3 taken 6 times.
|
3702 | if(trigged ? (cmb->triggerflags[1] & combotriggerLIGHTON) |
| 23564 | 3597 | : (cmb->triggerflags[1] & combotriggerLIGHTOFF)) | |
| 23565 | { | ||
| 23566 | 6 | do_trigger_combo(layer, pos); | |
| 23567 | 6 | } | |
| 23568 | 3702 | } | |
| 23569 | 17435020064 | } | |
| 23570 | 99062614 | } | |
| 23571 |
2/2✓ Branch 0 taken 423782884 times.
✓ Branch 1 taken 14151802 times.
|
437934686 | for(word i=0; i<c; i++) |
| 23572 | { | ||
| 23573 | 423782884 | ffcdata& ffc = tmpscr->ffcs[i]; | |
| 23574 | 423782884 | newcombo const* cmb = &combobuf[ffc.data]; | |
| 23575 |
2/2✓ Branch 0 taken 423191508 times.
✓ Branch 1 taken 591376 times.
|
423782884 | size_t pos = get_qr(qr_BROKEN_LIGHTBEAM_HITBOX) |
| 23576 | 423191508 | ? COMBOPOS(ffc.x+8, ffc.y+8) | |
| 23577 | 591376 | : COMBOPOS(ffc.x+(ffc.hit_width/2), ffc.y+(ffc.hit_height/2)); | |
| 23578 |
2/2✓ Branch 0 taken 1234 times.
✓ Branch 1 taken 423781650 times.
|
423782884 | if(cmb->type == cLIGHTTARGET) |
| 23579 | { | ||
| 23580 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1234 times.
|
1234 | int32_t trigflag = cmb->attribytes[4] ? (1 << (cmb->attribytes[4]-1)) : ~0; |
| 23581 | 1234 | hastrigs = true; | |
| 23582 | 1234 | bool trigged = (istrig[pos]&trigflag); | |
| 23583 |
1/2✓ Branch 0 taken 1234 times.
✗ Branch 1 not taken.
|
1234 | if(cmb->usrflags&cflag2) //Invert |
| 23584 | ✗ | trigged = !trigged; | |
| 23585 |
2/2✓ Branch 0 taken 249 times.
✓ Branch 1 taken 985 times.
|
1234 | if(cmb->usrflags&cflag1) //Solved Version |
| 23586 | { | ||
| 23587 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 249 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
249 | if(!(alltrig || trigged)) //Revert |
| 23588 | { | ||
| 23589 | ✗ | zc_ffc_modify(ffc, -1); | |
| 23590 | ✗ | istrigged = false; | |
| 23591 | ✗ | } | |
| 23592 | 249 | } | |
| 23593 | else //Unsolved version | ||
| 23594 | { | ||
| 23595 |
3/4✓ Branch 0 taken 985 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 984 times.
|
985 | if(alltrig || trigged) //Light |
| 23596 | 1 | zc_ffc_modify(ffc, 1); | |
| 23597 | 984 | else istrigged = false; | |
| 23598 | } | ||
| 23599 | 1234 | } | |
| 23600 |
2/2✓ Branch 0 taken 423779182 times.
✓ Branch 1 taken 2468 times.
|
423781650 | else if(cmb->triggerflags[1] & (combotriggerLIGHTON|combotriggerLIGHTOFF)) |
| 23601 | { | ||
| 23602 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2468 times.
|
2468 | int32_t trigflag = cmb->triglbeam ? (1 << (cmb->triglbeam-1)) : ~0; |
| 23603 | 2468 | bool trigged = (istrig[pos]&trigflag); | |
| 23604 |
4/4✓ Branch 0 taken 62 times.
✓ Branch 1 taken 2406 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 2464 times.
|
2468 | if(trigged ? (cmb->triggerflags[1] & combotriggerLIGHTON) |
| 23605 | 2406 | : (cmb->triggerflags[1] & combotriggerLIGHTOFF)) | |
| 23606 | { | ||
| 23607 | 4 | do_trigger_combo_ffc(i); | |
| 23608 | 4 | } | |
| 23609 | 2468 | } | |
| 23610 | 423782884 | } | |
| 23611 |
6/6✓ Branch 0 taken 13121 times.
✓ Branch 1 taken 14138681 times.
✓ Branch 2 taken 253 times.
✓ Branch 3 taken 12868 times.
✓ Branch 4 taken 249 times.
✓ Branch 5 taken 4 times.
|
14151802 | if(hastrigs && istrigged && !alltrig) |
| 23612 | { | ||
| 23613 | 4 | hidden_entrance(0,true,false,-7); | |
| 23614 | 4 | sfx(tmpscr->secretsfx); | |
| 23615 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | if(!(tmpscr->flags5&fTEMPSECRETS)) |
| 23616 | { | ||
| 23617 | 4 | setmapflag(mSECRET); | |
| 23618 | 4 | setmapflag(mLIGHTBEAM); | |
| 23619 | 4 | } | |
| 23620 | 4 | } | |
| 23621 | 14151802 | } | |
| 23622 | |||
| 23623 | 14129284 | void HeroClass::checktouchblk() | |
| 23624 | { | ||
| 23625 |
2/2✓ Branch 0 taken 14694 times.
✓ Branch 1 taken 14114590 times.
|
14129284 | if(toogam) return; |
| 23626 | |||
| 23627 |
2/2✓ Branch 0 taken 946748 times.
✓ Branch 1 taken 13167842 times.
|
14114590 | if(!pushing) |
| 23628 | 13167842 | return; | |
| 23629 | |||
| 23630 | 946748 | int32_t tdir = dir; //Bad hack #2. _L_, your welcome to fix this properly. ;) | |
| 23631 | |||
| 23632 |
4/4✓ Branch 0 taken 937972 times.
✓ Branch 1 taken 8776 times.
✓ Branch 2 taken 96 times.
✓ Branch 3 taken 937876 times.
|
946748 | if(charging > 0 || spins > 0) //if not I probably will at some point... |
| 23633 | { | ||
| 23634 |
4/4✓ Branch 0 taken 4072 times.
✓ Branch 1 taken 4800 times.
✓ Branch 2 taken 2940 times.
✓ Branch 3 taken 1132 times.
|
8872 | if(Up()&&Left())tdir = (charging%2)*2; |
| 23635 |
4/4✓ Branch 0 taken 2940 times.
✓ Branch 1 taken 4800 times.
✓ Branch 2 taken 1410 times.
✓ Branch 3 taken 1530 times.
|
7740 | else if(Up()&&Right())tdir = (charging%2)*3; |
| 23636 |
4/4✓ Branch 0 taken 2544 times.
✓ Branch 1 taken 3666 times.
✓ Branch 2 taken 1681 times.
✓ Branch 3 taken 863 times.
|
6210 | else if(Down()&&Left())tdir = 1+(charging%2)*1; |
| 23637 |
4/4✓ Branch 0 taken 1681 times.
✓ Branch 1 taken 3666 times.
✓ Branch 2 taken 869 times.
✓ Branch 3 taken 812 times.
|
5347 | else if(Down()&&Right())tdir = 1+(charging%2)*2; |
| 23638 | else | ||
| 23639 | { | ||
| 23640 |
2/2✓ Branch 0 taken 1410 times.
✓ Branch 1 taken 3125 times.
|
4535 | if(Up())tdir=0; |
| 23641 |
2/2✓ Branch 0 taken 864 times.
✓ Branch 1 taken 2261 times.
|
3125 | else if(Down())tdir=1; |
| 23642 |
2/2✓ Branch 0 taken 879 times.
✓ Branch 1 taken 1382 times.
|
2261 | else if(Left())tdir=2; |
| 23643 |
1/2✓ Branch 0 taken 1382 times.
✗ Branch 1 not taken.
|
1382 | else if(Right())tdir=3; |
| 23644 | } | ||
| 23645 | 8872 | } | |
| 23646 | |||
| 23647 | 946748 | int32_t tx=0,ty=-1; | |
| 23648 | |||
| 23649 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 234234 times.
✓ Branch 2 taken 212259 times.
✓ Branch 3 taken 233318 times.
✓ Branch 4 taken 266937 times.
|
946748 | switch(tdir) |
| 23650 | { | ||
| 23651 | case up: | ||
| 23652 |
2/2✓ Branch 0 taken 221 times.
✓ Branch 1 taken 234013 times.
|
234234 | if(touchcombo(x,y+(bigHitbox?0:7))) |
| 23653 | { | ||
| 23654 | 221 | tx=x; | |
| 23655 | 221 | ty=y+(bigHitbox?0:7); | |
| 23656 | 221 | } | |
| 23657 |
2/2✓ Branch 0 taken 25 times.
✓ Branch 1 taken 233988 times.
|
234013 | else if(touchcombo(x+8,y+(bigHitbox?0:7))) |
| 23658 | { | ||
| 23659 | 25 | tx=x+8; | |
| 23660 | 25 | ty=y+(bigHitbox?0:7); | |
| 23661 | 25 | } | |
| 23662 | |||
| 23663 | 234234 | break; | |
| 23664 | |||
| 23665 | case down: | ||
| 23666 |
2/2✓ Branch 0 taken 1649 times.
✓ Branch 1 taken 210610 times.
|
212259 | if(touchcombo(x,y+16)) |
| 23667 | { | ||
| 23668 | 1649 | tx=x; | |
| 23669 | 1649 | ty=y+16; | |
| 23670 | 1649 | } | |
| 23671 |
2/2✓ Branch 0 taken 264 times.
✓ Branch 1 taken 210346 times.
|
210610 | else if(touchcombo(x+8,y+16)) |
| 23672 | { | ||
| 23673 | 264 | tx=x+8; | |
| 23674 | 264 | ty=y+16; | |
| 23675 | 264 | } | |
| 23676 | |||
| 23677 | 212259 | break; | |
| 23678 | |||
| 23679 | case left: | ||
| 23680 |
2/2✓ Branch 0 taken 232477 times.
✓ Branch 1 taken 841 times.
|
233318 | if(touchcombo(x-1,y+15)) |
| 23681 | { | ||
| 23682 | 841 | tx=x-1; | |
| 23683 | 841 | ty=y+15; | |
| 23684 | 841 | } | |
| 23685 | |||
| 23686 | 233318 | break; | |
| 23687 | |||
| 23688 | case right: | ||
| 23689 |
2/2✓ Branch 0 taken 265755 times.
✓ Branch 1 taken 1182 times.
|
266937 | if(touchcombo(x+16,y+15)) |
| 23690 | { | ||
| 23691 | 1182 | tx=x+16; | |
| 23692 | 1182 | ty=y+15; | |
| 23693 | 1182 | } | |
| 23694 | |||
| 23695 | 266937 | break; | |
| 23696 | } | ||
| 23697 | |||
| 23698 |
2/2✓ Branch 0 taken 942566 times.
✓ Branch 1 taken 4182 times.
|
946748 | if(ty>=0) |
| 23699 | { | ||
| 23700 | 4182 | ty&=0xF0; | |
| 23701 | 4182 | tx&=0xF0; | |
| 23702 | 4182 | int32_t di = ty+(tx>>4); | |
| 23703 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 4182 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
4182 | if((getAction() != hopping || isSideViewHero())) |
| 23704 | { | ||
| 23705 | 4182 | trigger_armos_grave(0, di, dir); | |
| 23706 | 4182 | } | |
| 23707 | 4182 | } | |
| 23708 | 14129284 | } | |
| 23709 | |||
| 23710 | ✗ | int32_t HeroClass::nextcombo(int32_t cx, int32_t cy, int32_t cdir) | |
| 23711 | { | ||
| 23712 | ✗ | switch(cdir) | |
| 23713 | { | ||
| 23714 | case up: | ||
| 23715 | ✗ | cy-=16; | |
| 23716 | ✗ | break; | |
| 23717 | |||
| 23718 | case down: | ||
| 23719 | ✗ | cy+=16; | |
| 23720 | ✗ | break; | |
| 23721 | |||
| 23722 | case left: | ||
| 23723 | ✗ | cx-=16; | |
| 23724 | ✗ | break; | |
| 23725 | |||
| 23726 | case right: | ||
| 23727 | ✗ | cx+=16; | |
| 23728 | ✗ | break; | |
| 23729 | } | ||
| 23730 | |||
| 23731 | // off the screen | ||
| 23732 | ✗ | if(cx<0 || cy<0 || cx>255 || cy>175) | |
| 23733 | { | ||
| 23734 | int ns; | ||
| 23735 | ✗ | if(auto scr = nextscr(cdir,false)) | |
| 23736 | ✗ | ns = *scr; | |
| 23737 | ✗ | else return 0; | |
| 23738 | |||
| 23739 | ✗ | switch(cdir) | |
| 23740 | { | ||
| 23741 | case up: | ||
| 23742 | ✗ | cy=160; | |
| 23743 | ✗ | break; | |
| 23744 | |||
| 23745 | case down: | ||
| 23746 | ✗ | cy=0; | |
| 23747 | ✗ | break; | |
| 23748 | |||
| 23749 | case left: | ||
| 23750 | ✗ | cx=240; | |
| 23751 | ✗ | break; | |
| 23752 | |||
| 23753 | case right: | ||
| 23754 | ✗ | cx=0; | |
| 23755 | ✗ | break; | |
| 23756 | } | ||
| 23757 | |||
| 23758 | // from MAPCOMBO() | ||
| 23759 | ✗ | int32_t cmb = (cy&0xF0)+(cx>>4); | |
| 23760 | |||
| 23761 | ✗ | if(cmb>175) | |
| 23762 | ✗ | return 0; | |
| 23763 | |||
| 23764 | ✗ | return TheMaps[ns].data[cmb]; // entire combo code | |
| 23765 | } | ||
| 23766 | |||
| 23767 | ✗ | return MAPCOMBO(cx,cy); | |
| 23768 | ✗ | } | |
| 23769 | |||
| 23770 | 15867 | int32_t HeroClass::nextflag(int32_t cx, int32_t cy, int32_t cdir, bool comboflag) | |
| 23771 | { | ||
| 23772 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 3203 times.
✓ Branch 2 taken 3545 times.
✓ Branch 3 taken 3978 times.
✓ Branch 4 taken 5141 times.
|
15867 | switch(cdir) |
| 23773 | { | ||
| 23774 | case up: | ||
| 23775 | 3203 | cy-=16; | |
| 23776 | 3203 | break; | |
| 23777 | |||
| 23778 | case down: | ||
| 23779 | 3545 | cy+=16; | |
| 23780 | 3545 | break; | |
| 23781 | |||
| 23782 | case left: | ||
| 23783 | 3978 | cx-=16; | |
| 23784 | 3978 | break; | |
| 23785 | |||
| 23786 | case right: | ||
| 23787 | 5141 | cx+=16; | |
| 23788 | 5141 | break; | |
| 23789 | } | ||
| 23790 | |||
| 23791 | // off the screen | ||
| 23792 |
8/8✓ Branch 0 taken 15766 times.
✓ Branch 1 taken 101 times.
✓ Branch 2 taken 15621 times.
✓ Branch 3 taken 145 times.
✓ Branch 4 taken 15447 times.
✓ Branch 5 taken 174 times.
✓ Branch 6 taken 192 times.
✓ Branch 7 taken 15255 times.
|
15867 | if(cx<0 || cy<0 || cx>255 || cy>175) |
| 23793 | { | ||
| 23794 | int ns; | ||
| 23795 |
2/2✓ Branch 0 taken 608 times.
✓ Branch 1 taken 4 times.
|
612 | if(auto scr = nextscr(cdir,false)) |
| 23796 | 608 | ns = *scr; | |
| 23797 | 4 | else return 0; | |
| 23798 | |||
| 23799 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 143 times.
✓ Branch 2 taken 190 times.
✓ Branch 3 taken 101 times.
✓ Branch 4 taken 174 times.
|
608 | switch(cdir) |
| 23800 | { | ||
| 23801 | case up: | ||
| 23802 | 143 | cy=160; | |
| 23803 | 143 | break; | |
| 23804 | |||
| 23805 | case down: | ||
| 23806 | 190 | cy=0; | |
| 23807 | 190 | break; | |
| 23808 | |||
| 23809 | case left: | ||
| 23810 | 101 | cx=240; | |
| 23811 | 101 | break; | |
| 23812 | |||
| 23813 | case right: | ||
| 23814 | 174 | cx=0; | |
| 23815 | 174 | break; | |
| 23816 | } | ||
| 23817 | |||
| 23818 | // from MAPCOMBO() | ||
| 23819 | 608 | int32_t cmb = (cy&0xF0)+(cx>>4); | |
| 23820 | |||
| 23821 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 608 times.
|
608 | if(cmb>175) |
| 23822 | ✗ | return 0; | |
| 23823 | |||
| 23824 |
2/2✓ Branch 0 taken 85 times.
✓ Branch 1 taken 523 times.
|
608 | if(!comboflag) |
| 23825 | { | ||
| 23826 | 523 | return TheMaps[ns].sflag[cmb]; // flag | |
| 23827 | } | ||
| 23828 | else | ||
| 23829 | { | ||
| 23830 | 85 | return combobuf[TheMaps[ns].data[cmb]].flag; // flag | |
| 23831 | } | ||
| 23832 | } | ||
| 23833 | |||
| 23834 |
2/2✓ Branch 0 taken 3952 times.
✓ Branch 1 taken 11303 times.
|
15255 | if(comboflag) |
| 23835 | { | ||
| 23836 | 3952 | return MAPCOMBOFLAG(cx,cy); | |
| 23837 | } | ||
| 23838 | |||
| 23839 | 11303 | return MAPFLAG(cx,cy); | |
| 23840 | 15867 | } | |
| 23841 | |||
| 23842 | bool did_secret; | ||
| 23843 | |||
| 23844 | 14129284 | void HeroClass::checkspecial() | |
| 23845 | { | ||
| 23846 | 14129284 | checktouchblk(); | |
| 23847 | |||
| 23848 | 14129284 | bool hasmainguy = hasMainGuy(); // calculate it once | |
| 23849 | |||
| 23850 |
4/4✓ Branch 0 taken 14008812 times.
✓ Branch 1 taken 120472 times.
✓ Branch 2 taken 8593596 times.
✓ Branch 3 taken 5415216 times.
|
14129284 | if(!(loaded_enemies && !hasmainguy)) |
| 23851 | 8714068 | did_secret=false; | |
| 23852 | else | ||
| 23853 | { | ||
| 23854 | // after beating enemies | ||
| 23855 | |||
| 23856 | // generic 'Enemies->' trigger | ||
| 23857 |
2/2✓ Branch 0 taken 37906512 times.
✓ Branch 1 taken 5415216 times.
|
43321728 | for(auto lyr = 0; lyr < 7; ++lyr) |
| 23858 | { | ||
| 23859 |
2/2✓ Branch 0 taken 6671546112 times.
✓ Branch 1 taken 37906512 times.
|
6709452624 | for(auto pos = 0; pos < 176; ++pos) |
| 23860 | { | ||
| 23861 | 6671546112 | newcombo const& cmb = combobuf[FFCore.tempScreens[lyr]->data[pos]]; | |
| 23862 |
2/2✓ Branch 0 taken 6671546107 times.
✓ Branch 1 taken 5 times.
|
6671546112 | if(cmb.triggerflags[2] & combotriggerENEMIESKILLED) |
| 23863 | { | ||
| 23864 | 5 | do_trigger_combo(lyr,pos); | |
| 23865 | 5 | } | |
| 23866 | 6671546112 | } | |
| 23867 | 37906512 | } | |
| 23868 | 5415216 | word c = tmpscr->numFFC(); | |
| 23869 |
2/2✓ Branch 0 taken 157574863 times.
✓ Branch 1 taken 5415216 times.
|
162990079 | for(word i=0; i<c; i++) |
| 23870 | { | ||
| 23871 | 157574863 | ffcdata& ffc = tmpscr->ffcs[i]; | |
| 23872 | 157574863 | newcombo const& cmb = combobuf[ffc.data]; | |
| 23873 |
1/2✓ Branch 0 taken 157574863 times.
✗ Branch 1 not taken.
|
157574863 | if(cmb.triggerflags[2] & combotriggerENEMIESKILLED) |
| 23874 | { | ||
| 23875 | ✗ | do_trigger_combo_ffc(i); | |
| 23876 | ✗ | } | |
| 23877 | 157574863 | } | |
| 23878 |
1/2✓ Branch 0 taken 5415216 times.
✗ Branch 1 not taken.
|
5415216 | if(tmpscr->flags9 & fENEMY_WAVES) |
| 23879 | { | ||
| 23880 | ✗ | hasmainguy = hasMainGuy(); //possibly un-beat the enemies (another 'wave'?) | |
| 23881 | ✗ | } | |
| 23882 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5415216 times.
|
5415216 | if(!hasmainguy) |
| 23883 | { | ||
| 23884 | // item | ||
| 23885 |
2/2✓ Branch 0 taken 5414468 times.
✓ Branch 1 taken 748 times.
|
5415216 | if(hasitem&(4|2|1)) |
| 23886 | { | ||
| 23887 | 748 | int32_t Item=tmpscr->item; | |
| 23888 | |||
| 23889 | //if(getmapflag()) | ||
| 23890 | // Item=0; | ||
| 23891 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 748 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 748 times.
|
748 | if((!getmapflag(mITEM) || (tmpscr->flags9&fITEMRETURN)) && (tmpscr->hasitem != 0)) |
| 23892 | { | ||
| 23893 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 748 times.
|
748 | if(hasitem==1) |
| 23894 | 748 | sfx(WAV_CLEARED); | |
| 23895 | |||
| 23896 |
2/4✓ Branch 0 taken 748 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 748 times.
✗ Branch 3 not taken.
|
1496 | items.add(new item((zfix)tmpscr->itemx, |
| 23897 |
6/12✓ Branch 0 taken 71 times.
✓ Branch 1 taken 677 times.
✓ Branch 2 taken 71 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 71 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 748 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 748 times.
✗ Branch 11 not taken.
|
748 | (tmpscr->flags7&fITEMFALLS && isSideViewHero()) ? (zfix)-170 : (zfix)tmpscr->itemy+1, |
| 23898 |
6/10✓ Branch 0 taken 71 times.
✓ Branch 1 taken 677 times.
✓ Branch 2 taken 71 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 71 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 71 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 677 times.
✗ Branch 9 not taken.
|
748 | (tmpscr->flags7&fITEMFALLS && !isSideViewHero()) ? (zfix)170 : (zfix)0, |
| 23899 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 747 times.
|
748 | Item,ipONETIME|ipBIGRANGE|((itemsbuf[Item].family==itype_triforcepiece || |
| 23900 | 748 | (tmpscr->flags3&fHOLDITEM)) ? ipHOLDUP : 0) | ((tmpscr->flags8&fITEMSECRET) ? ipSECRETS : 0),0)); | |
| 23901 | 748 | } | |
| 23902 | |||
| 23903 | 748 | hasitem &= ~ (4|2|1); | |
| 23904 | 748 | } | |
| 23905 | // if room has traps, guys don't come back | ||
| 23906 |
2/2✓ Branch 0 taken 2772590592 times.
✓ Branch 1 taken 5415216 times.
|
2778005808 | for(int32_t i=0; i<eMAXGUYS; i++) |
| 23907 | { | ||
| 23908 |
4/4✓ Branch 0 taken 80802911 times.
✓ Branch 1 taken 2691787681 times.
✓ Branch 2 taken 70029685 times.
✓ Branch 3 taken 10773226 times.
|
2772590592 | if(guysbuf[i].family==eeTRAP&&guysbuf[i].attributes[1]) |
| 23909 |
4/4✓ Branch 0 taken 79095 times.
✓ Branch 1 taken 10694131 times.
✓ Branch 2 taken 78998 times.
✓ Branch 3 taken 97 times.
|
10773323 | if(guys.idCount(i) && !getmapflag(mTMPNORET)) |
| 23910 | 97 | setmapflag(mTMPNORET); | |
| 23911 | 2772590592 | } | |
| 23912 | // clear enemies and open secret | ||
| 23913 |
4/4✓ Branch 0 taken 5223923 times.
✓ Branch 1 taken 191293 times.
✓ Branch 2 taken 5223069 times.
✓ Branch 3 taken 854 times.
|
5415216 | if(!did_secret && (tmpscr->flags2&fCLEARSECRET)) |
| 23914 | { | ||
| 23915 | 854 | bool only16_31 = get_qr(qr_ENEMIES_SECRET_ONLY_16_31)?true:false; | |
| 23916 | 854 | hidden_entrance(0,true,only16_31,-2); | |
| 23917 | |||
| 23918 |
4/4✓ Branch 0 taken 105 times.
✓ Branch 1 taken 749 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 100 times.
|
854 | if(tmpscr->flags4&fENEMYSCRTPERM && canPermSecret()) |
| 23919 | { | ||
| 23920 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 100 times.
|
100 | if(!(tmpscr->flags5&fTEMPSECRETS)) setmapflag(mSECRET); |
| 23921 | 100 | } | |
| 23922 | |||
| 23923 | 854 | sfx(tmpscr->secretsfx); | |
| 23924 | 854 | did_secret=true; | |
| 23925 | 854 | } | |
| 23926 | 5415216 | } | |
| 23927 | } | ||
| 23928 | |||
| 23929 | // doors | ||
| 23930 | 14129284 | bool has_shutter = false; | |
| 23931 |
2/2✓ Branch 0 taken 12097426 times.
✓ Branch 1 taken 52874914 times.
|
64972340 | for(int32_t i=0; i<4; i++) |
| 23932 |
2/2✓ Branch 0 taken 50843056 times.
✓ Branch 1 taken 2031858 times.
|
52874914 | if(tmpscr->door[i]==dSHUTTER) |
| 23933 | { | ||
| 23934 | 2031858 | has_shutter = true; | |
| 23935 |
4/4✓ Branch 0 taken 1991600 times.
✓ Branch 1 taken 40258 times.
✓ Branch 2 taken 1424 times.
✓ Branch 3 taken 1990176 times.
|
2031858 | if(opendoors==0 && loaded_enemies) |
| 23936 | { | ||
| 23937 |
4/4✓ Branch 0 taken 1657895 times.
✓ Branch 1 taken 332281 times.
✓ Branch 2 taken 1655472 times.
✓ Branch 3 taken 2423 times.
|
1990176 | if(!(tmpscr->flags&fSHUTTERS) && !hasmainguy) |
| 23938 | 2423 | opendoors=12; | |
| 23939 | 1990176 | } | |
| 23940 |
2/2✓ Branch 0 taken 32960 times.
✓ Branch 1 taken 8722 times.
|
41682 | else if(opendoors<0) |
| 23941 | 8722 | ++opendoors; | |
| 23942 |
2/2✓ Branch 0 taken 30229 times.
✓ Branch 1 taken 2731 times.
|
32960 | else if((--opendoors)==0) |
| 23943 | 2731 | openshutters(); | |
| 23944 | |||
| 23945 | 2031858 | break; | |
| 23946 | } | ||
| 23947 |
10/10✓ Branch 0 taken 12097426 times.
✓ Branch 1 taken 2031858 times.
✓ Branch 2 taken 11861812 times.
✓ Branch 3 taken 235614 times.
✓ Branch 4 taken 11748669 times.
✓ Branch 5 taken 113143 times.
✓ Branch 6 taken 11676149 times.
✓ Branch 7 taken 72520 times.
✓ Branch 8 taken 6583189 times.
✓ Branch 9 taken 5092960 times.
|
14129284 | if(!has_shutter && !opendoors && loaded_enemies && !(tmpscr->flags&fSHUTTERS) && !hasmainguy) |
| 23948 | { | ||
| 23949 | 5092960 | openshutters(); | |
| 23950 | 5092960 | } | |
| 23951 | |||
| 23952 | // set boss flag when boss is gone | ||
| 23953 |
6/6✓ Branch 0 taken 14008812 times.
✓ Branch 1 taken 120472 times.
✓ Branch 2 taken 204006 times.
✓ Branch 3 taken 13804806 times.
✓ Branch 4 taken 153974 times.
✓ Branch 5 taken 50032 times.
|
14129284 | if(loaded_enemies && tmpscr->enemyflags&efBOSS && !hasmainguy) |
| 23954 | { | ||
| 23955 | 50032 | game->lvlitems[dlevel]|=liBOSS; | |
| 23956 | 50032 | stop_sfx(tmpscr->bosssfx); | |
| 23957 | 50032 | } | |
| 23958 | |||
| 23959 |
2/2✓ Branch 0 taken 14052988 times.
✓ Branch 1 taken 76296 times.
|
14129284 | if(getmapflag(mCHEST)) // if special stuff done before |
| 23960 | { | ||
| 23961 | 76296 | remove_chests((currscr>=128)?1:0); | |
| 23962 | 76296 | } | |
| 23963 | |||
| 23964 |
2/2✓ Branch 0 taken 14126824 times.
✓ Branch 1 taken 2460 times.
|
14129284 | if(getmapflag(mLOCKEDCHEST)) // if special stuff done before |
| 23965 | { | ||
| 23966 | 2460 | remove_lockedchests((currscr>=128)?1:0); | |
| 23967 | 2460 | } | |
| 23968 | |||
| 23969 |
2/2✓ Branch 0 taken 14103083 times.
✓ Branch 1 taken 26201 times.
|
14129284 | if(getmapflag(mBOSSCHEST)) // if special stuff done before |
| 23970 | { | ||
| 23971 | 26201 | remove_bosschests((currscr>=128)?1:0); | |
| 23972 | 26201 | } | |
| 23973 | |||
| 23974 | 14129284 | clear_xdoors((currscr>=128)?1:0); | |
| 23975 | 14129284 | clear_xstatecombos((currscr>=128)?1:0); | |
| 23976 | |||
| 23977 |
4/4✓ Branch 0 taken 34468 times.
✓ Branch 1 taken 14094816 times.
✓ Branch 2 taken 34438 times.
✓ Branch 3 taken 30 times.
|
14129284 | if((hasitem&8) && triggered_screen_secrets) |
| 23978 | { | ||
| 23979 | 30 | int32_t Item=tmpscr->item; | |
| 23980 | |||
| 23981 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 30 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 24 times.
|
30 | if((!getmapflag(mITEM) || (tmpscr->flags9&fITEMRETURN)) && (tmpscr->hasitem != 0)) |
| 23982 | { | ||
| 23983 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
48 | items.add(new item((zfix)tmpscr->itemx, |
| 23984 |
6/12✓ Branch 0 taken 20 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 20 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 20 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 24 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 24 times.
✗ Branch 11 not taken.
|
24 | (tmpscr->flags7&fITEMFALLS && isSideViewHero()) ? (zfix)-170 : (zfix)tmpscr->itemy+1, |
| 23985 |
6/10✓ Branch 0 taken 20 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 20 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 20 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 4 times.
✗ Branch 9 not taken.
|
24 | (tmpscr->flags7&fITEMFALLS && !isSideViewHero()) ? (zfix)170 : (zfix)0, |
| 23986 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | Item,ipONETIME|ipBIGRANGE|((itemsbuf[Item].family==itype_triforcepiece || |
| 23987 | 24 | (tmpscr->flags3&fHOLDITEM)) ? ipHOLDUP : 0) | ((tmpscr->flags8&fITEMSECRET) ? ipSECRETS : 0),0)); | |
| 23988 | 24 | } | |
| 23989 | |||
| 23990 | 30 | hasitem &= ~8; | |
| 23991 | 30 | } | |
| 23992 | 14129284 | } | |
| 23993 | |||
| 23994 | //Gets the 4 comboposes indicated by the coordinates, replacing duplicates with '-1' | ||
| 23995 | 13369444 | void getPoses(int32_t* poses, int32_t x1, int32_t y1, int32_t x2, int32_t y2) | |
| 23996 | { | ||
| 23997 | int32_t tmp; | ||
| 23998 | 13369444 | poses[0] = COMBOPOS(x1,y1); | |
| 23999 | |||
| 24000 | 13369444 | tmp = COMBOPOS(x1,y2); | |
| 24001 |
2/2✓ Branch 0 taken 9688955 times.
✓ Branch 1 taken 3680489 times.
|
13369444 | if(tmp == poses[0]) |
| 24002 | 9688955 | poses[1] = -1; | |
| 24003 | 3680489 | else poses[1] = tmp; | |
| 24004 | |||
| 24005 | 13369444 | tmp = COMBOPOS(x2,y1); | |
| 24006 |
3/4✓ Branch 0 taken 6463575 times.
✓ Branch 1 taken 6905869 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6463575 times.
|
13369444 | if(tmp == poses[0] || tmp == poses[1]) |
| 24007 | 6905869 | poses[2] = -1; | |
| 24008 | 6463575 | else poses[2] = tmp; | |
| 24009 | |||
| 24010 | 13369444 | tmp = COMBOPOS(x2,y2); | |
| 24011 |
6/6✓ Branch 0 taken 8399128 times.
✓ Branch 1 taken 4970316 times.
✓ Branch 2 taken 6463575 times.
✓ Branch 3 taken 1935553 times.
✓ Branch 4 taken 4718639 times.
✓ Branch 5 taken 1744936 times.
|
13369444 | if(tmp == poses[0] || tmp == poses[1] || tmp == poses[2]) |
| 24012 | 11624508 | poses[3] = -1; | |
| 24013 | 1744936 | else poses[3] = tmp; | |
| 24014 | 13369444 | } | |
| 24015 | |||
| 24016 | 14091372 | void HeroClass::checkspecial2(int32_t *ls) | |
| 24017 | { | ||
| 24018 |
6/8✓ Branch 0 taken 9971231 times.
✓ Branch 1 taken 4120141 times.
✓ Branch 2 taken 9715297 times.
✓ Branch 3 taken 255934 times.
✓ Branch 4 taken 9715297 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 9715297 times.
|
14091372 | if(get_qr(qr_OLDSTYLEWARP) && !(diagonalMovement||NO_GRIDLOCK)) |
| 24019 | { | ||
| 24020 | // Must run fairycircle stuff if currently active, otherwise hero gets stuck! | ||
| 24021 |
2/2✓ Branch 0 taken 21923 times.
✓ Branch 1 taken 9693374 times.
|
9715297 | if (!fairyclk) |
| 24022 | { | ||
| 24023 |
2/2✓ Branch 0 taken 2921437 times.
✓ Branch 1 taken 6771937 times.
|
9693374 | if(y.getInt()&7) |
| 24024 | 2921437 | return; | |
| 24025 | |||
| 24026 |
2/2✓ Branch 0 taken 2954024 times.
✓ Branch 1 taken 3817913 times.
|
6771937 | if(x.getInt()&7) |
| 24027 | 3817913 | return; | |
| 24028 | 2954024 | } | |
| 24029 | 2975947 | } | |
| 24030 | |||
| 24031 |
2/2✓ Branch 0 taken 5800 times.
✓ Branch 1 taken 7346222 times.
|
7352022 | if(toogam) return; |
| 24032 | |||
| 24033 | 7346222 | bool didstrig = false; | |
| 24034 | |||
| 24035 |
2/2✓ Branch 0 taken 14673682 times.
✓ Branch 1 taken 7346182 times.
|
22019864 | for(int32_t i=bigHitbox?0:8; i<16; i+=bigHitbox?15:7) |
| 24036 | { | ||
| 24037 |
4/4✓ Branch 0 taken 29347335 times.
✓ Branch 1 taken 14673642 times.
✓ Branch 2 taken 58694630 times.
✓ Branch 3 taken 29347295 times.
|
102715567 | for(int32_t j=0; j<16; j+=15) for(int32_t k=0; k<2; k++) |
| 24038 | { | ||
| 24039 |
2/2✓ Branch 0 taken 29347295 times.
✓ Branch 1 taken 29347335 times.
|
58694630 | newcombo const& cmb = combobuf[k>0 ? MAPFFCOMBO(x+j,y+i) : MAPCOMBO(x+j,y+i)]; |
| 24040 | 58694630 | int32_t stype = cmb.type; | |
| 24041 | 58694630 | int32_t warpsound = cmb.attribytes[0]; | |
| 24042 |
2/2✓ Branch 0 taken 58694428 times.
✓ Branch 1 taken 202 times.
|
58694630 | if(cmb.triggerflags[0] & combotriggerONLYGENTRIG) |
| 24043 | 202 | stype = cNONE; | |
| 24044 |
2/2✓ Branch 0 taken 58694596 times.
✓ Branch 1 taken 34 times.
|
58694630 | if(stype==cSWARPA) |
| 24045 | { | ||
| 24046 |
2/2✓ Branch 0 taken 33 times.
✓ Branch 1 taken 1 times.
|
34 | if(tmpscr->flags5&fDIRECTSWARP) |
| 24047 | { | ||
| 24048 | 1 | didpit=true; | |
| 24049 | 1 | pitx=x; | |
| 24050 | 1 | pity=y; | |
| 24051 | 1 | } | |
| 24052 | |||
| 24053 | 34 | sdir=dir; | |
| 24054 | 34 | dowarp(0,0,warpsound); | |
| 24055 | 34 | return; | |
| 24056 | } | ||
| 24057 | |||
| 24058 |
2/2✓ Branch 0 taken 58694591 times.
✓ Branch 1 taken 5 times.
|
58694596 | if(stype==cSWARPB) |
| 24059 | { | ||
| 24060 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if(tmpscr->flags5&fDIRECTSWARP) |
| 24061 | { | ||
| 24062 | ✗ | didpit=true; | |
| 24063 | ✗ | pitx=x; | |
| 24064 | ✗ | pity=y; | |
| 24065 | ✗ | } | |
| 24066 | |||
| 24067 | 5 | sdir=dir; | |
| 24068 | 5 | dowarp(0,1,warpsound); | |
| 24069 | 5 | return; | |
| 24070 | } | ||
| 24071 | |||
| 24072 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 58694590 times.
|
58694591 | if(stype==cSWARPC) |
| 24073 | { | ||
| 24074 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if(tmpscr->flags5&fDIRECTSWARP) |
| 24075 | { | ||
| 24076 | ✗ | didpit=true; | |
| 24077 | ✗ | pitx=x; | |
| 24078 | ✗ | pity=y; | |
| 24079 | ✗ | } | |
| 24080 | |||
| 24081 | 1 | sdir=dir; | |
| 24082 | 1 | dowarp(0,2,warpsound); | |
| 24083 | 1 | return; | |
| 24084 | } | ||
| 24085 | |||
| 24086 |
1/2✓ Branch 0 taken 58694590 times.
✗ Branch 1 not taken.
|
58694590 | if(stype==cSWARPD) |
| 24087 | { | ||
| 24088 | ✗ | if(tmpscr->flags5&fDIRECTSWARP) | |
| 24089 | { | ||
| 24090 | ✗ | didpit=true; | |
| 24091 | ✗ | pitx=x; | |
| 24092 | ✗ | pity=y; | |
| 24093 | ✗ | } | |
| 24094 | |||
| 24095 | ✗ | sdir=dir; | |
| 24096 | ✗ | dowarp(0,3,warpsound); | |
| 24097 | ✗ | return; | |
| 24098 | } | ||
| 24099 | |||
| 24100 |
1/2✓ Branch 0 taken 58694590 times.
✗ Branch 1 not taken.
|
58694590 | if(stype==cSWARPR) |
| 24101 | { | ||
| 24102 | ✗ | if(tmpscr->flags5&fDIRECTSWARP) | |
| 24103 | { | ||
| 24104 | ✗ | didpit=true; | |
| 24105 | ✗ | pitx=x; | |
| 24106 | ✗ | pity=y; | |
| 24107 | ✗ | } | |
| 24108 | |||
| 24109 | ✗ | sdir=dir; | |
| 24110 | ✗ | dowarp(0,(zc_oldrand()%4),warpsound); | |
| 24111 | ✗ | return; | |
| 24112 | } | ||
| 24113 | |||
| 24114 | 58694590 | int32_t pos = COMBOPOS(x+j, y+i); | |
| 24115 |
4/4✓ Branch 0 taken 58690440 times.
✓ Branch 1 taken 4150 times.
✓ Branch 2 taken 58692111 times.
✓ Branch 3 taken 2479 times.
|
58694590 | if((stype==cSTRIGNOFLAG || stype==cSTRIGFLAG) && stepsecret!=pos) |
| 24116 | { | ||
| 24117 |
3/4✓ Branch 0 taken 895 times.
✓ Branch 1 taken 1584 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 895 times.
|
2479 | if(stype==cSTRIGFLAG && canPermSecret()) |
| 24118 | { | ||
| 24119 |
2/2✓ Branch 0 taken 292 times.
✓ Branch 1 taken 603 times.
|
895 | if(!didstrig) |
| 24120 | { | ||
| 24121 | 603 | stepsecret = pos; | |
| 24122 | |||
| 24123 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 603 times.
|
603 | if(!(tmpscr->flags5&fTEMPSECRETS)) |
| 24124 | { | ||
| 24125 | 603 | setmapflag(mSECRET); | |
| 24126 | 603 | } | |
| 24127 | 603 | sfx(warpsound,pan((int32_t)x)); | |
| 24128 | 603 | hidden_entrance(0,true,false); | |
| 24129 | 603 | didstrig = true; | |
| 24130 | 603 | } | |
| 24131 | 895 | } | |
| 24132 | else | ||
| 24133 | { | ||
| 24134 |
2/2✓ Branch 0 taken 680 times.
✓ Branch 1 taken 904 times.
|
1584 | if(!didstrig) |
| 24135 | { | ||
| 24136 | 904 | stepsecret = pos; | |
| 24137 | 904 | bool only16_31 = get_qr(qr_STEPTEMP_SECRET_ONLY_16_31)?true:false; | |
| 24138 | 904 | hidden_entrance(0,true,only16_31); | |
| 24139 | 904 | didstrig = true; | |
| 24140 | 904 | sfx(warpsound,pan((int32_t)x)); | |
| 24141 | 904 | } | |
| 24142 | } | ||
| 24143 | 2479 | } | |
| 24144 | 88041885 | } | |
| 24145 | 14673642 | } | |
| 24146 | |||
| 24147 | 7346182 | bool RaftPass = false;//Special case for the raft, where only the raft stuff gets checked and nothing else. | |
| 24148 | |||
| 24149 | // check if he's standing on a warp he just came out of | ||
| 24150 | // But if the QR is checked, it uses the old logic, cause some quests like Ballad of a Bloodline warp you onto a trigger and this new logic bricks that. | ||
| 24151 |
2/2✓ Branch 0 taken 2008546 times.
✓ Branch 1 taken 5337636 times.
|
7346182 | if (!get_qr(qr_210_WARPRETURN)) |
| 24152 | { | ||
| 24153 |
6/6✓ Branch 0 taken 5326318 times.
✓ Branch 1 taken 11318 times.
✓ Branch 2 taken 349137 times.
✓ Branch 3 taken 4977181 times.
✓ Branch 4 taken 53936 times.
✓ Branch 5 taken 295201 times.
|
5337636 | if(((int32_t)y>=warpy-8&&(int32_t)y<=warpy+7)&&warpy!=-1) |
| 24154 | { | ||
| 24155 |
5/6✓ Branch 0 taken 294147 times.
✓ Branch 1 taken 1054 times.
✓ Branch 2 taken 292668 times.
✓ Branch 3 taken 1479 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 292668 times.
|
295201 | if(((int32_t)x>=warpx-8&&(int32_t)x<=warpx+7)&&warpx!=-1) |
| 24156 | { | ||
| 24157 |
3/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 292663 times.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
292668 | if (get_qr(qr_BETTER_RAFT_2) && dir != up) RaftPass = true; |
| 24158 | 292668 | else return; | |
| 24159 | ✗ | } | |
| 24160 | 2533 | } | |
| 24161 | 5044968 | } | |
| 24162 | else | ||
| 24163 | { | ||
| 24164 |
2/2✓ Branch 0 taken 1677138 times.
✓ Branch 1 taken 331408 times.
|
2008546 | if((int(y)&0xF8)==warpy) |
| 24165 | { | ||
| 24166 |
2/2✓ Branch 0 taken 4076 times.
✓ Branch 1 taken 327332 times.
|
331408 | if(x==warpx) |
| 24167 | { | ||
| 24168 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 327332 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
327332 | if (get_qr(qr_BETTER_RAFT_2) && dir != up) RaftPass = true; |
| 24169 | 327332 | else return; | |
| 24170 | ✗ | } | |
| 24171 | 4076 | } | |
| 24172 | } | ||
| 24173 |
2/2✓ Branch 0 taken 9364 times.
✓ Branch 1 taken 6716818 times.
|
6726182 | if (!RaftPass) warpy=-1; |
| 24174 | |||
| 24175 |
6/6✓ Branch 0 taken 6709448 times.
✓ Branch 1 taken 13234 times.
✓ Branch 2 taken 321183 times.
✓ Branch 3 taken 6388265 times.
✓ Branch 4 taken 242420 times.
✓ Branch 5 taken 78763 times.
|
6726182 | if(((int32_t)y<raftwarpy-(get_qr(qr_BETTER_RAFT_2)?12:8)||(int32_t)y>raftwarpy+(get_qr(qr_BETTER_RAFT_2)?3:7))||raftwarpy==-1) |
| 24176 | { | ||
| 24177 | 6480262 | raftwarpy = -1; | |
| 24178 | 6480262 | } | |
| 24179 |
6/6✓ Branch 0 taken 6710791 times.
✓ Branch 1 taken 11891 times.
✓ Branch 2 taken 311072 times.
✓ Branch 3 taken 6399719 times.
✓ Branch 4 taken 225896 times.
✓ Branch 5 taken 85176 times.
|
6722682 | if (((int32_t)x<raftwarpx - 8 || (int32_t)x>raftwarpx + 7) || raftwarpx == -1) |
| 24180 | { | ||
| 24181 | 6496786 | raftwarpx = -1; | |
| 24182 | 6496786 | } | |
| 24183 | 6704580 | int32_t tx=x; | |
| 24184 | 6704580 | int32_t ty=y; | |
| 24185 | |||
| 24186 | 6704580 | int32_t flag=0; | |
| 24187 | 6704580 | int32_t flag2=0; | |
| 24188 | 6704580 | int32_t flag3=0; | |
| 24189 | 6704580 | int32_t type=0; | |
| 24190 | 6704580 | int32_t water=0; | |
| 24191 | 6704580 | int32_t index = 0; | |
| 24192 | |||
| 24193 | 6704580 | bool setsave=false; | |
| 24194 | 6704580 | int32_t warpsfx2 = 0; | |
| 24195 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6704580 times.
|
6704580 | if (RaftPass) goto RaftingStuff; |
| 24196 | |||
| 24197 | //bool gotpit=false; | ||
| 24198 | |||
| 24199 | int32_t x1,x2,y1,y2; | ||
| 24200 | 6704580 | x1 = tx; | |
| 24201 | 6704580 | x2 = tx+15; | |
| 24202 | 6704580 | y1 = ty; | |
| 24203 | 6704580 | y2 = ty+15; | |
| 24204 | |||
| 24205 |
5/6✓ Branch 0 taken 2513710 times.
✓ Branch 1 taken 4190870 times.
✓ Branch 2 taken 2513710 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 12238 times.
✓ Branch 5 taken 2525948 times.
|
6704580 | if((diagonalMovement||NO_GRIDLOCK)) |
| 24206 | { | ||
| 24207 | 4203108 | x1 = tx+4; | |
| 24208 | 4203108 | x2 = tx+11; | |
| 24209 | 4203108 | y1 = ty+4; | |
| 24210 | 4203108 | y2 = ty+11; | |
| 24211 | 4203108 | } | |
| 24212 | |||
| 24213 | int32_t types[4]; | ||
| 24214 | 6729056 | types[0]=types[1]=types[2]=types[3]=-1; | |
| 24215 | int32_t cids[4]; | ||
| 24216 | int32_t ffcids[4]; | ||
| 24217 | 6729056 | cids[0]=cids[1]=cids[2]=cids[3]=-1; | |
| 24218 | 6729056 | ffcids[0]=ffcids[1]=ffcids[2]=ffcids[3]=-1; | |
| 24219 | // | ||
| 24220 | // First, let's find flag1 (combo flag), flag2 (inherent flag) and flag3 (FFC flag)... | ||
| 24221 | // | ||
| 24222 | 6729056 | types[0] = MAPFLAG(x1,y1); | |
| 24223 | 6729056 | types[1] = MAPFLAG(x1,y2); | |
| 24224 | 6729056 | types[2] = MAPFLAG(x2,y1); | |
| 24225 | 6729056 | types[3] = MAPFLAG(x2,y2); | |
| 24226 | |||
| 24227 | |||
| 24228 | //MAPFFCOMBO | ||
| 24229 | |||
| 24230 | |||
| 24231 |
6/6✓ Branch 0 taken 6497945 times.
✓ Branch 1 taken 231111 times.
✓ Branch 2 taken 6470765 times.
✓ Branch 3 taken 27180 times.
✓ Branch 4 taken 81417 times.
✓ Branch 5 taken 6389348 times.
|
6729056 | if(types[0]==types[1]&&types[2]==types[3]&&types[1]==types[2]) |
| 24232 | 6389348 | flag = types[0]; | |
| 24233 | // 2.10 compatibility... | ||
| 24234 |
10/10✓ Branch 0 taken 147945 times.
✓ Branch 1 taken 191763 times.
✓ Branch 2 taken 121854 times.
✓ Branch 3 taken 26091 times.
✓ Branch 4 taken 107989 times.
✓ Branch 5 taken 13865 times.
✓ Branch 6 taken 107893 times.
✓ Branch 7 taken 96 times.
✓ Branch 8 taken 98 times.
✓ Branch 9 taken 107795 times.
|
339708 | else if(y.getInt()%16==8 && types[0]==types[2] && (types[0]==mfFAIRY || types[0]==mfMAGICFAIRY || types[0]==mfALLFAIRY)) |
| 24235 | 14059 | flag = types[0]; | |
| 24236 | |||
| 24237 | |||
| 24238 | 6729056 | types[0] = MAPCOMBOFLAG(x1,y1); | |
| 24239 | 6729056 | types[1] = MAPCOMBOFLAG(x1,y2); | |
| 24240 | 6729056 | types[2] = MAPCOMBOFLAG(x2,y1); | |
| 24241 | 6729056 | types[3] = MAPCOMBOFLAG(x2,y2); | |
| 24242 | |||
| 24243 |
6/6✓ Branch 0 taken 6656259 times.
✓ Branch 1 taken 72797 times.
✓ Branch 2 taken 6649245 times.
✓ Branch 3 taken 7014 times.
✓ Branch 4 taken 17736 times.
✓ Branch 5 taken 6631509 times.
|
6729056 | if(types[0]==types[1]&&types[2]==types[3]&&types[1]==types[2]) |
| 24244 | 6631509 | flag2 = types[0]; | |
| 24245 |
9/12✓ Branch 0 taken 20949 times.
✓ Branch 1 taken 76598 times.
✓ Branch 2 taken 3350 times.
✓ Branch 3 taken 17599 times.
✓ Branch 4 taken 2740 times.
✓ Branch 5 taken 610 times.
✓ Branch 6 taken 2740 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2740 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2740 times.
|
97547 | else if(!get_qr(qr_FAIRY_FLAG_COMPAT) && y.getInt()%16==8 && types[0]==types[2] && (types[0]==mfFAIRY || types[0]==mfMAGICFAIRY || types[0]==mfALLFAIRY)) |
| 24246 | ✗ | flag2 = types[0]; | |
| 24247 | |||
| 24248 | 6729056 | types[0] = MAPFFCOMBOFLAG(x1,y1); | |
| 24249 | 6729056 | types[1] = MAPFFCOMBOFLAG(x1,y2); | |
| 24250 | 6729056 | types[2] = MAPFFCOMBOFLAG(x2,y1); | |
| 24251 | 6729056 | types[3] = MAPFFCOMBOFLAG(x2,y2); | |
| 24252 | |||
| 24253 | |||
| 24254 | // | ||
| 24255 | |||
| 24256 |
6/6✓ Branch 0 taken 6716217 times.
✓ Branch 1 taken 12839 times.
✓ Branch 2 taken 6716070 times.
✓ Branch 3 taken 147 times.
✓ Branch 4 taken 15 times.
✓ Branch 5 taken 6716055 times.
|
6729056 | if(types[0]==types[1]&&types[2]==types[3]&&types[1]==types[2]) |
| 24257 | 6716055 | flag3 = types[0]; | |
| 24258 |
1/12✗ Branch 0 not taken.
✓ Branch 1 taken 13001 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
13001 | else if(!get_qr(qr_FAIRY_FLAG_COMPAT) && y.getInt()%16==8 && types[0]==types[2] && (types[0]==mfFAIRY || types[0]==mfMAGICFAIRY || types[0]==mfALLFAIRY)) |
| 24259 | ✗ | flag3 = types[0]; | |
| 24260 | |||
| 24261 | // | ||
| 24262 | // Now, let's check for warp combos... | ||
| 24263 | // | ||
| 24264 | |||
| 24265 | // | ||
| 24266 | |||
| 24267 | 6729056 | cids[0] = MAPCOMBO(x1,y1); | |
| 24268 | 6729056 | cids[1] = MAPCOMBO(x1,y2); | |
| 24269 | 6729056 | cids[2] = MAPCOMBO(x2,y1); | |
| 24270 | 6729056 | cids[3] = MAPCOMBO(x2,y2); | |
| 24271 | |||
| 24272 | 6729056 | types[0] = COMBOTYPE(x1,y1); | |
| 24273 | |||
| 24274 |
2/2✓ Branch 0 taken 171571 times.
✓ Branch 1 taken 6537791 times.
|
6729056 | if(MAPFFCOMBO(x1,y1)) |
| 24275 | { | ||
| 24276 | 171571 | types[0] = FFCOMBOTYPE(x1,y1); | |
| 24277 | 171571 | cids[0] = MAPFFCOMBO(x1,y1); | |
| 24278 | 171571 | } | |
| 24279 | |||
| 24280 | 6709362 | types[1] = COMBOTYPE(x1,y2); | |
| 24281 | |||
| 24282 |
2/2✓ Branch 0 taken 126972 times.
✓ Branch 1 taken 6582390 times.
|
6709362 | if(MAPFFCOMBO(x1,y2)) |
| 24283 | { | ||
| 24284 | 126972 | types[1] = FFCOMBOTYPE(x1,y2); | |
| 24285 | 126972 | cids[1] = MAPFFCOMBO(x1,y2); | |
| 24286 | 126972 | } | |
| 24287 | |||
| 24288 | 6709362 | types[2] = COMBOTYPE(x2,y1); | |
| 24289 | |||
| 24290 |
2/2✓ Branch 0 taken 170832 times.
✓ Branch 1 taken 6538530 times.
|
6709362 | if(MAPFFCOMBO(x2,y1)) |
| 24291 | { | ||
| 24292 | 170832 | types[2] = FFCOMBOTYPE(x2,y1); | |
| 24293 | 170832 | cids[2] = MAPFFCOMBO(x2,y1); | |
| 24294 | 170832 | } | |
| 24295 | 6709362 | types[3] = COMBOTYPE(x2,y2); | |
| 24296 | |||
| 24297 |
2/2✓ Branch 0 taken 127444 times.
✓ Branch 1 taken 6581918 times.
|
6709362 | if(MAPFFCOMBO(x2,y2)) |
| 24298 | { | ||
| 24299 | 127444 | types[3] = FFCOMBOTYPE(x2,y2); | |
| 24300 | 127444 | cids[3] = MAPFFCOMBO(x2,y2); | |
| 24301 | 127444 | } | |
| 24302 | // Change B, C and D warps into A, for the comparison below... | ||
| 24303 |
2/2✓ Branch 0 taken 26867272 times.
✓ Branch 1 taken 6709362 times.
|
33576634 | for(int32_t i=0; i<4; i++) |
| 24304 | { | ||
| 24305 |
2/2✓ Branch 0 taken 324 times.
✓ Branch 1 taken 26866948 times.
|
26867272 | if(combobuf[cids[i]].triggerflags[0] & combotriggerONLYGENTRIG) |
| 24306 | { | ||
| 24307 | 324 | types[i] = cNONE; | |
| 24308 | 324 | continue; | |
| 24309 | } | ||
| 24310 |
2/2✓ Branch 0 taken 6925 times.
✓ Branch 1 taken 26860023 times.
|
26866948 | if(types[i]==cCAVE) |
| 24311 | { | ||
| 24312 | 6925 | index=0; | |
| 24313 | 6925 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24314 | 6925 | } | |
| 24315 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26860023 times.
|
26860023 | else if(types[i]==cCAVEB) |
| 24316 | { | ||
| 24317 | ✗ | types[i]=cCAVE; | |
| 24318 | ✗ | index=1; | |
| 24319 | ✗ | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24320 | ✗ | } | |
| 24321 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26860023 times.
|
26860023 | else if(types[i]==cCAVEC) |
| 24322 | { | ||
| 24323 | ✗ | types[i]=cCAVE; | |
| 24324 | ✗ | index=2; | |
| 24325 | ✗ | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24326 | ✗ | } | |
| 24327 |
1/2✓ Branch 0 taken 26860023 times.
✗ Branch 1 not taken.
|
26860023 | else if(types[i]==cCAVED) |
| 24328 | { | ||
| 24329 | ✗ | types[i]=cCAVE; | |
| 24330 | ✗ | index=3; | |
| 24331 | ✗ | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24332 | ✗ | } | |
| 24333 | |||
| 24334 |
2/2✓ Branch 0 taken 9519 times.
✓ Branch 1 taken 26857429 times.
|
26866948 | if(types[i]==cPIT) |
| 24335 | { | ||
| 24336 | 9519 | index=0; | |
| 24337 | 9519 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24338 | 9519 | } | |
| 24339 |
2/2✓ Branch 0 taken 5708 times.
✓ Branch 1 taken 26851721 times.
|
26857429 | else if(types[i]==cPITB) |
| 24340 | { | ||
| 24341 | 5708 | types[i]=cPIT; | |
| 24342 | 5708 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24343 | 5708 | index=1; | |
| 24344 | 5708 | } | |
| 24345 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26851721 times.
|
26851721 | else if(types[i]==cPITC) |
| 24346 | { | ||
| 24347 | ✗ | types[i]=cPIT; | |
| 24348 | ✗ | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24349 | ✗ | index=2; | |
| 24350 | ✗ | } | |
| 24351 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 26851715 times.
|
26851721 | else if(types[i]==cPITD) |
| 24352 | { | ||
| 24353 | 6 | types[i]=cPIT; | |
| 24354 | 6 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24355 | 6 | index=3; | |
| 24356 | 6 | } | |
| 24357 |
1/2✓ Branch 0 taken 26851715 times.
✗ Branch 1 not taken.
|
26851715 | else if(types[i]==cPITR) |
| 24358 | { | ||
| 24359 | ✗ | types[i]=cPIT; | |
| 24360 | ✗ | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24361 | ✗ | index=zc_oldrand()%4; | |
| 24362 | ✗ | } | |
| 24363 | |||
| 24364 |
2/2✓ Branch 0 taken 32729 times.
✓ Branch 1 taken 26834219 times.
|
26866948 | if(types[i]==cSTAIR) |
| 24365 | { | ||
| 24366 | 32729 | index=0; | |
| 24367 | 32729 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24368 | 32729 | } | |
| 24369 |
2/2✓ Branch 0 taken 1685 times.
✓ Branch 1 taken 26832534 times.
|
26834219 | else if(types[i]==cSTAIRB) |
| 24370 | { | ||
| 24371 | 1685 | types[i]=cSTAIR; | |
| 24372 | 1685 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24373 | 1685 | index=1; | |
| 24374 | 1685 | } | |
| 24375 |
2/2✓ Branch 0 taken 118 times.
✓ Branch 1 taken 26832416 times.
|
26832534 | else if(types[i]==cSTAIRC) |
| 24376 | { | ||
| 24377 | 118 | types[i]=cSTAIR; | |
| 24378 | 118 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24379 | 118 | index=2; | |
| 24380 | 118 | } | |
| 24381 |
2/2✓ Branch 0 taken 203 times.
✓ Branch 1 taken 26832213 times.
|
26832416 | else if(types[i]==cSTAIRD) |
| 24382 | { | ||
| 24383 | 203 | types[i]=cSTAIR; | |
| 24384 | 203 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24385 | 203 | index=3; | |
| 24386 | 203 | } | |
| 24387 |
1/2✓ Branch 0 taken 26832213 times.
✗ Branch 1 not taken.
|
26832213 | else if(types[i]==cSTAIRR) |
| 24388 | { | ||
| 24389 | ✗ | types[i]=cSTAIR; | |
| 24390 | ✗ | index=zc_oldrand()%4; | |
| 24391 | ✗ | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24392 | ✗ | } | |
| 24393 | |||
| 24394 |
2/2✓ Branch 0 taken 6563 times.
✓ Branch 1 taken 26860385 times.
|
26866948 | if(types[i]==cCAVE2) |
| 24395 | { | ||
| 24396 | 6563 | index=0; | |
| 24397 | 6563 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24398 | 6563 | } | |
| 24399 |
2/2✓ Branch 0 taken 333 times.
✓ Branch 1 taken 26860052 times.
|
26860385 | else if(types[i]==cCAVE2B) |
| 24400 | { | ||
| 24401 | 333 | types[i]=cCAVE2; | |
| 24402 | 333 | index=1; | |
| 24403 | 333 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24404 | 333 | } | |
| 24405 |
2/2✓ Branch 0 taken 163 times.
✓ Branch 1 taken 26859889 times.
|
26860052 | else if(types[i]==cCAVE2C) |
| 24406 | { | ||
| 24407 | 163 | types[i]=cCAVE2; | |
| 24408 | 163 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24409 | 163 | index=2; | |
| 24410 | 163 | } | |
| 24411 |
1/2✓ Branch 0 taken 26859889 times.
✗ Branch 1 not taken.
|
26859889 | else if(types[i]==cCAVE2D) |
| 24412 | { | ||
| 24413 | ✗ | types[i]=cCAVE2; | |
| 24414 | ✗ | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24415 | ✗ | index=3; | |
| 24416 | ✗ | } | |
| 24417 | |||
| 24418 |
2/2✓ Branch 0 taken 155 times.
✓ Branch 1 taken 26866793 times.
|
26866948 | if(types[i]==cSWIMWARP) |
| 24419 | { | ||
| 24420 | 155 | index=0; | |
| 24421 | 155 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24422 | 155 | } | |
| 24423 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26866793 times.
|
26866793 | else if(types[i]==cSWIMWARPB) |
| 24424 | { | ||
| 24425 | ✗ | types[i]=cSWIMWARP; | |
| 24426 | ✗ | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24427 | ✗ | index=1; | |
| 24428 | ✗ | } | |
| 24429 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26866793 times.
|
26866793 | else if(types[i]==cSWIMWARPC) |
| 24430 | { | ||
| 24431 | ✗ | types[i]=cSWIMWARP; | |
| 24432 | ✗ | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24433 | ✗ | index=2; | |
| 24434 | ✗ | } | |
| 24435 |
1/2✓ Branch 0 taken 26866793 times.
✗ Branch 1 not taken.
|
26866793 | else if(types[i]==cSWIMWARPD) |
| 24436 | { | ||
| 24437 | ✗ | types[i]=cSWIMWARP; | |
| 24438 | ✗ | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24439 | ✗ | index=3; | |
| 24440 | ✗ | } | |
| 24441 | |||
| 24442 |
2/2✓ Branch 0 taken 595 times.
✓ Branch 1 taken 26866353 times.
|
26866948 | if(types[i]==cDIVEWARP) |
| 24443 | { | ||
| 24444 | 595 | index=0; | |
| 24445 | 595 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24446 | 595 | } | |
| 24447 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26866353 times.
|
26866353 | else if(types[i]==cDIVEWARPB) |
| 24448 | { | ||
| 24449 | ✗ | types[i]=cDIVEWARP; | |
| 24450 | ✗ | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24451 | ✗ | index=1; | |
| 24452 | ✗ | } | |
| 24453 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26866353 times.
|
26866353 | else if(types[i]==cDIVEWARPC) |
| 24454 | { | ||
| 24455 | ✗ | types[i]=cDIVEWARP; | |
| 24456 | ✗ | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24457 | ✗ | index=2; | |
| 24458 | ✗ | } | |
| 24459 |
1/2✓ Branch 0 taken 26866353 times.
✗ Branch 1 not taken.
|
26866353 | else if(types[i]==cDIVEWARPD) |
| 24460 | { | ||
| 24461 | ✗ | types[i]=cDIVEWARP; | |
| 24462 | ✗ | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24463 | ✗ | index=3; | |
| 24464 | ✗ | } | |
| 24465 | |||
| 24466 |
2/2✓ Branch 0 taken 8272 times.
✓ Branch 1 taken 26858676 times.
|
26866948 | if(types[i]==cSTEP) warpsfx2 = combobuf[cids[i]].attribytes[0]; |
| 24467 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26858676 times.
|
26858676 | else if(types[i]==cSTEPSAME) { types[i]=cSTEP; warpsfx2 = combobuf[cids[i]].attribytes[0];} |
| 24468 |
2/2✓ Branch 0 taken 26858532 times.
✓ Branch 1 taken 144 times.
|
26858676 | else if(types[i]==cSTEPALL) { types[i]=cSTEP; warpsfx2 = combobuf[cids[i]].attribytes[0]; } |
| 24469 | 26866948 | } | |
| 24470 | |||
| 24471 | // Special case for step combos; otherwise, they act oddly in some cases | ||
| 24472 |
8/8✓ Branch 0 taken 6131808 times.
✓ Branch 1 taken 577554 times.
✓ Branch 2 taken 6068456 times.
✓ Branch 3 taken 63352 times.
✓ Branch 4 taken 1452 times.
✓ Branch 5 taken 639454 times.
✓ Branch 6 taken 127711 times.
✓ Branch 7 taken 126259 times.
|
6709362 | if((types[0]==types[1]&&types[2]==types[3]&&types[1]==types[2])||(types[1]==cSTEP&&types[3]==cSTEP)) |
| 24473 | { | ||
| 24474 |
7/8✓ Branch 0 taken 5910948 times.
✓ Branch 1 taken 29797 times.
✓ Branch 2 taken 5910948 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1549 times.
✓ Branch 5 taken 5909399 times.
✓ Branch 6 taken 420 times.
✓ Branch 7 taken 1129 times.
|
6196167 | if(action!=freeze&&action!=sideswimfreeze&&(!msg_active || !get_qr(qr_MSGFREEZE))) |
| 24475 | 5910528 | type = types[1]; | |
| 24476 | 5940745 | } | |
| 24477 | |||
| 24478 | //Generic Step | ||
| 24479 |
7/8✓ Branch 0 taken 6684288 times.
✓ Branch 1 taken 22170 times.
✓ Branch 2 taken 6684288 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1890 times.
✓ Branch 5 taken 6682398 times.
✓ Branch 6 taken 756 times.
✓ Branch 7 taken 1134 times.
|
6706458 | if(action!=freeze&&action!=sideswimfreeze&&(!msg_active || !get_qr(qr_MSGFREEZE))) |
| 24480 | { | ||
| 24481 | int32_t poses[4]; | ||
| 24482 | int32_t sensPoses[4]; | ||
| 24483 | 6683532 | int32_t xPoses[4] = {tx + 4, tx + 11, tx, tx + 15}; | |
| 24484 | 6683532 | int32_t yPoses[4] = {ty + 4, ty + 11, ty+(bigHitbox?0:8), ty + 15}; | |
| 24485 |
4/6✓ Branch 0 taken 2491073 times.
✓ Branch 1 taken 4192459 times.
✓ Branch 2 taken 2491073 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2491073 times.
|
6683532 | if(diagonalMovement||NO_GRIDLOCK) |
| 24486 | 4192459 | getPoses(poses, tx+4, ty+4, tx+11, ty+11); | |
| 24487 | 2491073 | else getPoses(poses, tx, ty, tx+15, ty+15); | |
| 24488 | 6683532 | getPoses(sensPoses, tx, ty+(bigHitbox?0:8), tx+15, ty+15); | |
| 24489 | 6683532 | bool hasStep[4] = {false}; | |
| 24490 |
2/2✓ Branch 0 taken 26734128 times.
✓ Branch 1 taken 6683532 times.
|
33417660 | for(auto p = 0; p < 4; ++p) |
| 24491 | { | ||
| 24492 |
2/2✓ Branch 0 taken 26720912 times.
✓ Branch 1 taken 187059600 times.
|
213780512 | for(auto lyr = 0; lyr < 7; ++lyr) |
| 24493 | { | ||
| 24494 |
2/2✓ Branch 0 taken 87543036 times.
✓ Branch 1 taken 99516564 times.
|
187059600 | newcombo const* cmb = poses[p]<0 ? nullptr : &combobuf[FFCore.tempScreens[lyr]->data[poses[p]]]; |
| 24495 |
4/4✓ Branch 0 taken 87543036 times.
✓ Branch 1 taken 99516564 times.
✓ Branch 2 taken 13216 times.
✓ Branch 3 taken 187046384 times.
|
187059600 | if((cmb && (cmb->triggerflags[0] & (combotriggerSTEP|combotriggerSTEPSENS))) |
| 24496 | 187059600 | || types[p] == cSTEP) | |
| 24497 | { | ||
| 24498 | 13216 | hasStep[p] = true; | |
| 24499 | 13216 | break; | |
| 24500 | } | ||
| 24501 | 187046384 | } | |
| 24502 | 26734128 | } | |
| 24503 | 6683532 | bool canNormalStep = true; | |
| 24504 |
2/2✓ Branch 0 taken 1660 times.
✓ Branch 1 taken 6693995 times.
|
6695655 | for(auto p = 0; p < 4; ++p) |
| 24505 | { | ||
| 24506 |
2/2✓ Branch 0 taken 6689509 times.
✓ Branch 1 taken 4486 times.
|
6693995 | if(poses[p] < 0) continue; |
| 24507 |
2/2✓ Branch 0 taken 7637 times.
✓ Branch 1 taken 6681872 times.
|
6689509 | if(!hasStep[p]) |
| 24508 | { | ||
| 24509 | 6681872 | canNormalStep = false; | |
| 24510 | 6681872 | break; | |
| 24511 | } | ||
| 24512 | 7637 | } | |
| 24513 |
2/2✓ Branch 0 taken 26734128 times.
✓ Branch 1 taken 6683532 times.
|
33417660 | for(auto p = 0; p < 4; ++p) |
| 24514 | { | ||
| 24515 |
2/2✓ Branch 0 taken 187138896 times.
✓ Branch 1 taken 26734128 times.
|
213873024 | for(auto lyr = 0; lyr < 7; ++lyr) |
| 24516 | { | ||
| 24517 |
2/2✓ Branch 0 taken 87607800 times.
✓ Branch 1 taken 99531096 times.
|
187138896 | newcombo const* cmb = poses[p]<0 ? nullptr : &combobuf[FFCore.tempScreens[lyr]->data[poses[p]]]; |
| 24518 |
2/2✓ Branch 0 taken 89167715 times.
✓ Branch 1 taken 97971181 times.
|
187138896 | newcombo const* cmb2 = sensPoses[p]<0 ? nullptr : &combobuf[FFCore.tempScreens[lyr]->data[sensPoses[p]]]; |
| 24519 |
6/6✓ Branch 0 taken 46480 times.
✓ Branch 1 taken 187092416 times.
✓ Branch 2 taken 19124 times.
✓ Branch 3 taken 27356 times.
✓ Branch 4 taken 19010 times.
✓ Branch 5 taken 114 times.
|
187138896 | if(canNormalStep && cmb && (cmb->triggerflags[0] & combotriggerSTEP)) |
| 24520 | { | ||
| 24521 | 114 | do_trigger_combo(lyr,poses[p]); | |
| 24522 |
2/2✓ Branch 0 taken 57 times.
✓ Branch 1 taken 57 times.
|
114 | if(poses[p] == sensPoses[p]) continue; |
| 24523 | 57 | } | |
| 24524 |
4/4✓ Branch 0 taken 89167658 times.
✓ Branch 1 taken 97971181 times.
✓ Branch 2 taken 89163296 times.
✓ Branch 3 taken 4362 times.
|
187138839 | if(cmb2 && (cmb2->triggerflags[0] & combotriggerSTEPSENS)) |
| 24525 | { | ||
| 24526 | 4362 | do_trigger_combo(lyr,sensPoses[p]); | |
| 24527 | 4362 | } | |
| 24528 | 187138839 | } | |
| 24529 | 26734128 | } | |
| 24530 | 6683532 | word c = tmpscr->numFFC(); | |
| 24531 |
2/2✓ Branch 0 taken 186259573 times.
✓ Branch 1 taken 6683532 times.
|
192943105 | for(word i=0; i<c; i++) |
| 24532 | { | ||
| 24533 | 186259573 | bool found = false; | |
| 24534 |
2/2✓ Branch 0 taken 372519146 times.
✓ Branch 1 taken 186259573 times.
|
558778719 | for(auto xch = 0; xch < 2; ++xch) |
| 24535 | { | ||
| 24536 |
2/2✓ Branch 0 taken 745038292 times.
✓ Branch 1 taken 372519146 times.
|
1117557438 | for(auto ych = 0; ych < 2; ++ych) |
| 24537 | { | ||
| 24538 |
2/2✓ Branch 0 taken 744435531 times.
✓ Branch 1 taken 602761 times.
|
745038292 | if (ffcIsAt(i, xPoses[xch], yPoses[ych])) |
| 24539 | { | ||
| 24540 | 602761 | found = true; | |
| 24541 | 602761 | } | |
| 24542 | 745038292 | } | |
| 24543 | 372519146 | } | |
| 24544 |
2/2✓ Branch 0 taken 186038141 times.
✓ Branch 1 taken 221432 times.
|
186259573 | if (found) |
| 24545 | { | ||
| 24546 | 221432 | ffcdata& ffc = tmpscr->ffcs[i]; | |
| 24547 | 221432 | newcombo const* cmb = &combobuf[ffc.data]; | |
| 24548 |
2/2✓ Branch 0 taken 221430 times.
✓ Branch 1 taken 2 times.
|
221432 | if (cmb->triggerflags[0] & (combotriggerSTEP|combotriggerSTEPSENS)) |
| 24549 | { | ||
| 24550 | 2 | do_trigger_combo_ffc(i); | |
| 24551 | 2 | } | |
| 24552 | 221432 | } | |
| 24553 | 186259573 | } | |
| 24554 | 6683532 | } | |
| 24555 |
2/2✓ Branch 0 taken 6704078 times.
✓ Branch 1 taken 2380 times.
|
6706458 | if(isDiving()) //Dive-> triggerflag |
| 24556 | { | ||
| 24557 | 2380 | int pos = COMBOPOS(x+8,y+8); | |
| 24558 | 2380 | int x1=x,x2=x+15,y1=y+(bigHitbox?0:8),y2=y+15; | |
| 24559 | 2380 | int xposes[] = {x1,x1,x2,x2}; | |
| 24560 | 2380 | int yposes[] = {y1,y2,y1,y2}; | |
| 24561 | int32_t poses[4]; | ||
| 24562 | 2380 | getPoses(poses,x1,y1,x2,y2); | |
| 24563 |
2/2✓ Branch 0 taken 16660 times.
✓ Branch 1 taken 2380 times.
|
19040 | for(auto lyr = 0; lyr < 7; ++lyr) |
| 24564 | { | ||
| 24565 | 16660 | mapscr* s = FFCore.tempScreens[lyr]; | |
| 24566 | 16660 | newcombo const& cmb = combobuf[s->data[pos]]; | |
| 24567 | 16660 | bool didtrig = false; | |
| 24568 |
1/2✓ Branch 0 taken 16660 times.
✗ Branch 1 not taken.
|
16660 | if (cmb.triggerflags[3] & combotriggerDIVETRIG) |
| 24569 | { | ||
| 24570 | ✗ | do_trigger_combo(lyr,pos); | |
| 24571 | ✗ | didtrig = true; | |
| 24572 | ✗ | } | |
| 24573 |
2/2✓ Branch 0 taken 66640 times.
✓ Branch 1 taken 16660 times.
|
83300 | for(auto q = 0; q < 4; ++q) |
| 24574 | { | ||
| 24575 |
2/2✓ Branch 0 taken 33593 times.
✓ Branch 1 taken 33047 times.
|
66640 | if(poses[q] < 0) continue; |
| 24576 |
3/4✓ Branch 0 taken 16660 times.
✓ Branch 1 taken 16933 times.
✓ Branch 2 taken 16660 times.
✗ Branch 3 not taken.
|
33593 | if(poses[q] == pos && didtrig) continue; |
| 24577 | 33593 | newcombo const& cmb = combobuf[s->data[poses[q]]]; | |
| 24578 |
1/2✓ Branch 0 taken 33593 times.
✗ Branch 1 not taken.
|
33593 | if (cmb.triggerflags[3] & combotriggerDIVESENSTRIG) |
| 24579 | ✗ | do_trigger_combo(lyr,poses[q]); | |
| 24580 | 33593 | } | |
| 24581 | 16660 | } | |
| 24582 | 2380 | word c = tmpscr->numFFC(); | |
| 24583 |
2/2✓ Branch 0 taken 66308 times.
✓ Branch 1 taken 2380 times.
|
68688 | for(word i=0; i<c; i++) |
| 24584 | { | ||
| 24585 | 66308 | ffcdata& ffc = tmpscr->ffcs[i]; | |
| 24586 | 66308 | newcombo const& cmb = combobuf[ffc.data]; | |
| 24587 |
2/4✓ Branch 0 taken 66308 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 66308 times.
|
66308 | if ((cmb.triggerflags[3] & combotriggerDIVETRIG) && ffcIsAt(i, x+8, y+8)) |
| 24588 | { | ||
| 24589 | ✗ | do_trigger_combo_ffc(i); | |
| 24590 | ✗ | } | |
| 24591 |
1/2✓ Branch 0 taken 66308 times.
✗ Branch 1 not taken.
|
66308 | else if(cmb.triggerflags[3] & combotriggerDIVESENSTRIG) |
| 24592 | { | ||
| 24593 | ✗ | for(auto q = 0; q < 4; ++q) | |
| 24594 | { | ||
| 24595 | ✗ | if(ffcIsAt(i, xposes[q], yposes[q])) | |
| 24596 | { | ||
| 24597 | ✗ | do_trigger_combo_ffc(i); | |
| 24598 | ✗ | break; | |
| 24599 | } | ||
| 24600 | ✗ | } | |
| 24601 | ✗ | } | |
| 24602 | 66308 | } | |
| 24603 | 2380 | } | |
| 24604 | |||
| 24605 | // | ||
| 24606 | // Now, let's check for Save combos... | ||
| 24607 | // | ||
| 24608 | 6706458 | x1 = tx+4; | |
| 24609 | 6706458 | x2 = tx+11; | |
| 24610 | 6706458 | y1 = ty+4; | |
| 24611 | 6706458 | y2 = ty+11; | |
| 24612 | |||
| 24613 | 6706458 | types[0] = COMBOTYPE(x1,y1); | |
| 24614 | 6706458 | cids[0] = MAPCOMBO(x1,y1); | |
| 24615 | |||
| 24616 |
2/2✓ Branch 0 taken 171548 times.
✓ Branch 1 taken 6534910 times.
|
6706458 | if(MAPFFCOMBO(x1,y1)) |
| 24617 | { | ||
| 24618 | 171548 | types[0] = FFCOMBOTYPE(x1,y1); | |
| 24619 | 171548 | cids[0] = MAPFFCOMBO(x1,y1); | |
| 24620 | 171548 | } | |
| 24621 | |||
| 24622 | 6706458 | types[1] = COMBOTYPE(x1,y2); | |
| 24623 | 6706458 | cids[1] = MAPCOMBO(x1,y2); | |
| 24624 | |||
| 24625 |
2/2✓ Branch 0 taken 126986 times.
✓ Branch 1 taken 6579472 times.
|
6706458 | if(MAPFFCOMBO(x1,y2)) |
| 24626 | { | ||
| 24627 | 126986 | types[1] = FFCOMBOTYPE(x1,y2); | |
| 24628 | 126986 | cids[1] = MAPFFCOMBO(x1,y2); | |
| 24629 | 126986 | } | |
| 24630 | |||
| 24631 | 6706458 | types[2] = COMBOTYPE(x2,y1); | |
| 24632 | 6706458 | cids[2] = MAPCOMBO(x2,y1); | |
| 24633 | |||
| 24634 |
2/2✓ Branch 0 taken 170817 times.
✓ Branch 1 taken 6535641 times.
|
6706458 | if(MAPFFCOMBO(x2,y1)) |
| 24635 | { | ||
| 24636 | 170817 | types[2] = FFCOMBOTYPE(x2,y1); | |
| 24637 | 170817 | cids[2] = MAPFFCOMBO(x2,y1); | |
| 24638 | 170817 | } | |
| 24639 | |||
| 24640 | 6706458 | types[3] = COMBOTYPE(x2,y2); | |
| 24641 | 6706458 | cids[3] = MAPCOMBO(x2,y2); | |
| 24642 | |||
| 24643 |
2/2✓ Branch 0 taken 127459 times.
✓ Branch 1 taken 6578999 times.
|
6706458 | if(MAPFFCOMBO(x2,y2)) |
| 24644 | { | ||
| 24645 | 127459 | types[3] = FFCOMBOTYPE(x2,y2); | |
| 24646 | 127459 | cids[3] = MAPFFCOMBO(x2,y2); | |
| 24647 | 127459 | } | |
| 24648 | |||
| 24649 | |||
| 24650 |
2/2✓ Branch 0 taken 6706458 times.
✓ Branch 1 taken 26867272 times.
|
33573730 | for(int32_t i=0; i<4; i++) |
| 24651 | { | ||
| 24652 |
2/2✓ Branch 0 taken 26866948 times.
✓ Branch 1 taken 324 times.
|
26867272 | if(combobuf[cids[i]].triggerflags[0] & combotriggerONLYGENTRIG) |
| 24653 | { | ||
| 24654 |
2/4✓ Branch 0 taken 324 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 324 times.
|
324 | if(types[i] == cSAVE || types[i] == cSAVE2) |
| 24655 | { | ||
| 24656 | ✗ | types[i] = cNONE; | |
| 24657 | ✗ | setsave = false; | |
| 24658 | ✗ | break; | |
| 24659 | } | ||
| 24660 | 324 | } | |
| 24661 |
2/2✓ Branch 0 taken 26865986 times.
✓ Branch 1 taken 1286 times.
|
26867272 | if(types[i]==cSAVE) setsave=true; |
| 24662 | |||
| 24663 |
1/2✓ Branch 0 taken 26867272 times.
✗ Branch 1 not taken.
|
26867272 | if(types[i]==cSAVE2) setsave=true; |
| 24664 | 26867272 | } | |
| 24665 | |||
| 24666 |
8/8✓ Branch 0 taken 431 times.
✓ Branch 1 taken 6706027 times.
✓ Branch 2 taken 343 times.
✓ Branch 3 taken 88 times.
✓ Branch 4 taken 335 times.
✓ Branch 5 taken 8 times.
✓ Branch 6 taken 106 times.
✓ Branch 7 taken 229 times.
|
6706458 | if(setsave && types[0]==types[1]&&types[2]==types[3]&&types[1]==types[2]) |
| 24667 | { | ||
| 24668 | 229 | last_savepoint_id = cids[0]; | |
| 24669 | 229 | type = types[0]; | |
| 24670 | 229 | } | |
| 24671 | // | ||
| 24672 | // Now, let's check for Drowning combos... | ||
| 24673 | // | ||
| 24674 |
4/4✓ Branch 0 taken 2617048 times.
✓ Branch 1 taken 4089410 times.
✓ Branch 2 taken 10360 times.
✓ Branch 3 taken 2626072 times.
|
6706458 | if(get_qr(qr_DROWN) || CanSideSwim()) |
| 24675 | { | ||
| 24676 | 4099770 | y1 = ty+9; | |
| 24677 | 4099770 | y2 = ty+15; | |
| 24678 |
2/2✓ Branch 0 taken 1026881 times.
✓ Branch 1 taken 3072889 times.
|
4099770 | if (get_qr(qr_SMARTER_WATER)) |
| 24679 | { | ||
| 24680 |
4/4✓ Branch 0 taken 11287 times.
✓ Branch 1 taken 1015594 times.
✓ Branch 2 taken 22 times.
✓ Branch 3 taken 8892 times.
|
1035795 | if (iswaterex(0, currmap, currscr, -1, x1, y1, true, false) && |
| 24681 |
2/2✓ Branch 0 taken 10186 times.
✓ Branch 1 taken 1101 times.
|
11287 | iswaterex(0, currmap, currscr, -1, x1, y2, true, false) && |
| 24682 |
2/2✓ Branch 0 taken 8914 times.
✓ Branch 1 taken 1272 times.
|
10186 | iswaterex(0, currmap, currscr, -1, x2, y1, true, false) && |
| 24683 | 8914 | iswaterex(0, currmap, currscr, -1, x2, y2, true, false)) water = iswaterex(0, currmap, currscr, -1, (x2+x1)/2,(y2+y1)/2, true, false); | |
| 24684 | 1026881 | } | |
| 24685 | else | ||
| 24686 | { | ||
| 24687 | 3072889 | types[0] = COMBOTYPE(x1,y1); | |
| 24688 | |||
| 24689 |
2/2✓ Branch 0 taken 2969390 times.
✓ Branch 1 taken 103499 times.
|
3072889 | if(MAPFFCOMBO(x1,y1)) |
| 24690 | 103499 | types[0] = FFCOMBOTYPE(x1,y1); | |
| 24691 | |||
| 24692 | 3072889 | types[1] = COMBOTYPE(x1,y2); | |
| 24693 | |||
| 24694 |
2/2✓ Branch 0 taken 2982872 times.
✓ Branch 1 taken 90017 times.
|
3072889 | if(MAPFFCOMBO(x1,y2)) |
| 24695 | 90017 | types[1] = FFCOMBOTYPE(x1,y2); | |
| 24696 | |||
| 24697 | 3072889 | types[2] = COMBOTYPE(x2,y1); | |
| 24698 | |||
| 24699 |
2/2✓ Branch 0 taken 2967696 times.
✓ Branch 1 taken 105193 times.
|
3072889 | if(MAPFFCOMBO(x2,y1)) |
| 24700 | 105193 | types[2] = FFCOMBOTYPE(x2,y1); | |
| 24701 | |||
| 24702 | 3072889 | types[3] = COMBOTYPE(x2,y2); | |
| 24703 | |||
| 24704 |
2/2✓ Branch 0 taken 2979440 times.
✓ Branch 1 taken 93449 times.
|
3072889 | if(MAPFFCOMBO(x2,y2)) |
| 24705 | 93449 | types[3] = FFCOMBOTYPE(x2,y2); | |
| 24706 | |||
| 24707 | 3072889 | int32_t typec = COMBOTYPE((x2+x1)/2,(y2+y1)/2); | |
| 24708 |
2/2✓ Branch 0 taken 2974116 times.
✓ Branch 1 taken 98773 times.
|
3072889 | if(MAPFFCOMBO((x2+x1)/2,(y2+y1)/2)) |
| 24709 | 98773 | typec = FFCOMBOTYPE((x2+x1)/2,(y2+y1)/2); | |
| 24710 | |||
| 24711 |
5/6✓ Branch 0 taken 8991 times.
✓ Branch 1 taken 3063898 times.
✓ Branch 2 taken 8624 times.
✓ Branch 3 taken 367 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 8166 times.
|
3081055 | if(combo_class_buf[types[0]].water && combo_class_buf[types[1]].water && |
| 24712 |
3/4✓ Branch 0 taken 8166 times.
✓ Branch 1 taken 458 times.
✓ Branch 2 taken 8166 times.
✗ Branch 3 not taken.
|
8624 | combo_class_buf[types[2]].water && combo_class_buf[types[3]].water && combo_class_buf[typec].water) |
| 24713 | 8166 | water = typec; | |
| 24714 | } | ||
| 24715 | 4099770 | } | |
| 24716 | |||
| 24717 | |||
| 24718 | // Pits have a bigger 'hitbox' than stairs... | ||
| 24719 | 6725842 | x1 = tx+7; | |
| 24720 | 6725842 | x2 = tx+8; | |
| 24721 | 6725842 | y1 = ty+7+(bigHitbox?0:4); | |
| 24722 | 6725842 | y2 = ty+8+(bigHitbox?0:4); | |
| 24723 | |||
| 24724 | 6725842 | types[0] = COMBOTYPE(x1,y1); | |
| 24725 | 6725842 | cids[0] = MAPCOMBO(x1,y1); | |
| 24726 | |||
| 24727 |
2/2✓ Branch 0 taken 128019 times.
✓ Branch 1 taken 6597823 times.
|
6725842 | if(MAPFFCOMBO(x1,y1)) |
| 24728 | { | ||
| 24729 | 128019 | types[0] = FFCOMBOTYPE(x1,y1); | |
| 24730 | 128019 | cids[0] = MAPFFCOMBO(x1,y1); | |
| 24731 | 128019 | } | |
| 24732 | |||
| 24733 | 6725842 | types[1] = COMBOTYPE(x1,y2); | |
| 24734 | 6725842 | cids[1] = MAPCOMBO(x1,y2); | |
| 24735 | |||
| 24736 |
2/2✓ Branch 0 taken 126968 times.
✓ Branch 1 taken 6598874 times.
|
6725842 | if(MAPFFCOMBO(x1,y2)) |
| 24737 | { | ||
| 24738 | 126968 | types[1] = FFCOMBOTYPE(x1,y2); | |
| 24739 | 126968 | cids[1] = MAPFFCOMBO(x1,y2); | |
| 24740 | 126968 | } | |
| 24741 | 6725842 | types[2] = COMBOTYPE(x2,y1); | |
| 24742 | 6725842 | cids[2] = MAPCOMBO(x2,y1); | |
| 24743 | |||
| 24744 |
2/2✓ Branch 0 taken 128683 times.
✓ Branch 1 taken 6597159 times.
|
6725842 | if(MAPFFCOMBO(x2,y1)) |
| 24745 | { | ||
| 24746 | 128683 | types[2] = FFCOMBOTYPE(x2,y1); | |
| 24747 | 128683 | cids[2] = MAPFFCOMBO(x2,y1); | |
| 24748 | 128683 | } | |
| 24749 | |||
| 24750 | 6725842 | types[3] = COMBOTYPE(x2,y2); | |
| 24751 | 6725842 | cids[3] = MAPCOMBO(x2,y2); | |
| 24752 | |||
| 24753 |
2/2✓ Branch 0 taken 127664 times.
✓ Branch 1 taken 6598178 times.
|
6725842 | if(MAPFFCOMBO(x2,y2)) |
| 24754 | { | ||
| 24755 | 127664 | types[3] = FFCOMBOTYPE(x2,y2); | |
| 24756 | 127664 | cids[3] = MAPFFCOMBO(x2,y2); | |
| 24757 | 127664 | } | |
| 24758 | |||
| 24759 |
2/2✓ Branch 0 taken 26867272 times.
✓ Branch 1 taken 6725842 times.
|
33593114 | for(int32_t i=0; i<4; i++) |
| 24760 | { | ||
| 24761 |
2/2✓ Branch 0 taken 264 times.
✓ Branch 1 taken 26867008 times.
|
26867272 | if(combobuf[cids[i]].triggerflags[0] & combotriggerONLYGENTRIG) |
| 24762 | { | ||
| 24763 | 264 | types[i] = cNONE; | |
| 24764 | 264 | continue; | |
| 24765 | } | ||
| 24766 |
2/2✓ Branch 0 taken 3037 times.
✓ Branch 1 taken 26863971 times.
|
26867008 | if(types[i]==cPIT) |
| 24767 | { | ||
| 24768 | 3037 | index=0; | |
| 24769 | 3037 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24770 | 3037 | } | |
| 24771 |
2/2✓ Branch 0 taken 5004 times.
✓ Branch 1 taken 26858967 times.
|
26863971 | else if(types[i]==cPITB) |
| 24772 | { | ||
| 24773 | 5004 | types[i]=cPIT; | |
| 24774 | 5004 | index=1; | |
| 24775 | 5004 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24776 | 5004 | } | |
| 24777 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26858967 times.
|
26858967 | else if(types[i]==cPITC) |
| 24778 | { | ||
| 24779 | ✗ | types[i]=cPIT; | |
| 24780 | ✗ | index=2; | |
| 24781 | ✗ | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24782 | ✗ | } | |
| 24783 |
2/2✓ Branch 0 taken 26858965 times.
✓ Branch 1 taken 2 times.
|
26858967 | else if(types[i]==cPITD) |
| 24784 | { | ||
| 24785 | 2 | types[i]=cPIT; | |
| 24786 | 2 | index=3; | |
| 24787 | 2 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24788 | 2 | } | |
| 24789 | 26867008 | } | |
| 24790 | |||
| 24791 |
8/8✓ Branch 0 taken 6714813 times.
✓ Branch 1 taken 11029 times.
✓ Branch 2 taken 6714795 times.
✓ Branch 3 taken 18 times.
✓ Branch 4 taken 6714597 times.
✓ Branch 5 taken 198 times.
✓ Branch 6 taken 10776 times.
✓ Branch 7 taken 6723529 times.
|
6725842 | if(types[0]==cPIT||types[1]==cPIT||types[2]==cPIT||types[3]==cPIT) |
| 24792 |
3/8✓ Branch 0 taken 2221 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2221 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2221 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
24242 | if(action!=freeze&&action!=sideswimfreeze&& (!msg_active || !get_qr(qr_MSGFREEZE))) |
| 24793 | 2221 | type=cPIT; | |
| 24794 | |||
| 24795 | // | ||
| 24796 | // Time to act on our results for type, flag, flag2 and flag3... | ||
| 24797 | // | ||
| 24798 |
3/4✓ Branch 0 taken 229 times.
✓ Branch 1 taken 6725521 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 229 times.
|
6725750 | if(type==cSAVE&&currscr<128) |
| 24799 | 229 | *ls=1; | |
| 24800 | |||
| 24801 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 6725750 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
6725750 | if(type==cSAVE2&&currscr<128) |
| 24802 | ✗ | *ls=2; | |
| 24803 | |||
| 24804 |
8/8✓ Branch 0 taken 6706468 times.
✓ Branch 1 taken 19282 times.
✓ Branch 2 taken 6690053 times.
✓ Branch 3 taken 16415 times.
✓ Branch 4 taken 6689523 times.
✓ Branch 5 taken 530 times.
✓ Branch 6 taken 13800 times.
✓ Branch 7 taken 6703323 times.
|
6725750 | if(refilling==REFILL_LIFE || flag==mfFAIRY||flag2==mfFAIRY||flag3==mfFAIRY) |
| 24805 | { | ||
| 24806 | 50027 | fairycircle(REFILL_LIFE); | |
| 24807 | |||
| 24808 |
2/2✓ Branch 0 taken 4332 times.
✓ Branch 1 taken 22963 times.
|
50027 | if(fairyclk!=0) return; |
| 24809 | 4332 | } | |
| 24810 | |||
| 24811 |
7/8✓ Branch 0 taken 6693841 times.
✓ Branch 1 taken 13814 times.
✓ Branch 2 taken 6693759 times.
✓ Branch 3 taken 82 times.
✓ Branch 4 taken 6693759 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 13828 times.
✓ Branch 7 taken 6707587 times.
|
6707655 | if(refilling==REFILL_MAGIC || flag==mfMAGICFAIRY||flag2==mfMAGICFAIRY||flag3==mfMAGICFAIRY) |
| 24812 | { | ||
| 24813 | 27724 | fairycircle(REFILL_MAGIC); | |
| 24814 | |||
| 24815 |
2/2✓ Branch 0 taken 95 times.
✓ Branch 1 taken 1 times.
|
27724 | if(fairyclk!=0) return; |
| 24816 | 1 | } | |
| 24817 | |||
| 24818 |
7/8✓ Branch 0 taken 6693726 times.
✓ Branch 1 taken 13862 times.
✓ Branch 2 taken 6693545 times.
✓ Branch 3 taken 181 times.
✓ Branch 4 taken 6693545 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 13896 times.
✓ Branch 7 taken 6707441 times.
|
6707588 | if(refilling==REFILL_ALL || flag==mfALLFAIRY||flag2==mfALLFAIRY||flag3==mfALLFAIRY) |
| 24819 | { | ||
| 24820 | 27939 | fairycircle(REFILL_ALL); | |
| 24821 | |||
| 24822 |
2/2✓ Branch 0 taken 196 times.
✓ Branch 1 taken 19 times.
|
27939 | if(fairyclk!=0) return; |
| 24823 | 19 | } | |
| 24824 | |||
| 24825 | // Just in case Hero was moved off of the fairy flag | ||
| 24826 |
1/2✓ Branch 0 taken 6707460 times.
✗ Branch 1 not taken.
|
6707460 | if(refilling==REFILL_FAIRYDONE) |
| 24827 | { | ||
| 24828 | ✗ | fairycircle(REFILL_NONE); | |
| 24829 | |||
| 24830 | ✗ | if(fairyclk!=0) return; | |
| 24831 | ✗ | } | |
| 24832 | |||
| 24833 |
6/8✓ Branch 0 taken 6693554 times.
✓ Branch 1 taken 13906 times.
✓ Branch 2 taken 6693554 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6693554 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 13916 times.
✓ Branch 7 taken 6707338 times.
|
6707460 | if(flag==mfZELDA||flag2==mfZELDA||flag3==mfZELDA || combo_class_buf[type].win_game) |
| 24834 | { | ||
| 24835 | 27822 | attackclk = 0; //get rid of Hero's sword if it was stuck out, charged. | |
| 24836 | 27822 | win_game(); | |
| 24837 | 27822 | return; | |
| 24838 | } | ||
| 24839 | |||
| 24840 |
4/4✓ Branch 0 taken 6676025 times.
✓ Branch 1 taken 31313 times.
✓ Branch 2 taken 6690089 times.
✓ Branch 3 taken 17249 times.
|
6707338 | if((z>0 || fakez>0) && !(tmpscr->flags2&fAIRCOMBOS)) |
| 24841 | 17249 | return; | |
| 24842 | |||
| 24843 |
4/4✓ Branch 0 taken 6673674 times.
✓ Branch 1 taken 16415 times.
✓ Branch 2 taken 721 times.
✓ Branch 3 taken 6672953 times.
|
6690089 | if((type==cTRIGNOFLAG || type==cTRIGFLAG)) |
| 24844 | { | ||
| 24845 | |||
| 24846 |
4/4✓ Branch 0 taken 2089 times.
✓ Branch 1 taken 15047 times.
✓ Branch 2 taken 15415 times.
✓ Branch 3 taken 16616 times.
|
17136 | if((((ty+8)&0xF0)+((tx+8)>>4))!=stepsecret || get_qr(qr_TRIGGERSREPEAT)) |
| 24847 | { | ||
| 24848 | 30462 | stepsecret = (((ty+8)&0xF0)+((tx+8)>>4)); | |
| 24849 | 30462 | sfx(combobuf[tmpscr->data[stepsecret]].attribytes[0],pan((int32_t)x)); | |
| 24850 | |||
| 24851 |
4/4✓ Branch 0 taken 225 times.
✓ Branch 1 taken 2631 times.
✓ Branch 2 taken 27 times.
✓ Branch 3 taken 198 times.
|
30462 | if(type==cTRIGFLAG && canPermSecret()) |
| 24852 | { | ||
| 24853 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 198 times.
|
198 | if(!(tmpscr->flags5&fTEMPSECRETS)) setmapflag(mSECRET); |
| 24854 | |||
| 24855 | 198 | hidden_entrance(0,true,false); | |
| 24856 | 198 | } | |
| 24857 | else | ||
| 24858 | { | ||
| 24859 | 2658 | bool only16_31 = get_qr(qr_STEPTEMP_SECRET_ONLY_16_31)?true:false; | |
| 24860 | 2658 | hidden_entrance(0,true,only16_31); | |
| 24861 | } | ||
| 24862 | 2856 | } | |
| 24863 | 19472 | } | |
| 24864 |
2/2✓ Branch 0 taken 1415 times.
✓ Branch 1 taken 6671538 times.
|
6672953 | else if(!didstrig) |
| 24865 | { | ||
| 24866 | 6671538 | stepsecret = -1; | |
| 24867 | 6671538 | } | |
| 24868 | |||
| 24869 | //Better? Dock collision | ||
| 24870 | |||
| 24871 | // Drown if: | ||
| 24872 | // * Water (obviously walkable), | ||
| 24873 | // * Quest Rule allows it, | ||
| 24874 | // * Not on stepladder, | ||
| 24875 | // * Not jumping, | ||
| 24876 | // * Not hovering, | ||
| 24877 | // * Not rafting, | ||
| 24878 | // * Not swallowed, | ||
| 24879 | // * Not a dried lake. | ||
| 24880 | |||
| 24881 | // This used to check for swimming too, but I moved that into the block so that you can drown in higher-leveled water. -Dimi | ||
| 24882 |
9/12✓ Branch 0 taken 16842 times.
✓ Branch 1 taken 6638077 times.
✓ Branch 2 taken 16259 times.
✓ Branch 3 taken 583 times.
✓ Branch 4 taken 16259 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 10693 times.
✓ Branch 7 taken 5566 times.
✓ Branch 8 taken 10693 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 10693 times.
|
6702594 | if(water > 0 && !ladderx && hoverclk==0 && action!=rafting && !inlikelike && !DRIEDLAKE |
| 24883 |
4/8✓ Branch 0 taken 10693 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10693 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 10693 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 10693 times.
✗ Branch 7 not taken.
|
10693 | && ((get_qr(qr_DROWN) && z==0 && fakez==0 && fall>=0 && fakefall>=0) || CanSideSwim()) |
| 24884 |
4/4✓ Branch 0 taken 10693 times.
✓ Branch 1 taken 10693 times.
✓ Branch 2 taken 10693 times.
✓ Branch 3 taken 10693 times.
|
10693 | && (sideview_mode() || !platform_ffc)) |
| 24885 | { | ||
| 24886 |
7/8✓ Branch 0 taken 10504 times.
✓ Branch 1 taken 189 times.
✓ Branch 2 taken 10501 times.
✓ Branch 3 taken 3 times.
✓ Branch 4 taken 2518 times.
✓ Branch 5 taken 7983 times.
✓ Branch 6 taken 2518 times.
✗ Branch 7 not taken.
|
10693 | if(current_item(itype_flippers) <= 0 || current_item(itype_flippers) < combobuf[water].attribytes[0] || ((combobuf[water].usrflags&cflag1) && !(itemsbuf[current_item_id(itype_flippers)].flags & item_flag3))) |
| 24887 | { | ||
| 24888 |
1/2✓ Branch 0 taken 192 times.
✗ Branch 1 not taken.
|
192 | if(!(ladderx+laddery)) drownCombo = water; |
| 24889 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 188 times.
|
192 | if (combobuf[water].usrflags&cflag1) Drown(1); |
| 24890 | 188 | else Drown(); | |
| 24891 |
2/2✓ Branch 0 taken 176 times.
✓ Branch 1 taken 16 times.
|
192 | if(byte drown_sfx = combobuf[water].attribytes[4]) |
| 24892 | 16 | sfx(drown_sfx, pan(int32_t(x))); | |
| 24893 | 192 | } | |
| 24894 |
2/2✓ Branch 0 taken 10237 times.
✓ Branch 1 taken 264 times.
|
10501 | else if (!isSwimming()) |
| 24895 | { | ||
| 24896 | 264 | SetSwim(); | |
| 24897 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 264 times.
|
264 | if (!IsSideSwim()) attackclk = charging = spins = 0; |
| 24898 | 264 | landswim=0; | |
| 24899 | 264 | return; | |
| 24900 | } | ||
| 24901 | 10429 | } | |
| 24902 | |||
| 24903 | |||
| 24904 |
2/2✓ Branch 0 taken 334 times.
✓ Branch 1 taken 6675707 times.
|
6676041 | if(type==cSTEP) |
| 24905 | { | ||
| 24906 |
2/2✓ Branch 0 taken 148 times.
✓ Branch 1 taken 186 times.
|
334 | if((((ty+8)&0xF0)+((tx+8)>>4))!=stepnext) |
| 24907 | { | ||
| 24908 | 186 | stepnext=((ty+8)&0xF0)+((tx+8)>>4); | |
| 24909 | |||
| 24910 | if | ||
| 24911 | ( | ||
| 24912 |
2/2✓ Branch 0 taken 167 times.
✓ Branch 1 taken 19 times.
|
186 | COMBOTYPE(tx+8,ty+8)==cSTEP && /*required item*/ |
| 24913 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 167 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
167 | (!combobuf[tmpscr->data[stepnext]].attribytes[1] || (combobuf[tmpscr->data[stepnext]].attribytes[1] && game->item[combobuf[tmpscr->data[stepnext]].attribytes[1]]) ) |
| 24914 | ✗ | && /*HEAVY*/ | |
| 24915 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 167 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
167 | ( ( !(combobuf[tmpscr->data[stepnext]].usrflags&cflag1) ) || ((combobuf[tmpscr->data[stepnext]].usrflags&cflag1) && Hero.HasHeavyBoots() ) ) |
| 24916 | ) | ||
| 24917 | |||
| 24918 | { | ||
| 24919 | 167 | sfx(combobuf[tmpscr->data[stepnext]].attribytes[0],pan((int32_t)x)); | |
| 24920 | 167 | tmpscr->data[stepnext]++; | |
| 24921 | |||
| 24922 | 167 | } | |
| 24923 | |||
| 24924 | if | ||
| 24925 | ( | ||
| 24926 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 186 times.
|
186 | COMBOTYPE(tx+8,ty+8)==cSTEPSAME && /*required item*/ |
| 24927 | ✗ | (!combobuf[MAPCOMBO(tx+8,ty+8)].attribytes[1] || (combobuf[MAPCOMBO(tx+8,ty+8)].attribytes[1] && game->item[combobuf[MAPCOMBO(tx+8,ty+8)].attribytes[1]]) ) | |
| 24928 | ✗ | && /*HEAVY*/ | |
| 24929 | ✗ | ( ( !(combobuf[tmpscr->data[stepnext]].usrflags&cflag1) ) || ((combobuf[tmpscr->data[stepnext]].usrflags&cflag1) && Hero.HasHeavyBoots() ) ) | |
| 24930 | ) | ||
| 24931 | { | ||
| 24932 | ✗ | int32_t stepc = tmpscr->data[stepnext]; | |
| 24933 | ✗ | sfx(combobuf[MAPCOMBO(tx+8,ty+8)].attribytes[0],pan((int32_t)x)); | |
| 24934 | ✗ | for(int32_t k=0; k<176; k++) | |
| 24935 | { | ||
| 24936 | ✗ | if(tmpscr->data[k]==stepc) | |
| 24937 | { | ||
| 24938 | ✗ | tmpscr->data[k]++; | |
| 24939 | ✗ | } | |
| 24940 | ✗ | } | |
| 24941 | ✗ | } | |
| 24942 | |||
| 24943 | if | ||
| 24944 | ( | ||
| 24945 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 179 times.
|
186 | COMBOTYPE(tx+8,ty+8)==cSTEPALL && /*required item*/ |
| 24946 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
7 | (!combobuf[MAPCOMBO(tx+8,ty+8)].attribytes[1] || (combobuf[MAPCOMBO(tx+8,ty+8)].attribytes[1] && game->item[combobuf[MAPCOMBO(tx+8,ty+8)].attribytes[1]]) ) |
| 24947 | ✗ | && /*HEAVY*/ | |
| 24948 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
7 | ( ( !(combobuf[tmpscr->data[stepnext]].usrflags&cflag1) ) || ((combobuf[tmpscr->data[stepnext]].usrflags&cflag1) && Hero.HasHeavyBoots() ) ) |
| 24949 | ) | ||
| 24950 | { | ||
| 24951 | 7 | sfx(combobuf[MAPCOMBO(tx+8,ty+8)].attribytes[0],pan((int32_t)x)); | |
| 24952 |
2/2✓ Branch 0 taken 1232 times.
✓ Branch 1 taken 7 times.
|
1239 | for(int32_t k=0; k<176; k++) |
| 24953 | { | ||
| 24954 | if( | ||
| 24955 |
3/4✓ Branch 0 taken 1232 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 99 times.
✓ Branch 3 taken 1051 times.
|
2382 | (combobuf[tmpscr->data[k]].type==cSTEP)|| |
| 24956 |
1/2✓ Branch 0 taken 1232 times.
✗ Branch 1 not taken.
|
1232 | (combobuf[tmpscr->data[k]].type==cSTEPSAME)|| |
| 24957 |
2/2✓ Branch 0 taken 1150 times.
✓ Branch 1 taken 82 times.
|
1232 | (combobuf[tmpscr->data[k]].type==cSTEPALL)|| |
| 24958 | 1150 | (combobuf[tmpscr->data[k]].type==cSTEPCOPY) | |
| 24959 | ) | ||
| 24960 | { | ||
| 24961 | 181 | tmpscr->data[k]++; | |
| 24962 | 181 | } | |
| 24963 | 1232 | } | |
| 24964 | 7 | } | |
| 24965 | 186 | } | |
| 24966 | 334 | } | |
| 24967 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 6675707 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
6675707 | else if(type==cSTEPSFX && action == walking) |
| 24968 | { | ||
| 24969 | ✗ | trigger_stepfx(0, COMBOPOS(tx+8,ty+8), true); | |
| 24970 | ✗ | } | |
| 24971 | 6675707 | else stepnext = -1; | |
| 24972 | |||
| 24973 | 6676041 | detail_int[0]=tx; | |
| 24974 | 6676041 | detail_int[1]=ty; | |
| 24975 | |||
| 24976 | |||
| 24977 |
8/8✓ Branch 0 taken 6675585 times.
✓ Branch 1 taken 456 times.
✓ Branch 2 taken 877 times.
✓ Branch 3 taken 6675164 times.
✓ Branch 4 taken 6673178 times.
✓ Branch 5 taken 1986 times.
✓ Branch 6 taken 14 times.
✓ Branch 7 taken 11 times.
|
6676066 | if(!((type==cCAVE || type==cCAVE2) && z==0 && fakez==0) && type!=cSTAIR && |
| 24978 |
5/6✓ Branch 0 taken 6672226 times.
✓ Branch 1 taken 952 times.
✓ Branch 2 taken 6672205 times.
✓ Branch 3 taken 21 times.
✓ Branch 4 taken 6672205 times.
✗ Branch 5 not taken.
|
6673178 | type!=cPIT && type!=cSWIMWARP && type!=cRESET && |
| 24979 |
2/2✓ Branch 0 taken 25 times.
✓ Branch 1 taken 6672180 times.
|
6672205 | !(type==cDIVEWARP && isDiving())) |
| 24980 | 6672191 | { | |
| 24981 | RaftingStuff: | ||
| 24982 |
2/2✓ Branch 0 taken 6671632 times.
✓ Branch 1 taken 559 times.
|
6672191 | if (get_qr(qr_BETTER_RAFT_2)) |
| 24983 | { | ||
| 24984 | 559 | bool doraft = true; | |
| 24985 |
4/6✓ Branch 0 taken 559 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 556 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 3 times.
|
559 | if(((int32_t)y>=raftwarpy-12&&(int32_t)y<=raftwarpy+3)&&raftwarpy!=-1) |
| 24986 | { | ||
| 24987 |
3/6✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 3 times.
|
3 | if(((int32_t)x>=raftwarpx-8&&(int32_t)x<=raftwarpx+7)&&raftwarpx!=-1) |
| 24988 | { | ||
| 24989 | 3 | doraft = false; | |
| 24990 | 3 | } | |
| 24991 | 3 | } | |
| 24992 | //if (mfRAFT) | ||
| 24993 | int32_t rafttypes[2]; | ||
| 24994 | 559 | int32_t raftx1 = tx+6; | |
| 24995 | 559 | int32_t raftx2 = tx+9; | |
| 24996 | 559 | int32_t rafty = ty+11; | |
| 24997 | int32_t raftflags[3]; | ||
| 24998 | 559 | rafttypes[0]=rafttypes[1]=-1; | |
| 24999 | 559 | raftflags[0]=raftflags[1]=raftflags[2]=0; | |
| 25000 | 559 | rafttypes[0] = MAPFLAG(raftx1,rafty); | |
| 25001 | 559 | rafttypes[1] = MAPFLAG(raftx2,rafty); | |
| 25002 | |||
| 25003 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 559 times.
|
559 | if(rafttypes[0]==rafttypes[1]) |
| 25004 | 559 | raftflags[0] = rafttypes[0]; | |
| 25005 | |||
| 25006 | |||
| 25007 | 559 | rafttypes[0] = MAPCOMBOFLAG(raftx1,rafty); | |
| 25008 | 559 | rafttypes[1] = MAPCOMBOFLAG(raftx2,rafty); | |
| 25009 | |||
| 25010 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 559 times.
|
559 | if(rafttypes[0]==rafttypes[1]) |
| 25011 | 559 | raftflags[1] = rafttypes[0]; | |
| 25012 | |||
| 25013 | 559 | rafttypes[0] = MAPFFCOMBOFLAG(raftx1,rafty); | |
| 25014 | 559 | rafttypes[1] = MAPFFCOMBOFLAG(raftx2,rafty); | |
| 25015 | |||
| 25016 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 559 times.
|
559 | if(rafttypes[0]==rafttypes[1]) |
| 25017 | 559 | raftflags[2] = rafttypes[0]; | |
| 25018 | |||
| 25019 |
2/2✓ Branch 0 taken 1677 times.
✓ Branch 1 taken 559 times.
|
2236 | for (int32_t m = 0; m < 3; ++m) |
| 25020 | { | ||
| 25021 |
2/4✓ Branch 0 taken 1677 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1677 times.
|
1677 | if (raftflags[m] == mfRAFT || raftflags[m] == mfRAFT_BRANCH) |
| 25022 | { | ||
| 25023 | ✗ | if(current_item(itype_raft) && action!=rafting && action!=swimhit && action!=gothit && action!=sideswimhit && z==0 && fakez==0 && (combo_class_buf[COMBOTYPE(tx+8, ty+11)].dock || combo_class_buf[FFCOMBOTYPE(tx+8, ty+11)].dock)) | |
| 25024 | { | ||
| 25025 | ✗ | if((isRaftFlag(nextflag(tx,ty+11,dir,false))||isRaftFlag(nextflag(tx,ty+11,dir,true)))) | |
| 25026 | { | ||
| 25027 | ✗ | reset_swordcharge(); | |
| 25028 | ✗ | action=rafting; FFCore.setHeroAction(rafting); | |
| 25029 | ✗ | raftclk=0; | |
| 25030 | ✗ | if (get_qr(qr_RAFT_SOUND)) sfx(itemsbuf[current_item_id(itype_raft)].usesound,pan(x.getInt())); | |
| 25031 | ✗ | else sfx(tmpscr->secretsfx); | |
| 25032 | ✗ | } | |
| 25033 | ✗ | else if (get_qr(qr_BETTER_RAFT) && doraft) | |
| 25034 | { | ||
| 25035 | ✗ | for (int32_t i = 0; i < 4; ++i) | |
| 25036 | { | ||
| 25037 | ✗ | if(isRaftFlag(nextflag(GridX(tx+8),GridY(ty+11),i,false))||isRaftFlag(nextflag(GridX(tx+8),GridY(ty+11),i,true))) | |
| 25038 | { | ||
| 25039 | ✗ | reset_swordcharge(); | |
| 25040 | ✗ | action=rafting; FFCore.setHeroAction(rafting); | |
| 25041 | ✗ | raftclk=0; | |
| 25042 | ✗ | if (get_qr(qr_RAFT_SOUND)) sfx(itemsbuf[current_item_id(itype_raft)].usesound,pan(x.getInt())); | |
| 25043 | ✗ | else sfx(tmpscr->secretsfx); | |
| 25044 | ✗ | dir = i; | |
| 25045 | ✗ | break; | |
| 25046 | } | ||
| 25047 | ✗ | } | |
| 25048 | ✗ | } | |
| 25049 | ✗ | } | |
| 25050 | ✗ | } | |
| 25051 | 1677 | } | |
| 25052 | 559 | } | |
| 25053 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6672191 times.
|
6672191 | if (RaftPass) return; |
| 25054 |
3/3✓ Branch 0 taken 34031 times.
✓ Branch 1 taken 6637100 times.
✓ Branch 2 taken 1060 times.
|
6672191 | switch(flag) |
| 25055 | { | ||
| 25056 | case mfDIVE_ITEM: | ||
| 25057 |
6/8✓ Branch 0 taken 24 times.
✓ Branch 1 taken 1036 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 24 times.
✓ Branch 4 taken 9 times.
✓ Branch 5 taken 15 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 9 times.
|
1060 | if(isDiving() && (!getmapflag((currscr < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM) || (tmpscr->flags9&fBELOWRETURN))) |
| 25058 | { | ||
| 25059 | 30 | additem(x, y, tmpscr->catchall, | |
| 25060 | 15 | ipONETIME2 | ipBIGRANGE | ipHOLDUP | ipNODRAW | ((tmpscr->flags8&fITEMSECRET) ? ipSECRETS : 0)); | |
| 25061 | 15 | sfx(tmpscr->secretsfx); | |
| 25062 | 15 | } | |
| 25063 | |||
| 25064 | 1060 | return; | |
| 25065 | |||
| 25066 | case mfRAFT: | ||
| 25067 | case mfRAFT_BRANCH: | ||
| 25068 | |||
| 25069 | // if(current_item(itype_raft) && action!=rafting && action!=swimhit && action!=gothit && type==cOLD_DOCK) | ||
| 25070 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 34031 times.
|
34031 | if (!get_qr(qr_BETTER_RAFT_2)) |
| 25071 | { | ||
| 25072 | 34031 | bool doraft = true; | |
| 25073 |
5/6✓ Branch 0 taken 34031 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2122 times.
✓ Branch 3 taken 31909 times.
✓ Branch 4 taken 576 times.
✓ Branch 5 taken 1546 times.
|
34031 | if(((int32_t)y>=raftwarpy-8&&(int32_t)y<=raftwarpy+7)&&raftwarpy!=-1) |
| 25074 | { | ||
| 25075 |
5/6✓ Branch 0 taken 1546 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 808 times.
✓ Branch 3 taken 738 times.
✓ Branch 4 taken 23 times.
✓ Branch 5 taken 785 times.
|
1546 | if(((int32_t)x>=raftwarpx-8&&(int32_t)x<=raftwarpx+7)&&raftwarpx!=-1) |
| 25076 | { | ||
| 25077 | 785 | doraft = false; | |
| 25078 | 785 | } | |
| 25079 | 1546 | } | |
| 25080 |
13/16✓ Branch 0 taken 31056 times.
✓ Branch 1 taken 2975 times.
✓ Branch 2 taken 3282 times.
✓ Branch 3 taken 27774 times.
✓ Branch 4 taken 3262 times.
✓ Branch 5 taken 20 times.
✓ Branch 6 taken 3251 times.
✓ Branch 7 taken 11 times.
✓ Branch 8 taken 3251 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 3251 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 3251 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1531 times.
✓ Branch 15 taken 1720 times.
|
34031 | if(current_item(itype_raft) && action!=rafting && action!=swimhit && action!=gothit && action!=sideswimhit && z==0 && fakez==0 && combo_class_buf[type].dock) |
| 25081 | { | ||
| 25082 |
3/4✓ Branch 0 taken 1365 times.
✓ Branch 1 taken 355 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1365 times.
|
1720 | if(isRaftFlag(nextflag(tx,ty,dir,false))||isRaftFlag(nextflag(tx,ty,dir,true))) |
| 25083 | { | ||
| 25084 | 355 | reset_swordcharge(); | |
| 25085 | 355 | action=rafting; FFCore.setHeroAction(rafting); | |
| 25086 | 355 | raftclk=0; | |
| 25087 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 355 times.
|
355 | if (get_qr(qr_RAFT_SOUND)) sfx(itemsbuf[current_item_id(itype_raft)].usesound,pan(x.getInt())); |
| 25088 | 355 | else sfx(tmpscr->secretsfx); | |
| 25089 | 355 | } | |
| 25090 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1365 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1365 | else if (get_qr(qr_BETTER_RAFT) && doraft) |
| 25091 | { | ||
| 25092 | ✗ | for (int32_t i = 0; i < 4; ++i) | |
| 25093 | { | ||
| 25094 | ✗ | if(isRaftFlag(nextflag(GridX(tx+8),GridY(ty+8),i,false))||isRaftFlag(nextflag(GridX(tx+8),GridY(ty+8),i,true))) | |
| 25095 | { | ||
| 25096 | ✗ | reset_swordcharge(); | |
| 25097 | ✗ | action=rafting; FFCore.setHeroAction(rafting); | |
| 25098 | ✗ | raftclk=0; | |
| 25099 | ✗ | if (get_qr(qr_RAFT_SOUND)) sfx(itemsbuf[current_item_id(itype_raft)].usesound,pan(x.getInt())); | |
| 25100 | ✗ | else sfx(tmpscr->secretsfx); | |
| 25101 | ✗ | dir = i; | |
| 25102 | ✗ | break; | |
| 25103 | } | ||
| 25104 | ✗ | } | |
| 25105 | ✗ | } | |
| 25106 | 1720 | } | |
| 25107 | 34031 | } | |
| 25108 | |||
| 25109 | 34031 | return; | |
| 25110 | |||
| 25111 | default: | ||
| 25112 | 6637100 | break; | |
| 25113 | //return; | ||
| 25114 | } | ||
| 25115 | |||
| 25116 |
2/3✓ Branch 0 taken 274 times.
✓ Branch 1 taken 6636826 times.
✗ Branch 2 not taken.
|
6637100 | switch(flag2) |
| 25117 | { | ||
| 25118 | case mfDIVE_ITEM: | ||
| 25119 | ✗ | if(isDiving() && (!getmapflag((currscr < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM) || (tmpscr->flags9&fBELOWRETURN))) | |
| 25120 | { | ||
| 25121 | ✗ | additem(x, y, tmpscr->catchall, | |
| 25122 | ✗ | ipONETIME2 | ipBIGRANGE | ipHOLDUP | ipNODRAW | ((tmpscr->flags8&fITEMSECRET) ? ipSECRETS : 0)); | |
| 25123 | ✗ | sfx(tmpscr->secretsfx); | |
| 25124 | ✗ | } | |
| 25125 | |||
| 25126 | ✗ | return; | |
| 25127 | |||
| 25128 | case mfRAFT: | ||
| 25129 | case mfRAFT_BRANCH: | ||
| 25130 | |||
| 25131 | // if(current_item(itype_raft) && action!=rafting && action!=swimhit && action!=gothit && type==cOLD_DOCK) | ||
| 25132 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 274 times.
|
274 | if (!get_qr(qr_BETTER_RAFT_2)) |
| 25133 | { | ||
| 25134 | 274 | bool doraft = true; | |
| 25135 |
2/6✓ Branch 0 taken 274 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 274 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
274 | if(((int32_t)y>=raftwarpy-8&&(int32_t)y<=raftwarpy+7)&&raftwarpy!=-1) |
| 25136 | { | ||
| 25137 | ✗ | if(((int32_t)x>=raftwarpx-8&&(int32_t)x<=raftwarpx+7)&&raftwarpx!=-1) | |
| 25138 | { | ||
| 25139 | ✗ | doraft = false; | |
| 25140 | ✗ | } | |
| 25141 | ✗ | } | |
| 25142 |
10/16✓ Branch 0 taken 274 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 135 times.
✓ Branch 3 taken 139 times.
✓ Branch 4 taken 135 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 135 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 135 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 135 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 135 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 121 times.
✓ Branch 15 taken 14 times.
|
274 | if(current_item(itype_raft) && action!=rafting && action!=swimhit && action!=gothit && action!=sideswimhit && z==0 && fakez==0 && combo_class_buf[type].dock) |
| 25143 | { | ||
| 25144 |
4/4✓ Branch 0 taken 10 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 9 times.
|
14 | if((isRaftFlag(nextflag(tx,ty,dir,false))||isRaftFlag(nextflag(tx,ty,dir,true)))) |
| 25145 | { | ||
| 25146 | 5 | reset_swordcharge(); | |
| 25147 | 5 | action=rafting; FFCore.setHeroAction(rafting); | |
| 25148 | 5 | raftclk=0; | |
| 25149 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
5 | if (get_qr(qr_RAFT_SOUND)) sfx(itemsbuf[current_item_id(itype_raft)].usesound,pan(x.getInt())); |
| 25150 | 5 | else sfx(tmpscr->secretsfx); | |
| 25151 | 5 | } | |
| 25152 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
9 | else if (get_qr(qr_BETTER_RAFT) && doraft) |
| 25153 | { | ||
| 25154 | ✗ | for (int32_t i = 0; i < 4; ++i) | |
| 25155 | { | ||
| 25156 | ✗ | if(isRaftFlag(nextflag(GridX(tx+8),GridY(ty+8),i,false))||isRaftFlag(nextflag(GridX(tx+8),GridY(ty+8),i,true))) | |
| 25157 | { | ||
| 25158 | ✗ | reset_swordcharge(); | |
| 25159 | ✗ | action=rafting; FFCore.setHeroAction(rafting); | |
| 25160 | ✗ | raftclk=0; | |
| 25161 | ✗ | if (get_qr(qr_RAFT_SOUND)) sfx(itemsbuf[current_item_id(itype_raft)].usesound,pan(x.getInt())); | |
| 25162 | ✗ | else sfx(tmpscr->secretsfx); | |
| 25163 | ✗ | dir = i; | |
| 25164 | ✗ | break; | |
| 25165 | } | ||
| 25166 | ✗ | } | |
| 25167 | ✗ | } | |
| 25168 | 14 | } | |
| 25169 | 274 | } | |
| 25170 | |||
| 25171 | 274 | return; | |
| 25172 | |||
| 25173 | default: | ||
| 25174 | 6636826 | break; | |
| 25175 | //return; | ||
| 25176 | } | ||
| 25177 | |||
| 25178 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 6636826 times.
✗ Branch 2 not taken.
|
6636826 | switch(flag3) |
| 25179 | { | ||
| 25180 | case mfDIVE_ITEM: | ||
| 25181 | ✗ | if(isDiving() && (!getmapflag((currscr < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM) || (tmpscr->flags9&fBELOWRETURN))) | |
| 25182 | { | ||
| 25183 | ✗ | additem(x, y, tmpscr->catchall, | |
| 25184 | ✗ | ipONETIME2 | ipBIGRANGE | ipHOLDUP | ipNODRAW | ((tmpscr->flags8&fITEMSECRET) ? ipSECRETS : 0)); | |
| 25185 | ✗ | sfx(tmpscr->secretsfx); | |
| 25186 | ✗ | } | |
| 25187 | |||
| 25188 | ✗ | return; | |
| 25189 | |||
| 25190 | case mfRAFT: | ||
| 25191 | case mfRAFT_BRANCH: | ||
| 25192 | |||
| 25193 | // if(current_item(itype_raft) && action!=rafting && action!=swimhit && action!=gothit && type==cOLD_DOCK) | ||
| 25194 | ✗ | if (!get_qr(qr_BETTER_RAFT_2)) | |
| 25195 | { | ||
| 25196 | ✗ | bool doraft = true; | |
| 25197 | ✗ | if(((int32_t)y>=raftwarpy-8&&(int32_t)y<=raftwarpy+7)&&raftwarpy!=-1) | |
| 25198 | { | ||
| 25199 | ✗ | if(((int32_t)x>=raftwarpx-8&&(int32_t)x<=raftwarpx+7)&&raftwarpx!=-1) | |
| 25200 | { | ||
| 25201 | ✗ | doraft = false; | |
| 25202 | ✗ | } | |
| 25203 | ✗ | } | |
| 25204 | ✗ | if(current_item(itype_raft) && action!=rafting && action!=swimhit && action!=gothit && action!=sideswimhit && z==0 && fakez==0 && combo_class_buf[type].dock) | |
| 25205 | { | ||
| 25206 | ✗ | if((isRaftFlag(nextflag(tx,ty,dir,false))||isRaftFlag(nextflag(tx,ty,dir,true)))) | |
| 25207 | { | ||
| 25208 | ✗ | reset_swordcharge(); | |
| 25209 | ✗ | action=rafting; FFCore.setHeroAction(rafting); | |
| 25210 | ✗ | raftclk=0; | |
| 25211 | ✗ | if (get_qr(qr_RAFT_SOUND)) sfx(itemsbuf[current_item_id(itype_raft)].usesound,pan(x.getInt())); | |
| 25212 | ✗ | else sfx(tmpscr->secretsfx); | |
| 25213 | ✗ | } | |
| 25214 | ✗ | else if (get_qr(qr_BETTER_RAFT) && doraft) | |
| 25215 | { | ||
| 25216 | ✗ | for (int32_t i = 0; i < 4; ++i) | |
| 25217 | { | ||
| 25218 | ✗ | if(isRaftFlag(nextflag(GridX(tx+8),GridY(ty+8),i,false))||isRaftFlag(nextflag(GridX(tx+8),GridY(ty+8),i,true))) | |
| 25219 | { | ||
| 25220 | ✗ | reset_swordcharge(); | |
| 25221 | ✗ | action=rafting; FFCore.setHeroAction(rafting); | |
| 25222 | ✗ | raftclk=0; | |
| 25223 | ✗ | if (get_qr(qr_RAFT_SOUND)) sfx(itemsbuf[current_item_id(itype_raft)].usesound,pan(x.getInt())); | |
| 25224 | ✗ | else sfx(tmpscr->secretsfx); | |
| 25225 | ✗ | dir = i; | |
| 25226 | ✗ | break; | |
| 25227 | } | ||
| 25228 | ✗ | } | |
| 25229 | ✗ | } | |
| 25230 | ✗ | } | |
| 25231 | ✗ | } | |
| 25232 | |||
| 25233 | ✗ | return; | |
| 25234 | |||
| 25235 | default: | ||
| 25236 | 6636826 | return; | |
| 25237 | } | ||
| 25238 | } | ||
| 25239 | |||
| 25240 | |||
| 25241 | 3850 | int32_t t=(currscr<128)?0:1; | |
| 25242 | |||
| 25243 |
3/4✓ Branch 0 taken 3394 times.
✓ Branch 1 taken 456 times.
✓ Branch 2 taken 3850 times.
✗ Branch 3 not taken.
|
3850 | if((type==cCAVE || type==cCAVE2) && (tmpscr[t].tilewarptype[index]==wtNOWARP)) return; |
| 25244 | |||
| 25245 | //don't do this for canceled warps -DD | ||
| 25246 | //I have no idea why we do this skip, but I'll dutifully propagate it to all cases below... | ||
| 25247 | /*if(tmpscr[t].tilewarptype[index] != wtNOWARP) | ||
| 25248 | { | ||
| 25249 | draw_screen(tmpscr); | ||
| 25250 | advanceframe(true); | ||
| 25251 | }*/ | ||
| 25252 | |||
| 25253 | 3850 | bool skippedaframe=false; | |
| 25254 | |||
| 25255 |
6/6✓ Branch 0 taken 3394 times.
✓ Branch 1 taken 456 times.
✓ Branch 2 taken 2973 times.
✓ Branch 3 taken 421 times.
✓ Branch 4 taken 1986 times.
✓ Branch 5 taken 987 times.
|
3850 | if(type==cCAVE || type==cCAVE2 || type==cSTAIR) |
| 25256 | { | ||
| 25257 | // Stop music only if: | ||
| 25258 | // * entering a Guy Cave | ||
| 25259 | // * warping to a DMap whose music is different. | ||
| 25260 | |||
| 25261 | 2863 | int32_t tdm = tmpscr[t].tilewarpdmap[index]; | |
| 25262 | |||
| 25263 |
2/2✓ Branch 0 taken 955 times.
✓ Branch 1 taken 1908 times.
|
2863 | if(tmpscr[t].tilewarptype[index]<=wtPASS) |
| 25264 | { | ||
| 25265 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 955 times.
|
955 | if (FFCore.can_dmap_change_music(tdm)) |
| 25266 | { | ||
| 25267 |
3/4✓ Branch 0 taken 486 times.
✓ Branch 1 taken 469 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 486 times.
|
955 | if ((DMaps[currdmap].flags & dmfCAVES) && tmpscr[t].tilewarptype[index] == wtCAVE) |
| 25268 | 486 | music_stop(); | |
| 25269 | 955 | } | |
| 25270 | 955 | } | |
| 25271 | else | ||
| 25272 | { | ||
| 25273 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1908 times.
|
1908 | if (FFCore.can_dmap_change_music(tdm)) |
| 25274 | { | ||
| 25275 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1908 times.
|
1908 | if (zcmusic != NULL) |
| 25276 | { | ||
| 25277 | ✗ | if (strcmp(zcmusic->filename, DMaps[tdm].tmusic) != 0 || | |
| 25278 | ✗ | (zcmusic->type == ZCMF_GME && zcmusic->track != DMaps[tdm].tmusictrack)) | |
| 25279 | ✗ | music_stop(); | |
| 25280 | ✗ | } | |
| 25281 |
2/4✓ Branch 0 taken 1908 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1908 times.
|
1908 | else if (DMaps[tmpscr->tilewarpdmap[index]].midi != (currmidi - ZC_MIDI_COUNT + 4) && |
| 25282 | 1908 | TheMaps[(DMaps[tdm].map * MAPSCRS + (tmpscr[t].tilewarpscr[index] + DMaps[tdm].xoff))].screen_midi != (currmidi - ZC_MIDI_COUNT + 4)) | |
| 25283 | 1908 | music_stop(); | |
| 25284 | 1908 | } | |
| 25285 | } | ||
| 25286 | |||
| 25287 | 2863 | stop_sfx(QMisc.miscsfx[sfxLOWHEART]); | |
| 25288 |
5/6✓ Branch 0 taken 955 times.
✓ Branch 1 taken 1908 times.
✓ Branch 2 taken 486 times.
✓ Branch 3 taken 469 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 486 times.
|
2863 | bool opening = (tmpscr[t].tilewarptype[index]<=wtPASS && !(DMaps[currdmap].flags&dmfCAVES && tmpscr[t].tilewarptype[index]==wtCAVE) |
| 25289 | 2394 | ? false : COOLSCROLL); | |
| 25290 | |||
| 25291 | 2863 | FFCore.warpScriptCheck(); | |
| 25292 | 2863 | draw_screen(tmpscr); | |
| 25293 | 2863 | advanceframe(true); | |
| 25294 | |||
| 25295 | 2863 | skippedaframe=true; | |
| 25296 | |||
| 25297 |
2/2✓ Branch 0 taken 421 times.
✓ Branch 1 taken 2442 times.
|
2863 | if(type==cCAVE2) walkup2(opening); |
| 25298 |
2/2✓ Branch 0 taken 1986 times.
✓ Branch 1 taken 456 times.
|
2442 | else if(type==cCAVE) walkdown(opening); |
| 25299 | 2863 | } | |
| 25300 | |||
| 25301 |
2/2✓ Branch 0 taken 2898 times.
✓ Branch 1 taken 952 times.
|
3850 | if(type==cPIT) |
| 25302 | { | ||
| 25303 | 952 | didpit=true; | |
| 25304 | 952 | pitx=x; | |
| 25305 | 952 | pity=y; | |
| 25306 | 952 | warp_sound = warpsfx2; | |
| 25307 | 952 | } | |
| 25308 | |||
| 25309 |
5/6✓ Branch 0 taken 1291 times.
✓ Branch 1 taken 2559 times.
✓ Branch 2 taken 1234 times.
✓ Branch 3 taken 57 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 57 times.
|
3907 | if(DMaps[currdmap].flags&dmf3STAIR && (currscr==129 || !(DMaps[currdmap].flags&dmfGUYCAVES)) |
| 25310 |
2/4✓ Branch 0 taken 57 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 57 times.
✗ Branch 3 not taken.
|
1291 | && tmpscr[specialcave > 0 && DMaps[currdmap].flags&dmfGUYCAVES ? 1:0].room==rWARP && type==cSTAIR) |
| 25311 | { | ||
| 25312 |
1/2✓ Branch 0 taken 57 times.
✗ Branch 1 not taken.
|
57 | if(!skippedaframe) |
| 25313 | { | ||
| 25314 | ✗ | FFCore.warpScriptCheck(); | |
| 25315 | ✗ | draw_screen(tmpscr); | |
| 25316 | ✗ | advanceframe(true); | |
| 25317 | ✗ | } | |
| 25318 | |||
| 25319 | // "take any road you want" | ||
| 25320 |
2/2✓ Branch 0 taken 46 times.
✓ Branch 1 taken 11 times.
|
57 | int32_t dw = x<112 ? 1 : (x>136 ? 3 : 2); |
| 25321 | 57 | int32_t code = WARPCODE(currdmap,homescr,dw); | |
| 25322 | |||
| 25323 |
1/2✓ Branch 0 taken 57 times.
✗ Branch 1 not taken.
|
57 | if(code>-1) |
| 25324 | { | ||
| 25325 | 57 | bool changedlevel = false; | |
| 25326 | 57 | bool changeddmap = false; | |
| 25327 |
2/2✓ Branch 0 taken 42 times.
✓ Branch 1 taken 15 times.
|
57 | if(currdmap != code>>8) |
| 25328 | { | ||
| 25329 | 15 | timeExitAllGenscript(GENSCR_ST_CHANGE_DMAP); | |
| 25330 | 15 | changeddmap = true; | |
| 25331 | 15 | } | |
| 25332 |
1/2✓ Branch 0 taken 57 times.
✗ Branch 1 not taken.
|
57 | if(dlevel != DMaps[code>>8].level) |
| 25333 | { | ||
| 25334 | ✗ | timeExitAllGenscript(GENSCR_ST_CHANGE_LEVEL); | |
| 25335 | ✗ | changedlevel = true; | |
| 25336 | ✗ | } | |
| 25337 | 57 | currdmap = code>>8; | |
| 25338 | 57 | dlevel = DMaps[currdmap].level; | |
| 25339 |
2/2✓ Branch 0 taken 42 times.
✓ Branch 1 taken 15 times.
|
57 | if(changeddmap) |
| 25340 | { | ||
| 25341 | 15 | throwGenScriptEvent(GENSCR_EVENT_CHANGE_DMAP); | |
| 25342 | 15 | } | |
| 25343 |
1/2✓ Branch 0 taken 57 times.
✗ Branch 1 not taken.
|
57 | if(changedlevel) |
| 25344 | { | ||
| 25345 | ✗ | throwGenScriptEvent(GENSCR_EVENT_CHANGE_LEVEL); | |
| 25346 | ✗ | } | |
| 25347 | |||
| 25348 | 57 | currmap = DMaps[currdmap].map; | |
| 25349 | 57 | homescr = (code&0xFF) + DMaps[currdmap].xoff; | |
| 25350 | 57 | init_dmap(); | |
| 25351 | |||
| 25352 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
57 | if(canPermSecret()) |
| 25353 | 57 | setmapflag(mSECRET); | |
| 25354 | 57 | } | |
| 25355 | |||
| 25356 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
57 | if(specialcave==STAIRCAVE) exitcave(); |
| 25357 | |||
| 25358 | 57 | return; | |
| 25359 | } | ||
| 25360 | |||
| 25361 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3793 times.
|
3793 | if(type==cRESET) |
| 25362 | { | ||
| 25363 | ✗ | if(!skippedaframe) | |
| 25364 | { | ||
| 25365 | ✗ | FFCore.warpScriptCheck(); | |
| 25366 | ✗ | draw_screen(tmpscr); | |
| 25367 | ✗ | advanceframe(true); | |
| 25368 | ✗ | } | |
| 25369 | |||
| 25370 | ✗ | if(!(tmpscr->noreset&mSECRET)) unsetmapflag(mSECRET); | |
| 25371 | |||
| 25372 | ✗ | if(!(tmpscr->noreset&mITEM)) unsetmapflag(mITEM); | |
| 25373 | |||
| 25374 | ✗ | if(!(tmpscr->noreset&mSPECIALITEM)) unsetmapflag(mSPECIALITEM); | |
| 25375 | |||
| 25376 | ✗ | if(!(tmpscr->noreset&mNEVERRET)) unsetmapflag(mNEVERRET); | |
| 25377 | |||
| 25378 | ✗ | if(!(tmpscr->noreset&mCHEST)) unsetmapflag(mCHEST); | |
| 25379 | |||
| 25380 | ✗ | if(!(tmpscr->noreset&mLOCKEDCHEST)) unsetmapflag(mLOCKEDCHEST); | |
| 25381 | |||
| 25382 | ✗ | if(!(tmpscr->noreset&mBOSSCHEST)) unsetmapflag(mBOSSCHEST); | |
| 25383 | |||
| 25384 | ✗ | if(!(tmpscr->noreset&mLOCKBLOCK)) unsetmapflag(mLOCKBLOCK); | |
| 25385 | |||
| 25386 | ✗ | if(!(tmpscr->noreset&mBOSSLOCKBLOCK)) unsetmapflag(mBOSSLOCKBLOCK); | |
| 25387 | |||
| 25388 | ✗ | if(isdungeon()) | |
| 25389 | { | ||
| 25390 | ✗ | if(!(tmpscr->noreset&mDOOR_LEFT)) unsetmapflag(mDOOR_LEFT); | |
| 25391 | |||
| 25392 | ✗ | if(!(tmpscr->noreset&mDOOR_RIGHT)) unsetmapflag(mDOOR_RIGHT); | |
| 25393 | |||
| 25394 | ✗ | if(!(tmpscr->noreset&mDOOR_DOWN)) unsetmapflag(mDOOR_DOWN); | |
| 25395 | |||
| 25396 | ✗ | if(!(tmpscr->noreset&mDOOR_UP)) unsetmapflag(mDOOR_UP); | |
| 25397 | ✗ | } | |
| 25398 | |||
| 25399 | ✗ | didpit=true; | |
| 25400 | ✗ | pitx=x; | |
| 25401 | ✗ | pity=y; | |
| 25402 | ✗ | sdir=dir; | |
| 25403 | ✗ | dowarp(4,0, warpsfx2); | |
| 25404 | ✗ | } | |
| 25405 | else | ||
| 25406 | { | ||
| 25407 |
3/4✓ Branch 0 taken 987 times.
✓ Branch 1 taken 2806 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 987 times.
|
3793 | if(!skippedaframe && (tmpscr[t].tilewarptype[index]!=wtNOWARP)) |
| 25408 | { | ||
| 25409 | 987 | FFCore.warpScriptCheck(); | |
| 25410 | 987 | draw_screen(tmpscr); | |
| 25411 | 987 | advanceframe(true); | |
| 25412 | 987 | } | |
| 25413 | |||
| 25414 | 3793 | sdir = dir; | |
| 25415 | 3793 | dowarp(0,index, warpsfx2); | |
| 25416 | } | ||
| 25417 | 14082008 | } | |
| 25418 | |||
| 25419 | 112 | int32_t selectWlevel(int32_t d) | |
| 25420 | { | ||
| 25421 |
1/2✓ Branch 0 taken 112 times.
✗ Branch 1 not taken.
|
112 | if(TriforceCount()==0) |
| 25422 | ✗ | return 0; | |
| 25423 | |||
| 25424 | 112 | word l = game->get_wlevel(); | |
| 25425 | |||
| 25426 | 112 | do | |
| 25427 | { | ||
| 25428 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 185 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
185 | if(d==0 && (game->lvlitems[l+1] & liTRIFORCE)) |
| 25429 | ✗ | break; | |
| 25430 |
2/2✓ Branch 0 taken 113 times.
✓ Branch 1 taken 72 times.
|
185 | else if(d<0) |
| 25431 |
2/2✓ Branch 0 taken 58 times.
✓ Branch 1 taken 14 times.
|
72 | l = (l==0) ? 7 : l-1; |
| 25432 | else | ||
| 25433 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 97 times.
|
113 | l = (l==7) ? 0 : l+1; |
| 25434 |
2/2✓ Branch 0 taken 73 times.
✓ Branch 1 taken 112 times.
|
185 | } |
| 25435 | 185 | while(!(game->lvlitems[l+1] & liTRIFORCE)); | |
| 25436 | |||
| 25437 | 112 | game->set_wlevel(l); | |
| 25438 | 112 | return l; | |
| 25439 | 112 | } | |
| 25440 | |||
| 25441 | // Would someone tell the Dodongos to shut their yaps?! | ||
| 25442 | 27534 | void kill_enemy_sfx() | |
| 25443 | { | ||
| 25444 |
2/2✓ Branch 0 taken 27534 times.
✓ Branch 1 taken 54826 times.
|
82360 | for(int32_t i=0; i<guys.Count(); i++) |
| 25445 | { | ||
| 25446 |
2/2✓ Branch 0 taken 20274 times.
✓ Branch 1 taken 34552 times.
|
54826 | if(((enemy*)guys.spr(i))->bgsfx) |
| 25447 | 34552 | stop_sfx(((enemy*)guys.spr(i))->bgsfx); | |
| 25448 | 54826 | } | |
| 25449 |
2/2✓ Branch 0 taken 111 times.
✓ Branch 1 taken 27423 times.
|
27534 | if (Hero.action!=inwind) stop_sfx(WAV_ZN1WHIRLWIND); |
| 25450 |
2/2✓ Branch 0 taken 27518 times.
✓ Branch 1 taken 16 times.
|
27534 | if(tmpscr->room==rGANON) |
| 25451 | 16 | stop_sfx(WAV_ROAR); | |
| 25452 | 27534 | } | |
| 25453 | |||
| 25454 | 3271 | bool HeroClass::HasHeavyBoots() | |
| 25455 | { | ||
| 25456 |
2/2✓ Branch 0 taken 3271 times.
✓ Branch 1 taken 837376 times.
|
840647 | for ( int32_t q = 0; q < MAXITEMS; ++q ) |
| 25457 | { | ||
| 25458 |
3/6✓ Branch 0 taken 68711 times.
✓ Branch 1 taken 768665 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 68711 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
837376 | if ( game->item[q] && ( itemsbuf[q].family == itype_boots ) && /*iron*/ (itemsbuf[q].flags&item_flag2) ) return true; |
| 25459 | 837376 | } | |
| 25460 | 3271 | return false; | |
| 25461 | 3271 | } | |
| 25462 | |||
| 25463 | 7226 | bool HeroClass::dowarp(int32_t type, int32_t index, int32_t warpsfx) | |
| 25464 | { | ||
| 25465 | 7226 | byte reposition_sword_postwarp = 0; | |
| 25466 |
1/2✓ Branch 0 taken 7226 times.
✗ Branch 1 not taken.
|
7226 | if(index<0) |
| 25467 | { | ||
| 25468 | ✗ | return false; | |
| 25469 | } | ||
| 25470 | 7226 | is_warping = true; | |
| 25471 |
2/2✓ Branch 0 taken 755 times.
✓ Branch 1 taken 7226 times.
|
7981 | for ( int32_t q = 0; q < Lwpns.Count(); ++q ) |
| 25472 | { | ||
| 25473 | 755 | weapon *swd=NULL; | |
| 25474 | 755 | swd = (weapon*)Lwpns.spr(q); | |
| 25475 |
2/2✓ Branch 0 taken 685 times.
✓ Branch 1 taken 70 times.
|
755 | if(swd->id == (attack==wSword ? wSword : wWand)) |
| 25476 | { | ||
| 25477 | 70 | Lwpns.del(q); | |
| 25478 | 70 | } | |
| 25479 | 755 | } | |
| 25480 | |||
| 25481 | 7226 | attackclk = charging = spins = tapping = 0; | |
| 25482 | 7226 | attack = none; | |
| 25483 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7226 times.
|
7226 | if ( warp_sound > 0 ) warpsfx = warp_sound; |
| 25484 | 7226 | warp_sound = 0; | |
| 25485 | 7226 | word wdmap=0; | |
| 25486 | 7226 | byte wscr=0,wtype=0,t=0; | |
| 25487 | 7226 | bool overlay=false; | |
| 25488 | 7226 | t=(currscr<128)?0:1; | |
| 25489 | 7226 | int32_t wrindex = 0; | |
| 25490 | 7226 | bool wasSideview = isSideViewGravity(t); // (tmpscr[t].flags7 & fSIDEVIEW)!=0 && !ignoreSideview; | |
| 25491 | |||
| 25492 | // Drawing commands probably shouldn't carry over... | ||
| 25493 |
2/2✓ Branch 0 taken 384 times.
✓ Branch 1 taken 6842 times.
|
7226 | if ( !get_qr(qr_SCRIPTDRAWSINWARPS) ) |
| 25494 | 6842 | script_drawing_commands.Clear(); | |
| 25495 | |||
| 25496 |
4/6✓ Branch 0 taken 384 times.
✓ Branch 1 taken 3836 times.
✓ Branch 2 taken 2895 times.
✓ Branch 3 taken 111 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
7226 | switch(type) |
| 25497 | { | ||
| 25498 | case 0: // tile warp | ||
| 25499 | 3836 | wtype = tmpscr[t].tilewarptype[index]; | |
| 25500 | 3836 | wdmap = tmpscr[t].tilewarpdmap[index]; | |
| 25501 | 3836 | wscr = tmpscr[t].tilewarpscr[index]; | |
| 25502 | 3836 | overlay = get_bit(&tmpscr[t].tilewarpoverlayflags,index)?1:0; | |
| 25503 | 3836 | wrindex=(tmpscr->warpreturnc>>(index*2))&3; | |
| 25504 | 3836 | break; | |
| 25505 | |||
| 25506 | case 1: // side warp | ||
| 25507 | 2895 | wtype = tmpscr[t].sidewarptype[index]; | |
| 25508 | 2895 | wdmap = tmpscr[t].sidewarpdmap[index]; | |
| 25509 | 2895 | wscr = tmpscr[t].sidewarpscr[index]; | |
| 25510 | 2895 | overlay = get_bit(&tmpscr[t].sidewarpoverlayflags,index)?1:0; | |
| 25511 | 2895 | wrindex=(tmpscr->warpreturnc>>(8+(index*2)))&3; | |
| 25512 | //tmpscr->doscript = 0; //kill the currebt screen's script so that it does not continue to run during the scroll. | ||
| 25513 | //there is no doscript for screen scripts. They run like ffcs. | ||
| 25514 | |||
| 25515 | 2895 | break; | |
| 25516 | |||
| 25517 | case 2: // whistle warp | ||
| 25518 | { | ||
| 25519 | 111 | wtype = wtWHISTLE; | |
| 25520 |
1/2✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
|
111 | int32_t wind = whistleitem>-1 ? itemsbuf[whistleitem].misc2 : 8; |
| 25521 | 111 | int32_t level=0; | |
| 25522 | |||
| 25523 |
1/2✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
|
111 | if(blowcnt==0) |
| 25524 | ✗ | level = selectWlevel(0); | |
| 25525 | else | ||
| 25526 | { | ||
| 25527 |
2/2✓ Branch 0 taken 112 times.
✓ Branch 1 taken 111 times.
|
223 | for(int32_t i=0; i<abs(blowcnt); i++) |
| 25528 | 112 | level = selectWlevel(blowcnt); | |
| 25529 | } | ||
| 25530 | |||
| 25531 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 111 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
111 | if(level > QMisc.warp[wind].size && QMisc.warp[wind].size>0) |
| 25532 | { | ||
| 25533 | ✗ | level %= QMisc.warp[wind].size; | |
| 25534 | ✗ | game->set_wlevel(level); | |
| 25535 | ✗ | } | |
| 25536 | |||
| 25537 | 111 | wdmap = QMisc.warp[wind].dmap[level]; | |
| 25538 | 111 | wscr = QMisc.warp[wind].scr[level]; | |
| 25539 | } | ||
| 25540 | 111 | break; | |
| 25541 | |||
| 25542 | case 3: | ||
| 25543 | ✗ | wtype = wtIWARP; | |
| 25544 | ✗ | wdmap = cheat_goto_dmap; | |
| 25545 | ✗ | wscr = cheat_goto_screen; | |
| 25546 | ✗ | break; | |
| 25547 | |||
| 25548 | case 4: | ||
| 25549 | ✗ | wtype = wtIWARP; | |
| 25550 | ✗ | wdmap = currdmap; | |
| 25551 | ✗ | wscr = homescr-DMaps[currdmap].xoff; | |
| 25552 | ✗ | break; | |
| 25553 | } | ||
| 25554 | |||
| 25555 | 7226 | bool intradmap = (wdmap == currdmap); | |
| 25556 | 7226 | int32_t olddmap = currdmap; | |
| 25557 | 7226 | rehydratelake(type!=wtSCROLL); | |
| 25558 | 7226 | bool updatemusic = FFCore.can_dmap_change_music(wdmap); | |
| 25559 | 7226 | bool musicnocut = FFCore.music_update_flags & MUSIC_UPDATE_FLAG_NOCUT; | |
| 25560 | 7226 | bool musicrevert = FFCore.music_update_flags & MUSIC_UPDATE_FLAG_REVERT; | |
| 25561 | |||
| 25562 |
7/8✓ Branch 0 taken 3586 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 583 times.
✓ Branch 3 taken 322 times.
✓ Branch 4 taken 1636 times.
✓ Branch 5 taken 837 times.
✓ Branch 6 taken 111 times.
✓ Branch 7 taken 151 times.
|
7226 | switch(wtype) |
| 25563 | { | ||
| 25564 | case wtCAVE: | ||
| 25565 | { | ||
| 25566 | // cave/item room | ||
| 25567 | 583 | ALLOFF(); | |
| 25568 | 583 | homescr=currscr; | |
| 25569 | 583 | currscr=0x80; | |
| 25570 | |||
| 25571 |
2/2✓ Branch 0 taken 429 times.
✓ Branch 1 taken 154 times.
|
583 | if(DMaps[currdmap].flags&dmfCAVES) // cave |
| 25572 | { | ||
| 25573 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 429 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
429 | if (updatemusic || !musicnocut || !get_qr(qr_SCREEN80_OWN_MUSIC)) |
| 25574 | 429 | music_stop(); | |
| 25575 | 429 | kill_sfx(); | |
| 25576 | |||
| 25577 |
2/2✓ Branch 0 taken 62 times.
✓ Branch 1 taken 367 times.
|
429 | if(tmpscr->room==rWARP) |
| 25578 | { | ||
| 25579 | 62 | currscr=0x81; | |
| 25580 | 62 | specialcave = STAIRCAVE; | |
| 25581 | 62 | } | |
| 25582 | 367 | else specialcave = GUYCAVE; | |
| 25583 | |||
| 25584 | //lighting(2,dir); | ||
| 25585 | 429 | lighting(false, true); | |
| 25586 | 429 | loadlvlpal(10); | |
| 25587 |
2/2✓ Branch 0 taken 366 times.
✓ Branch 1 taken 63 times.
|
795 | bool b2 = COOLSCROLL&& |
| 25588 |
3/4✓ Branch 0 taken 207 times.
✓ Branch 1 taken 159 times.
✓ Branch 2 taken 207 times.
✗ Branch 3 not taken.
|
366 | ((combobuf[MAPCOMBO(x,y-16)].type==cCAVE)||(combobuf[MAPCOMBO(x,y-16)].type==cCAVE2)|| |
| 25589 |
2/4✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 207 times.
✗ Branch 3 not taken.
|
207 | (combobuf[MAPCOMBO(x,y-16)].type==cCAVEB)||(combobuf[MAPCOMBO(x,y-16)].type==cCAVE2B)|| |
| 25590 |
2/4✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 207 times.
✗ Branch 3 not taken.
|
207 | (combobuf[MAPCOMBO(x,y-16)].type==cCAVEC)||(combobuf[MAPCOMBO(x,y-16)].type==cCAVE2C)|| |
| 25591 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 207 times.
|
207 | (combobuf[MAPCOMBO(x,y-16)].type==cCAVED)||(combobuf[MAPCOMBO(x,y-16)].type==cCAVE2D)); |
| 25592 | 429 | blackscr(30,b2?false:true); | |
| 25593 | 429 | loadscr(0,wdmap,currscr,up,false); | |
| 25594 | 429 | loadscr(1,wdmap,homescr,up,false); | |
| 25595 | //preloaded freeform combos | ||
| 25596 | 429 | ffscript_engine(true); | |
| 25597 | 429 | putscr(scrollbuf,0,0,tmpscr); | |
| 25598 | 429 | putscrdoors(scrollbuf,0,0,tmpscr); | |
| 25599 | 429 | dir=up; | |
| 25600 | 429 | x=112; | |
| 25601 | 429 | y=160; | |
| 25602 |
1/2✓ Branch 0 taken 429 times.
✗ Branch 1 not taken.
|
429 | if(didpit) |
| 25603 | { | ||
| 25604 | ✗ | didpit=false; | |
| 25605 | ✗ | x=pitx; | |
| 25606 | ✗ | y=pity; | |
| 25607 | ✗ | } | |
| 25608 | |||
| 25609 | 429 | reset_hookshot(); | |
| 25610 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 429 times.
|
429 | if(reposition_sword_postwarp) |
| 25611 | { | ||
| 25612 | ✗ | weapon *swd=NULL; | |
| 25613 | ✗ | for(int32_t i=0; i<Lwpns.Count(); i++) | |
| 25614 | { | ||
| 25615 | ✗ | swd = (weapon*)Lwpns.spr(i); | |
| 25616 | |||
| 25617 | ✗ | if(swd->id == (attack==wSword ? wSword : wWand)) | |
| 25618 | { | ||
| 25619 | ✗ | int32_t itype = (attack==wFire ? itype_candle : attack==wCByrna ? itype_cbyrna : attack==wWand ? itype_wand : attack==wHammer ? itype_hammer : itype_sword); | |
| 25620 | ✗ | int32_t item_id = (directWpn>-1 && itemsbuf[directWpn].family==itype) ? directWpn : current_item_id(itype); | |
| 25621 | ✗ | positionSword(swd,item_id); | |
| 25622 | ✗ | break; | |
| 25623 | } | ||
| 25624 | ✗ | } | |
| 25625 | ✗ | } | |
| 25626 | 429 | stepforward(diagonalMovement?5:6, false); | |
| 25627 | 429 | } | |
| 25628 | else // item room | ||
| 25629 | { | ||
| 25630 | 154 | specialcave = ITEMCELLAR; | |
| 25631 | 154 | kill_sfx(); | |
| 25632 | 154 | draw_screen(tmpscr,false); | |
| 25633 | |||
| 25634 | //unless the room is already dark, fade to black | ||
| 25635 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 153 times.
|
154 | if (!get_qr(qr_NEW_DARKROOM)) |
| 25636 | { | ||
| 25637 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 152 times.
|
153 | if(!darkroom) |
| 25638 | { | ||
| 25639 | 152 | darkroom = true; | |
| 25640 | 152 | fade(DMaps[currdmap].color,true,false); | |
| 25641 | 152 | } | |
| 25642 | 153 | } | |
| 25643 | else | ||
| 25644 | 1 | fade(DMaps[currdmap].color, true, false); | |
| 25645 | |||
| 25646 | 154 | blackscr(30,true); | |
| 25647 | 154 | loadscr(0,wdmap,currscr,down,false); | |
| 25648 | 154 | loadscr(1,wdmap,homescr,-1,false); | |
| 25649 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 154 times.
|
154 | if ( dontdraw < 2 ) { dontdraw=1; } |
| 25650 | 154 | draw_screen(tmpscr, false); | |
| 25651 | 154 | fade(0xB,true,true); | |
| 25652 | 154 | darkroom = false; | |
| 25653 | 154 | dir=down; | |
| 25654 | 154 | x=48; | |
| 25655 | 154 | y=0; | |
| 25656 | |||
| 25657 | // is this didpit check necessary? | ||
| 25658 |
2/2✓ Branch 0 taken 153 times.
✓ Branch 1 taken 1 times.
|
154 | if(didpit) |
| 25659 | { | ||
| 25660 | 1 | didpit=false; | |
| 25661 | 1 | x=pitx; | |
| 25662 | 1 | y=pity; | |
| 25663 | 1 | } | |
| 25664 | |||
| 25665 | 154 | reset_hookshot(); | |
| 25666 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 154 times.
|
154 | if(reposition_sword_postwarp) |
| 25667 | { | ||
| 25668 | ✗ | weapon *swd=NULL; | |
| 25669 | ✗ | for(int32_t i=0; i<Lwpns.Count(); i++) | |
| 25670 | { | ||
| 25671 | ✗ | swd = (weapon*)Lwpns.spr(i); | |
| 25672 | |||
| 25673 | ✗ | if(swd->id == (attack==wSword ? wSword : wWand)) | |
| 25674 | { | ||
| 25675 | ✗ | int32_t itype = (attack==wFire ? itype_candle : attack==wCByrna ? itype_cbyrna : attack==wWand ? itype_wand : attack==wHammer ? itype_hammer : itype_sword); | |
| 25676 | ✗ | int32_t item_id = (directWpn>-1 && itemsbuf[directWpn].family==itype) ? directWpn : current_item_id(itype); | |
| 25677 | ✗ | positionSword(swd,item_id); | |
| 25678 | ✗ | break; | |
| 25679 | } | ||
| 25680 | ✗ | } | |
| 25681 | ✗ | } | |
| 25682 | 154 | lighting(false, true); | |
| 25683 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 154 times.
|
154 | if ( dontdraw < 2 ) { dontdraw=0; } |
| 25684 | 154 | stepforward(diagonalMovement?16:18, false); | |
| 25685 | } | ||
| 25686 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 583 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
583 | if (get_qr(qr_SCREEN80_OWN_MUSIC) && (updatemusic || !musicnocut)) |
| 25687 | { | ||
| 25688 | ✗ | playLevelMusic(); | |
| 25689 | ✗ | if (musicrevert) | |
| 25690 | ✗ | FFCore.music_update_cond = MUSIC_UPDATE_SCREEN; | |
| 25691 | ✗ | } | |
| 25692 | 583 | break; | |
| 25693 | } | ||
| 25694 | |||
| 25695 | case wtPASS: // passageway | ||
| 25696 | { | ||
| 25697 | 322 | kill_sfx(); | |
| 25698 | 322 | ALLOFF(); | |
| 25699 | //play sound | ||
| 25700 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 322 times.
|
322 | if(warpsfx > 0) sfx(warpsfx,pan(x.getInt())); |
| 25701 | 322 | homescr=currscr; | |
| 25702 | 322 | currscr=0x81; | |
| 25703 | 322 | specialcave = PASSAGEWAY; | |
| 25704 | 322 | byte warpscr2 = wscr + DMaps[wdmap].xoff; | |
| 25705 | 322 | draw_screen(tmpscr,false); | |
| 25706 | |||
| 25707 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 322 times.
|
322 | if(!get_qr(qr_NEW_DARKROOM)) |
| 25708 | { | ||
| 25709 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 314 times.
|
322 | if(!darkroom) |
| 25710 | 314 | fade(DMaps[currdmap].color,true,false); | |
| 25711 | |||
| 25712 | 322 | darkroom=true; | |
| 25713 | 322 | } | |
| 25714 | else | ||
| 25715 | ✗ | fade(DMaps[currdmap].color,true,false); | |
| 25716 | 322 | blackscr(30,true); | |
| 25717 | 322 | loadscr(0,wdmap,currscr,down,false); | |
| 25718 | 322 | loadscr(1,wdmap,homescr,-1,false); | |
| 25719 | //preloaded freeform combos | ||
| 25720 | 322 | ffscript_engine(true); | |
| 25721 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 322 times.
|
322 | if ( dontdraw < 2 ) { dontdraw=1; } |
| 25722 | 322 | draw_screen(tmpscr, false); | |
| 25723 | 322 | lighting(false, true); | |
| 25724 |
1/2✓ Branch 0 taken 322 times.
✗ Branch 1 not taken.
|
322 | if (get_qr(qr_NEW_DARKROOM)) |
| 25725 | ✗ | fade(0xB, false, true); | |
| 25726 | 322 | dir=down; | |
| 25727 | 322 | x=48; | |
| 25728 | |||
| 25729 |
2/2✓ Branch 0 taken 148 times.
✓ Branch 1 taken 174 times.
|
322 | if((homescr&15) > (warpscr2&15)) |
| 25730 | { | ||
| 25731 | 174 | x=192; | |
| 25732 | 174 | } | |
| 25733 | |||
| 25734 |
2/2✓ Branch 0 taken 310 times.
✓ Branch 1 taken 12 times.
|
322 | if((homescr&15) == (warpscr2&15)) |
| 25735 | { | ||
| 25736 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
12 | if((currscr>>4) > (warpscr2>>4)) |
| 25737 | { | ||
| 25738 | 12 | x=192; | |
| 25739 | 12 | } | |
| 25740 | 12 | } | |
| 25741 | |||
| 25742 | // is this didpit check necessary? | ||
| 25743 |
1/2✓ Branch 0 taken 322 times.
✗ Branch 1 not taken.
|
322 | if(didpit) |
| 25744 | { | ||
| 25745 | ✗ | didpit=false; | |
| 25746 | ✗ | x=pitx; | |
| 25747 | ✗ | y=pity; | |
| 25748 | ✗ | } | |
| 25749 | |||
| 25750 | 322 | y=0; | |
| 25751 | 322 | set_respawn_point(); | |
| 25752 | 322 | trySideviewLadder(); | |
| 25753 | 322 | reset_hookshot(); | |
| 25754 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 322 times.
|
322 | if(reposition_sword_postwarp) |
| 25755 | { | ||
| 25756 | ✗ | weapon *swd=NULL; | |
| 25757 | ✗ | for(int32_t i=0; i<Lwpns.Count(); i++) | |
| 25758 | { | ||
| 25759 | ✗ | swd = (weapon*)Lwpns.spr(i); | |
| 25760 | |||
| 25761 | ✗ | if(swd->id == (attack==wSword ? wSword : wWand)) | |
| 25762 | { | ||
| 25763 | ✗ | int32_t itype = (attack==wFire ? itype_candle : attack==wCByrna ? itype_cbyrna : attack==wWand ? itype_wand : attack==wHammer ? itype_hammer : itype_sword); | |
| 25764 | ✗ | int32_t item_id = (directWpn>-1 && itemsbuf[directWpn].family==itype) ? directWpn : current_item_id(itype); | |
| 25765 | ✗ | positionSword(swd,item_id); | |
| 25766 | ✗ | break; | |
| 25767 | } | ||
| 25768 | ✗ | } | |
| 25769 | ✗ | } | |
| 25770 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 322 times.
|
322 | if ( dontdraw < 2 ) { dontdraw=0; } |
| 25771 | 322 | stepforward(diagonalMovement?16:18, false); | |
| 25772 | 322 | newscr_clk=frame; | |
| 25773 | 322 | activated_timed_warp=false; | |
| 25774 | 322 | stepoutindex=index; | |
| 25775 | 322 | stepoutscr = warpscr2; | |
| 25776 | 322 | stepoutdmap = wdmap; | |
| 25777 | 322 | stepoutwr=wrindex; | |
| 25778 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 322 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
322 | if (get_qr(qr_SCREEN80_OWN_MUSIC) && (updatemusic || !musicnocut)) |
| 25779 | { | ||
| 25780 | ✗ | playLevelMusic(); | |
| 25781 | ✗ | if (musicrevert) | |
| 25782 | ✗ | FFCore.music_update_cond = MUSIC_UPDATE_SCREEN; | |
| 25783 | ✗ | } | |
| 25784 | } | ||
| 25785 | 322 | break; | |
| 25786 | |||
| 25787 | case wtEXIT: // entrance/exit | ||
| 25788 | { | ||
| 25789 | 1636 | lighting(false,false,pal_litRESETONLY);//Reset permLit, and do nothing else; lighting was not otherwise called on a wtEXIT warp. | |
| 25790 | 1636 | ALLOFF(); | |
| 25791 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1636 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1636 | if(updatemusic||!musicnocut) |
| 25792 | 1636 | music_stop(); | |
| 25793 | 1636 | kill_sfx(); | |
| 25794 | 1636 | blackscr(30,false); | |
| 25795 | 1636 | bool changedlevel = false; | |
| 25796 | 1636 | bool changeddmap = false; | |
| 25797 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1633 times.
|
1636 | if(currdmap != wdmap) |
| 25798 | { | ||
| 25799 | 1633 | timeExitAllGenscript(GENSCR_ST_CHANGE_DMAP); | |
| 25800 | 1633 | changeddmap = true; | |
| 25801 | 1633 | } | |
| 25802 |
2/2✓ Branch 0 taken 262 times.
✓ Branch 1 taken 1374 times.
|
1636 | if(dlevel != DMaps[wdmap].level) |
| 25803 | { | ||
| 25804 | 1374 | timeExitAllGenscript(GENSCR_ST_CHANGE_LEVEL); | |
| 25805 | 1374 | changedlevel = true; | |
| 25806 | 1374 | } | |
| 25807 | 1636 | dlevel = DMaps[wdmap].level; | |
| 25808 | 1636 | currdmap = wdmap; | |
| 25809 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1633 times.
|
1636 | if(changeddmap) |
| 25810 | { | ||
| 25811 | 1633 | throwGenScriptEvent(GENSCR_EVENT_CHANGE_DMAP); | |
| 25812 | 1633 | } | |
| 25813 |
2/2✓ Branch 0 taken 262 times.
✓ Branch 1 taken 1374 times.
|
1636 | if(changedlevel) |
| 25814 | { | ||
| 25815 | 1374 | throwGenScriptEvent(GENSCR_EVENT_CHANGE_LEVEL); | |
| 25816 | 1374 | } | |
| 25817 | |||
| 25818 | 1636 | currmap=DMaps[currdmap].map; | |
| 25819 | 1636 | init_dmap(); | |
| 25820 | 1636 | update_subscreens(wdmap); | |
| 25821 | 1636 | loadfullpal(); | |
| 25822 | 1636 | ringcolor(false); | |
| 25823 | 1636 | loadlvlpal(DMaps[currdmap].color); | |
| 25824 | //lastentrance_dmap = currdmap; | ||
| 25825 | 1636 | homescr = currscr = wscr + DMaps[currdmap].xoff; | |
| 25826 | 1636 | loadscr(0,currdmap,currscr,-1,overlay); | |
| 25827 | |||
| 25828 |
4/4✓ Branch 0 taken 56 times.
✓ Branch 1 taken 1580 times.
✓ Branch 2 taken 46 times.
✓ Branch 3 taken 10 times.
|
1636 | if((tmpscr->flags&fDARK) && !get_qr(qr_NEW_DARKROOM)) |
| 25829 | { | ||
| 25830 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 3 times.
|
10 | if(get_qr(qr_FADE)) |
| 25831 | { | ||
| 25832 | 7 | interpolatedfade(); | |
| 25833 | 7 | } | |
| 25834 | else | ||
| 25835 | { | ||
| 25836 | 3 | loadfadepal((DMaps[currdmap].color)*pdLEVEL+poFADE3); | |
| 25837 | } | ||
| 25838 | |||
| 25839 | 10 | darkroom=naturaldark=true; | |
| 25840 | 10 | } | |
| 25841 | else | ||
| 25842 | { | ||
| 25843 | 1626 | darkroom=naturaldark=false; | |
| 25844 | } | ||
| 25845 | |||
| 25846 | int32_t wrx,wry; | ||
| 25847 | |||
| 25848 |
2/2✓ Branch 0 taken 655 times.
✓ Branch 1 taken 981 times.
|
1636 | if(get_qr(qr_NOARRIVALPOINT)) |
| 25849 | { | ||
| 25850 | 655 | wrx=tmpscr->warpreturnx[0]; | |
| 25851 | 655 | wry=tmpscr->warpreturny[0]; | |
| 25852 | 655 | } | |
| 25853 | else | ||
| 25854 | { | ||
| 25855 | 981 | wrx=tmpscr->warparrivalx; | |
| 25856 | 981 | wry=tmpscr->warparrivaly; | |
| 25857 | } | ||
| 25858 | |||
| 25859 |
6/6✓ Branch 0 taken 91 times.
✓ Branch 1 taken 1545 times.
✓ Branch 2 taken 63 times.
✓ Branch 3 taken 28 times.
✓ Branch 4 taken 63 times.
✓ Branch 5 taken 1573 times.
|
1636 | if(((wrx>0||wry>0)||(get_qr(qr_WARPSIGNOREARRIVALPOINT)))&&(!(tmpscr->flags6&fNOCONTINUEHERE))) |
| 25860 | { | ||
| 25861 |
2/2✓ Branch 0 taken 1113 times.
✓ Branch 1 taken 460 times.
|
1573 | if(dlevel) |
| 25862 | { | ||
| 25863 | 1113 | lastentrance = currscr; | |
| 25864 | 1113 | } | |
| 25865 | else | ||
| 25866 | { | ||
| 25867 | 460 | lastentrance = DMaps[currdmap].cont + DMaps[currdmap].xoff; | |
| 25868 | } | ||
| 25869 | |||
| 25870 | 1573 | lastentrance_dmap = wdmap; | |
| 25871 | 1573 | } | |
| 25872 | |||
| 25873 |
2/2✓ Branch 0 taken 1113 times.
✓ Branch 1 taken 523 times.
|
1636 | if(dlevel) |
| 25874 | { | ||
| 25875 |
2/2✓ Branch 0 taken 559 times.
✓ Branch 1 taken 554 times.
|
1113 | if(get_qr(qr_NOARRIVALPOINT)) |
| 25876 | { | ||
| 25877 | 559 | x=tmpscr->warpreturnx[wrindex]; | |
| 25878 | 559 | y=tmpscr->warpreturny[wrindex]; | |
| 25879 | 559 | } | |
| 25880 | else | ||
| 25881 | { | ||
| 25882 | 554 | x=tmpscr->warparrivalx; | |
| 25883 | 554 | y=tmpscr->warparrivaly; | |
| 25884 | } | ||
| 25885 | 1113 | } | |
| 25886 | else | ||
| 25887 | { | ||
| 25888 | 523 | x=tmpscr->warpreturnx[wrindex]; | |
| 25889 | 523 | y=tmpscr->warpreturny[wrindex]; | |
| 25890 | } | ||
| 25891 | |||
| 25892 |
2/2✓ Branch 0 taken 1627 times.
✓ Branch 1 taken 9 times.
|
1636 | if(didpit) |
| 25893 | { | ||
| 25894 | 9 | didpit=false; | |
| 25895 | 9 | x=pitx; | |
| 25896 | 9 | y=pity; | |
| 25897 | 9 | } | |
| 25898 | |||
| 25899 | 1636 | dir=down; | |
| 25900 | |||
| 25901 |
2/2✓ Branch 0 taken 28 times.
✓ Branch 1 taken 1608 times.
|
1636 | if(x==0) dir=right; |
| 25902 | |||
| 25903 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 1613 times.
|
1636 | if(x==240) dir=left; |
| 25904 | |||
| 25905 |
2/2✓ Branch 0 taken 38 times.
✓ Branch 1 taken 1598 times.
|
1636 | if(y==0) dir=down; |
| 25906 | |||
| 25907 |
2/2✓ Branch 0 taken 628 times.
✓ Branch 1 taken 1008 times.
|
1636 | if(y==160) dir=up; |
| 25908 | |||
| 25909 |
2/2✓ Branch 0 taken 1113 times.
✓ Branch 1 taken 523 times.
|
1636 | if(dlevel) |
| 25910 | { | ||
| 25911 | // reset enemy kill counts | ||
| 25912 |
2/2✓ Branch 0 taken 142464 times.
✓ Branch 1 taken 1113 times.
|
143577 | for(int32_t i=0; i<128; i++) |
| 25913 | { | ||
| 25914 | 142464 | game->guys[(currmap*MAPSCRSNORMAL)+i] = 0; | |
| 25915 | 142464 | game->maps[(currmap*MAPSCRSNORMAL)+i] &= ~mTMPNORET; | |
| 25916 | 142464 | } | |
| 25917 | 1113 | } | |
| 25918 | |||
| 25919 | 1636 | markBmap(dir^1); | |
| 25920 | //preloaded freeform combos | ||
| 25921 | 1636 | ffscript_engine(true); | |
| 25922 | |||
| 25923 | 1636 | reset_hookshot(); | |
| 25924 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1636 times.
|
1636 | if(reposition_sword_postwarp) |
| 25925 | { | ||
| 25926 | ✗ | weapon *swd=NULL; | |
| 25927 | ✗ | for(int32_t i=0; i<Lwpns.Count(); i++) | |
| 25928 | { | ||
| 25929 | ✗ | swd = (weapon*)Lwpns.spr(i); | |
| 25930 | |||
| 25931 | ✗ | if(swd->id == (attack==wSword ? wSword : wWand)) | |
| 25932 | { | ||
| 25933 | ✗ | int32_t itype = (attack==wFire ? itype_candle : attack==wCByrna ? itype_cbyrna : attack==wWand ? itype_wand : attack==wHammer ? itype_hammer : itype_sword); | |
| 25934 | ✗ | int32_t item_id = (directWpn>-1 && itemsbuf[directWpn].family==itype) ? directWpn : current_item_id(itype); | |
| 25935 | ✗ | positionSword(swd,item_id); | |
| 25936 | ✗ | break; | |
| 25937 | } | ||
| 25938 | ✗ | } | |
| 25939 | ✗ | } | |
| 25940 | |||
| 25941 |
2/2✓ Branch 0 taken 473 times.
✓ Branch 1 taken 1163 times.
|
1636 | if(isdungeon()) |
| 25942 | { | ||
| 25943 | 473 | openscreen(); | |
| 25944 |
4/4✓ Branch 0 taken 430 times.
✓ Branch 1 taken 43 times.
✓ Branch 2 taken 56 times.
✓ Branch 3 taken 374 times.
|
473 | if(get_er(er_SHORTDGNWALK)==0 && get_qr(qr_SHORTDGNWALK)==0) |
| 25945 | 374 | stepforward(diagonalMovement?11:12, false); | |
| 25946 | else | ||
| 25947 | // Didn't walk as far pre-1.93, and some quests depend on that | ||
| 25948 | 99 | stepforward(8, false); | |
| 25949 | 473 | } | |
| 25950 | else | ||
| 25951 | { | ||
| 25952 |
2/2✓ Branch 0 taken 167 times.
✓ Branch 1 taken 996 times.
|
1163 | if(!COOLSCROLL) |
| 25953 | 167 | openscreen(); | |
| 25954 | |||
| 25955 | 1163 | int32_t type1 = combobuf[MAPCOMBO(x,y-16)].type; // Old-style blue square placement | |
| 25956 | 1163 | int32_t type2 = combobuf[MAPCOMBO(x,y)].type; | |
| 25957 | 1163 | int32_t type3 = combobuf[MAPCOMBO(x,y+16)].type; // More old-style blue square placement | |
| 25958 | |||
| 25959 |
10/10✓ Branch 0 taken 1055 times.
✓ Branch 1 taken 108 times.
✓ Branch 2 taken 31 times.
✓ Branch 3 taken 1024 times.
✓ Branch 4 taken 1004 times.
✓ Branch 5 taken 38 times.
✓ Branch 6 taken 27 times.
✓ Branch 7 taken 977 times.
✓ Branch 8 taken 27 times.
✓ Branch 9 taken 54 times.
|
1163 | if((type1==cCAVE)||(type1>=cCAVEB && type1<=cCAVED) || (type2==cCAVE)||(type2>=cCAVEB && type2<=cCAVED)) |
| 25960 | { | ||
| 25961 | 204 | reset_pal_cycling(); | |
| 25962 | 204 | putscr(scrollbuf,0,0,tmpscr); | |
| 25963 | 204 | putscrdoors(scrollbuf,0,0,tmpscr); | |
| 25964 | 204 | walkup(COOLSCROLL); | |
| 25965 | 204 | } | |
| 25966 |
10/10✓ Branch 0 taken 1001 times.
✓ Branch 1 taken 30 times.
✓ Branch 2 taken 50 times.
✓ Branch 3 taken 951 times.
✓ Branch 4 taken 905 times.
✓ Branch 5 taken 76 times.
✓ Branch 6 taken 24 times.
✓ Branch 7 taken 881 times.
✓ Branch 8 taken 1 times.
✓ Branch 9 taken 25 times.
|
1031 | else if((type3==cCAVE2)||(type3>=cCAVE2B && type3<=cCAVE2D) || (type2==cCAVE2)||(type2>=cCAVE2B && type2<=cCAVE2D)) |
| 25967 | { | ||
| 25968 | 157 | reset_pal_cycling(); | |
| 25969 | 157 | putscr(scrollbuf,0,0,tmpscr); | |
| 25970 | 157 | putscrdoors(scrollbuf,0,0,tmpscr); | |
| 25971 | 157 | walkdown2(COOLSCROLL); | |
| 25972 | 157 | } | |
| 25973 |
2/2✓ Branch 0 taken 852 times.
✓ Branch 1 taken 52 times.
|
906 | else if(COOLSCROLL) |
| 25974 | { | ||
| 25975 | 852 | openscreen(); | |
| 25976 | 852 | } | |
| 25977 | } | ||
| 25978 | |||
| 25979 | 1678 | show_subscreen_life=true; | |
| 25980 | 1678 | show_subscreen_numbers=true; | |
| 25981 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 1678 times.
✓ Branch 2 taken 43 times.
✓ Branch 3 taken 43 times.
|
1678 | if (updatemusic || !musicnocut) |
| 25982 | { | ||
| 25983 | 1721 | playLevelMusic(); | |
| 25984 |
1/2✓ Branch 0 taken 1635 times.
✗ Branch 1 not taken.
|
1721 | if (musicrevert) |
| 25985 | ✗ | FFCore.music_update_cond = MUSIC_UPDATE_SCREEN; | |
| 25986 | 1635 | } | |
| 25987 | 1678 | currcset=DMaps[currdmap].color; | |
| 25988 | 1678 | dointro(); | |
| 25989 | 1678 | set_respawn_point(); | |
| 25990 | 1678 | trySideviewLadder(); | |
| 25991 | |||
| 25992 |
2/2✓ Branch 0 taken 9810 times.
✓ Branch 1 taken 1678 times.
|
11488 | for(int32_t i=0; i<6; i++) |
| 25993 | 9810 | visited[i]=-1; | |
| 25994 | |||
| 25995 | 1678 | break; | |
| 25996 | } | ||
| 25997 | |||
| 25998 | case wtSCROLL: // scrolling warp | ||
| 25999 | { | ||
| 26000 | 837 | int32_t c = DMaps[currdmap].color; | |
| 26001 | 837 | scrolling_map = currmap; | |
| 26002 | 837 | currmap = DMaps[wdmap].map; | |
| 26003 | 837 | update_subscreens(wdmap); | |
| 26004 | |||
| 26005 | 837 | dlevel = DMaps[wdmap].level; | |
| 26006 | //check if Hero has the map for the new location before updating the subscreen. ? -Z | ||
| 26007 | //This works only in one direction, if Hero had a map, to not having one. | ||
| 26008 | //If Hero does not have a map, and warps somewhere where he does, then the map still briefly shows. | ||
| 26009 | 837 | update_subscreens(wdmap); | |
| 26010 | |||
| 26011 | /*if ( has_item(itype_map, dlevel) ) | ||
| 26012 | { | ||
| 26013 | //Blank the map during an intra-dmap scrolling warp. | ||
| 26014 | dlevel = -1; //a hack for the minimap. This works!! -Z | ||
| 26015 | }*/ | ||
| 26016 | |||
| 26017 | // fix the scrolling direction, if it was a tile or instant warp | ||
| 26018 |
2/4✓ Branch 0 taken 837 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 837 times.
|
837 | if(type==0 || type>=3) |
| 26019 | { | ||
| 26020 | ✗ | sdir = dir; | |
| 26021 | ✗ | } | |
| 26022 | |||
| 26023 | 837 | scrollscr(sdir, wscr+DMaps[wdmap].xoff, wdmap); | |
| 26024 | //dlevel = DMaps[wdmap].level; //Fix dlevel and draw the map (end hack). -Z | ||
| 26025 | |||
| 26026 | 837 | reset_hookshot(); | |
| 26027 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 837 times.
|
837 | if(reposition_sword_postwarp) |
| 26028 | { | ||
| 26029 | ✗ | weapon *swd=NULL; | |
| 26030 | ✗ | for(int32_t i=0; i<Lwpns.Count(); i++) | |
| 26031 | { | ||
| 26032 | ✗ | swd = (weapon*)Lwpns.spr(i); | |
| 26033 | |||
| 26034 | ✗ | if(swd->id == (attack==wSword ? wSword : wWand)) | |
| 26035 | { | ||
| 26036 | ✗ | int32_t itype = (attack==wFire ? itype_candle : attack==wCByrna ? itype_cbyrna : attack==wWand ? itype_wand : attack==wHammer ? itype_hammer : itype_sword); | |
| 26037 | ✗ | int32_t item_id = (directWpn>-1 && itemsbuf[directWpn].family==itype) ? directWpn : current_item_id(itype); | |
| 26038 | ✗ | positionSword(swd,item_id); | |
| 26039 | ✗ | break; | |
| 26040 | } | ||
| 26041 | ✗ | } | |
| 26042 | ✗ | } | |
| 26043 |
2/2✓ Branch 0 taken 89 times.
✓ Branch 1 taken 748 times.
|
837 | if(!intradmap) |
| 26044 | { | ||
| 26045 | 748 | homescr = currscr = wscr + DMaps[wdmap].xoff; | |
| 26046 | 748 | init_dmap(); | |
| 26047 | |||
| 26048 | int32_t wrx,wry; | ||
| 26049 | |||
| 26050 |
2/2✓ Branch 0 taken 410 times.
✓ Branch 1 taken 338 times.
|
748 | if(get_qr(qr_NOARRIVALPOINT)) |
| 26051 | { | ||
| 26052 | 410 | wrx=tmpscr->warpreturnx[0]; | |
| 26053 | 410 | wry=tmpscr->warpreturny[0]; | |
| 26054 | 410 | } | |
| 26055 | else | ||
| 26056 | { | ||
| 26057 | 338 | wrx=tmpscr->warparrivalx; | |
| 26058 | 338 | wry=tmpscr->warparrivaly; | |
| 26059 | } | ||
| 26060 | |||
| 26061 |
8/8✓ Branch 0 taken 325 times.
✓ Branch 1 taken 423 times.
✓ Branch 2 taken 300 times.
✓ Branch 3 taken 25 times.
✓ Branch 4 taken 282 times.
✓ Branch 5 taken 466 times.
✓ Branch 6 taken 12 times.
✓ Branch 7 taken 270 times.
|
748 | if(((wrx>0||wry>0)||(get_qr(qr_WARPSIGNOREARRIVALPOINT)))&&(!get_qr(qr_NOSCROLLCONTINUE))&&(!(tmpscr->flags6&fNOCONTINUEHERE))) |
| 26062 | { | ||
| 26063 |
2/2✓ Branch 0 taken 75 times.
✓ Branch 1 taken 195 times.
|
270 | if(dlevel) |
| 26064 | { | ||
| 26065 | 75 | lastentrance = currscr; | |
| 26066 | 75 | } | |
| 26067 | else | ||
| 26068 | { | ||
| 26069 | 195 | lastentrance = DMaps[currdmap].cont + DMaps[currdmap].xoff; | |
| 26070 | } | ||
| 26071 | |||
| 26072 | 270 | lastentrance_dmap = wdmap; | |
| 26073 | 270 | } | |
| 26074 | 748 | } | |
| 26075 |
2/2✓ Branch 0 taken 384 times.
✓ Branch 1 taken 453 times.
|
837 | if(DMaps[currdmap].color != c) |
| 26076 | { | ||
| 26077 | 453 | lighting(false, true); | |
| 26078 | 453 | } | |
| 26079 | |||
| 26080 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 837 times.
|
837 | if (updatemusic) |
| 26081 | { | ||
| 26082 | 837 | playLevelMusic(); | |
| 26083 |
1/2✓ Branch 0 taken 837 times.
✗ Branch 1 not taken.
|
837 | if (musicrevert) |
| 26084 | ✗ | FFCore.music_update_cond = MUSIC_UPDATE_SCREEN; | |
| 26085 | 837 | } | |
| 26086 | 837 | currcset=DMaps[currdmap].color; | |
| 26087 | 837 | dointro(); | |
| 26088 | } | ||
| 26089 | 837 | break; | |
| 26090 | |||
| 26091 | case wtWHISTLE: // whistle warp | ||
| 26092 | { | ||
| 26093 | 111 | scrolling_map = currmap; | |
| 26094 | 111 | currmap = DMaps[wdmap].map; | |
| 26095 | 111 | scrollscr(index, wscr+DMaps[wdmap].xoff, wdmap); | |
| 26096 | 111 | reset_hookshot(); | |
| 26097 | 111 | currdmap=wdmap; | |
| 26098 | 111 | dlevel=DMaps[currdmap].level; | |
| 26099 | 111 | lighting(false, true); | |
| 26100 | 111 | init_dmap(); | |
| 26101 | |||
| 26102 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 111 times.
|
111 | if (updatemusic) |
| 26103 | { | ||
| 26104 | 111 | playLevelMusic(); | |
| 26105 |
1/2✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
|
111 | if (musicrevert) |
| 26106 | ✗ | FFCore.music_update_cond = MUSIC_UPDATE_SCREEN; | |
| 26107 | 111 | } | |
| 26108 | 111 | currcset=DMaps[currdmap].color; | |
| 26109 | 111 | dointro(); | |
| 26110 | 111 | action=inwind; FFCore.setHeroAction(inwind); | |
| 26111 | int32_t wry; | ||
| 26112 | |||
| 26113 |
2/2✓ Branch 0 taken 28 times.
✓ Branch 1 taken 83 times.
|
111 | if(get_qr(qr_NOARRIVALPOINT)) |
| 26114 | 28 | wry=tmpscr->warpreturny[0]; | |
| 26115 | 83 | else wry=tmpscr->warparrivaly; | |
| 26116 | |||
| 26117 | int32_t wrx; | ||
| 26118 | |||
| 26119 |
2/2✓ Branch 0 taken 28 times.
✓ Branch 1 taken 83 times.
|
111 | if(get_qr(qr_NOARRIVALPOINT)) |
| 26120 | 28 | wrx=tmpscr->warpreturnx[0]; | |
| 26121 | 83 | else wrx=tmpscr->warparrivalx; | |
| 26122 | |||
| 26123 |
7/14✗ Branch 0 not taken.
✓ Branch 1 taken 111 times.
✓ Branch 2 taken 111 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 111 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 111 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 111 times.
✓ Branch 10 taken 111 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 111 times.
✗ Branch 13 not taken.
|
222 | Lwpns.add(new weapon((zfix)(index==left?240:index==right?0:wrx),(zfix)(index==down?0:index==up?160:wry), |
| 26124 |
2/4✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 111 times.
✗ Branch 3 not taken.
|
111 | (zfix)0,wWind,1,0,index,whistleitem,getUID(),false,false,true,1)); |
| 26125 | 111 | whirlwind=255; | |
| 26126 | 111 | whistleitem=-1; | |
| 26127 | } | ||
| 26128 | 111 | break; | |
| 26129 | |||
| 26130 | case wtIWARP: | ||
| 26131 | case wtIWARPBLK: | ||
| 26132 | case wtIWARPOPEN: | ||
| 26133 | case wtIWARPZAP: | ||
| 26134 | case wtIWARPWAVE: // insta-warps | ||
| 26135 | { | ||
| 26136 | 3586 | bool old_192 = false; | |
| 26137 |
2/2✓ Branch 0 taken 3542 times.
✓ Branch 1 taken 44 times.
|
3586 | if (get_qr(qr_192b163_WARP)) |
| 26138 | { | ||
| 26139 |
1/2✓ Branch 0 taken 44 times.
✗ Branch 1 not taken.
|
44 | if ( wtype == wtIWARPWAVE ) |
| 26140 | { | ||
| 26141 | ✗ | wtype = wtIWARPWAVE; | |
| 26142 | ✗ | old_192 = true; | |
| 26143 | ✗ | } | |
| 26144 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44 times.
|
44 | if ( old_192 ) |
| 26145 | { | ||
| 26146 | ✗ | al_trace("Encountered a warp in a 1.92b163 style quest, that was set as a Wave Warp.\n %s\n", "Trying to redirect it into a Cancel Effect"); | |
| 26147 | ✗ | didpit=false; | |
| 26148 | ✗ | update_subscreens(); | |
| 26149 | ✗ | warp_sound = 0; | |
| 26150 | ✗ | is_warping = false; | |
| 26151 | ✗ | return false; | |
| 26152 | } | ||
| 26153 | 44 | } | |
| 26154 | //for determining whether to exit cave | ||
| 26155 | 3586 | int32_t type1 = combobuf[MAPCOMBO(x,y-16)].type; | |
| 26156 | 3586 | int32_t type2 = combobuf[MAPCOMBO(x,y)].type; | |
| 26157 | 3586 | int32_t type3 = combobuf[MAPCOMBO(x,y+16)].type; | |
| 26158 | |||
| 26159 |
8/8✓ Branch 0 taken 3189 times.
✓ Branch 1 taken 397 times.
✓ Branch 2 taken 66 times.
✓ Branch 3 taken 3123 times.
✓ Branch 4 taken 3189 times.
✓ Branch 5 taken 66 times.
✓ Branch 6 taken 94 times.
✓ Branch 7 taken 3095 times.
|
6959 | bool cavewarp = ((type1==cCAVE)||(type1>=cCAVEB && type1<=cCAVED) || (type2==cCAVE)||(type2>=cCAVEB && type2<=cCAVED) |
| 26160 |
8/8✓ Branch 0 taken 3169 times.
✓ Branch 1 taken 74 times.
✓ Branch 2 taken 66 times.
✓ Branch 3 taken 3103 times.
✓ Branch 4 taken 65 times.
✓ Branch 5 taken 3168 times.
✓ Branch 6 taken 3111 times.
✓ Branch 7 taken 57 times.
|
3189 | ||(type3==cCAVE2)||(type3>=cCAVE2B && type3<=cCAVE2D) || (type2==cCAVE2)||(type2>=cCAVE2B && type2<=cCAVE2D)); |
| 26161 | |||
| 26162 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 3199 times.
|
3996 | if(!(tmpscr->flags3&fIWARPFULLSCREEN)) |
| 26163 | { | ||
| 26164 | //ALLOFF kills the action, but we want to preserve Hero's action if he's swimming or diving -DD | ||
| 26165 | 3199 | bool wasswimming = (action == swimming); | |
| 26166 | 3199 | int32_t olddiveclk = diveclk; | |
| 26167 | 3199 | ALLOFF(); | |
| 26168 | |||
| 26169 |
2/2✓ Branch 0 taken 3163 times.
✓ Branch 1 taken 36 times.
|
3199 | if(wasswimming) |
| 26170 | { | ||
| 26171 | 36 | Hero.SetSwim(); | |
| 26172 | 36 | diveclk = olddiveclk; | |
| 26173 | 36 | } | |
| 26174 | |||
| 26175 | 3199 | kill_sfx(); | |
| 26176 | 3199 | } | |
| 26177 | //play sound | ||
| 26178 |
2/2✓ Branch 0 taken 3107 times.
✓ Branch 1 taken 95 times.
|
3202 | if(warpsfx > 0) sfx(warpsfx,pan(x.getInt())); |
| 26179 |
2/2✓ Branch 0 taken 589 times.
✓ Branch 1 taken 2613 times.
|
3202 | if(wtype==wtIWARPZAP) |
| 26180 | { | ||
| 26181 | 589 | zapout(); | |
| 26182 | 589 | } | |
| 26183 |
2/2✓ Branch 0 taken 223 times.
✓ Branch 1 taken 2390 times.
|
2613 | else if(wtype==wtIWARPWAVE) |
| 26184 | { | ||
| 26185 | //only draw Hero if he's not in a cave -DD | ||
| 26186 | 223 | wavyout(!cavewarp); | |
| 26187 | 223 | } | |
| 26188 |
2/2✓ Branch 0 taken 1477 times.
✓ Branch 1 taken 913 times.
|
2390 | else if(wtype!=wtIWARP) |
| 26189 | { | ||
| 26190 |
2/2✓ Branch 0 taken 295 times.
✓ Branch 1 taken 618 times.
|
913 | bool b2 = COOLSCROLL&&cavewarp; |
| 26191 | 913 | blackscr(30,b2?false:true); | |
| 26192 | 913 | } | |
| 26193 | |||
| 26194 | 3202 | int32_t c = DMaps[currdmap].color; | |
| 26195 | 3202 | bool changedlevel = false; | |
| 26196 | 3202 | bool changeddmap = false; | |
| 26197 |
2/2✓ Branch 0 taken 1495 times.
✓ Branch 1 taken 1707 times.
|
3202 | if(currdmap != wdmap) |
| 26198 | { | ||
| 26199 | 1707 | timeExitAllGenscript(GENSCR_ST_CHANGE_DMAP); | |
| 26200 | 1707 | changeddmap = true; | |
| 26201 | 1707 | } | |
| 26202 |
2/2✓ Branch 0 taken 2622 times.
✓ Branch 1 taken 580 times.
|
3202 | if(dlevel != DMaps[wdmap].level) |
| 26203 | { | ||
| 26204 | 580 | timeExitAllGenscript(GENSCR_ST_CHANGE_LEVEL); | |
| 26205 | 580 | changedlevel = true; | |
| 26206 | 580 | } | |
| 26207 | 3202 | dlevel = DMaps[wdmap].level; | |
| 26208 | 3202 | currdmap = wdmap; | |
| 26209 |
2/2✓ Branch 0 taken 1495 times.
✓ Branch 1 taken 1707 times.
|
3202 | if(changeddmap) |
| 26210 | { | ||
| 26211 | 1707 | throwGenScriptEvent(GENSCR_EVENT_CHANGE_DMAP); | |
| 26212 | 1707 | } | |
| 26213 |
2/2✓ Branch 0 taken 2622 times.
✓ Branch 1 taken 580 times.
|
3202 | if(changedlevel) |
| 26214 | { | ||
| 26215 | 580 | throwGenScriptEvent(GENSCR_EVENT_CHANGE_LEVEL); | |
| 26216 | 580 | } | |
| 26217 | |||
| 26218 | 3202 | currmap = DMaps[currdmap].map; | |
| 26219 | 3202 | init_dmap(); | |
| 26220 | 3202 | update_subscreens(wdmap); | |
| 26221 | |||
| 26222 | 3202 | ringcolor(false); | |
| 26223 | |||
| 26224 |
2/2✓ Branch 0 taken 2338 times.
✓ Branch 1 taken 864 times.
|
3202 | if(DMaps[currdmap].color != c) |
| 26225 | 864 | loadlvlpal(DMaps[currdmap].color); | |
| 26226 | |||
| 26227 | 3202 | homescr = currscr = wscr + DMaps[currdmap].xoff; | |
| 26228 | |||
| 26229 | 3202 | lightingInstant(); // Also sets naturaldark | |
| 26230 | |||
| 26231 | 3202 | loadscr(0,currdmap,currscr,-1,overlay); | |
| 26232 | |||
| 26233 | 3202 | x = tmpscr->warpreturnx[wrindex]; | |
| 26234 | 3202 | y = tmpscr->warpreturny[wrindex]; | |
| 26235 | |||
| 26236 |
2/2✓ Branch 0 taken 1941 times.
✓ Branch 1 taken 1261 times.
|
3202 | if(didpit) |
| 26237 | { | ||
| 26238 | 1261 | didpit=false; | |
| 26239 | 1261 | x=pitx; | |
| 26240 | 1261 | y=pity; | |
| 26241 | 1261 | } | |
| 26242 | |||
| 26243 | 3202 | type1 = combobuf[MAPCOMBO(x,y-16)].type; | |
| 26244 | 3202 | type2 = combobuf[MAPCOMBO(x,y)].type; | |
| 26245 | 3202 | type3 = combobuf[MAPCOMBO(x,y+16)].type; | |
| 26246 | |||
| 26247 |
2/2✓ Branch 0 taken 3125 times.
✓ Branch 1 taken 77 times.
|
3202 | if(x==0) dir=right; |
| 26248 | |||
| 26249 |
2/2✓ Branch 0 taken 3198 times.
✓ Branch 1 taken 4 times.
|
3202 | if(x==240) dir=left; |
| 26250 | |||
| 26251 |
2/2✓ Branch 0 taken 3159 times.
✓ Branch 1 taken 43 times.
|
3202 | if(y==0) dir=down; |
| 26252 | |||
| 26253 |
2/2✓ Branch 0 taken 3134 times.
✓ Branch 1 taken 68 times.
|
3202 | if(y==160) dir=up; |
| 26254 | |||
| 26255 | 3202 | markBmap(dir^1); | |
| 26256 | |||
| 26257 | 3202 | int32_t checkwater = iswaterex(MAPCOMBO(x,y+8), currmap, currscr, -1, x,y+(bigHitbox?8:12)); //iswaterex can be intensive, so let's avoid as many calls as we can. | |
| 26258 | |||
| 26259 |
10/16✓ Branch 0 taken 3173 times.
✓ Branch 1 taken 29 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 29 times.
✓ Branch 4 taken 29 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 29 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 29 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 29 times.
✓ Branch 12 taken 29 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 29 times.
✓ Branch 15 taken 3173 times.
|
3231 | if(checkwater && _walkflag(x,y+(bigHitbox?8:12),0,SWITCHBLOCK_STATE) && current_item(itype_flippers) > 0 && current_item(itype_flippers) >= combobuf[checkwater].attribytes[0] && (!(combobuf[checkwater].usrflags&cflag1) || (itemsbuf[current_item_id(itype_flippers)].flags & item_flag3))) |
| 26260 | { | ||
| 26261 | 29 | hopclk=0xFF; | |
| 26262 | 29 | SetSwim(); | |
| 26263 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 29 times.
|
29 | if (!IsSideSwim()) attackclk = charging = spins = 0; |
| 26264 | 29 | } | |
| 26265 | else | ||
| 26266 | { | ||
| 26267 | 3173 | action = none; FFCore.setHeroAction(none); | |
| 26268 | } | ||
| 26269 | //preloaded freeform combos | ||
| 26270 | 3202 | ffscript_engine(true); | |
| 26271 | |||
| 26272 | 3202 | putscr(scrollbuf,0,0,tmpscr); | |
| 26273 | 3202 | putscrdoors(scrollbuf,0,0,tmpscr); | |
| 26274 | |||
| 26275 |
10/10✓ Branch 0 taken 3190 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 66 times.
✓ Branch 3 taken 3124 times.
✓ Branch 4 taken 3190 times.
✓ Branch 5 taken 66 times.
✓ Branch 6 taken 79 times.
✓ Branch 7 taken 3111 times.
✓ Branch 8 taken 168 times.
✓ Branch 9 taken 247 times.
|
3202 | if((type1==cCAVE)||(type1>=cCAVEB && type1<=cCAVED) || (type2==cCAVE)||(type2>=cCAVEB && type2<=cCAVED)) |
| 26276 | { | ||
| 26277 | 312 | reset_pal_cycling(); | |
| 26278 | 312 | putscr(scrollbuf,0,0,tmpscr); | |
| 26279 | 312 | putscrdoors(scrollbuf,0,0,tmpscr); | |
| 26280 | 312 | walkup(COOLSCROLL); | |
| 26281 | 312 | } | |
| 26282 |
9/10✓ Branch 0 taken 3190 times.
✓ Branch 1 taken 168 times.
✓ Branch 2 taken 87 times.
✓ Branch 3 taken 3103 times.
✓ Branch 4 taken 3187 times.
✓ Branch 5 taken 84 times.
✓ Branch 6 taken 75 times.
✓ Branch 7 taken 3112 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 75 times.
|
3358 | else if((type3==cCAVE2)||(type3>=cCAVE2B && type3<=cCAVE2D) || (type2==cCAVE2)||(type2>=cCAVE2B && type2<=cCAVE2D)) |
| 26283 | { | ||
| 26284 | 339 | reset_pal_cycling(); | |
| 26285 | 339 | putscr(scrollbuf,0,0,tmpscr); | |
| 26286 | 339 | putscrdoors(scrollbuf,0,0,tmpscr); | |
| 26287 | 339 | walkdown2(COOLSCROLL); | |
| 26288 | 339 | } | |
| 26289 |
2/2✓ Branch 0 taken 587 times.
✓ Branch 1 taken 2600 times.
|
3187 | else if(wtype==wtIWARPZAP) |
| 26290 | { | ||
| 26291 | 587 | zapin(); | |
| 26292 | 587 | } | |
| 26293 |
2/2✓ Branch 0 taken 220 times.
✓ Branch 1 taken 2380 times.
|
2600 | else if(wtype==wtIWARPWAVE) |
| 26294 | { | ||
| 26295 | 220 | wavyin(); | |
| 26296 | 220 | } | |
| 26297 |
2/2✓ Branch 0 taken 2246 times.
✓ Branch 1 taken 134 times.
|
2380 | else if(wtype==wtIWARPOPEN) |
| 26298 | { | ||
| 26299 | 134 | openscreen(); | |
| 26300 | 134 | } | |
| 26301 |
1/2✓ Branch 0 taken 3502 times.
✗ Branch 1 not taken.
|
3502 | if(reposition_sword_postwarp) |
| 26302 | { | ||
| 26303 | ✗ | weapon *swd=NULL; | |
| 26304 | ✗ | for(int32_t i=0; i<Lwpns.Count(); i++) | |
| 26305 | { | ||
| 26306 | ✗ | swd = (weapon*)Lwpns.spr(i); | |
| 26307 | |||
| 26308 | ✗ | if(swd->id == (attack==wSword ? wSword : wWand)) | |
| 26309 | { | ||
| 26310 | ✗ | int32_t itype = (attack==wFire ? itype_candle : attack==wCByrna ? itype_cbyrna : attack==wWand ? itype_wand : attack==wHammer ? itype_hammer : itype_sword); | |
| 26311 | ✗ | int32_t item_id = (directWpn>-1 && itemsbuf[directWpn].family==itype) ? directWpn : current_item_id(itype); | |
| 26312 | ✗ | positionSword(swd,item_id); | |
| 26313 | ✗ | break; | |
| 26314 | } | ||
| 26315 | ✗ | } | |
| 26316 | ✗ | } | |
| 26317 | 3502 | show_subscreen_life=true; | |
| 26318 | 3502 | show_subscreen_numbers=true; | |
| 26319 |
2/2✓ Branch 0 taken 300 times.
✓ Branch 1 taken 3202 times.
|
3502 | if (updatemusic) |
| 26320 | { | ||
| 26321 | 3202 | playLevelMusic(); | |
| 26322 |
1/2✓ Branch 0 taken 3202 times.
✗ Branch 1 not taken.
|
3202 | if (musicrevert) |
| 26323 | ✗ | FFCore.music_update_cond = MUSIC_UPDATE_SCREEN; | |
| 26324 | 3202 | } | |
| 26325 | 3502 | currcset=DMaps[currdmap].color; | |
| 26326 | 3502 | dointro(); | |
| 26327 | 3502 | set_respawn_point(); | |
| 26328 | 3502 | trySideviewLadder(); | |
| 26329 | } | ||
| 26330 | 3502 | break; | |
| 26331 | |||
| 26332 | |||
| 26333 | case wtNOWARP: | ||
| 26334 | { | ||
| 26335 | 151 | bool old_192 = false; | |
| 26336 |
1/2✓ Branch 0 taken 151 times.
✗ Branch 1 not taken.
|
151 | if (get_qr(qr_192b163_WARP)) |
| 26337 | { | ||
| 26338 | ✗ | wtype = wtIWARPWAVE; | |
| 26339 | ✗ | old_192 = true; | |
| 26340 | ✗ | } | |
| 26341 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 151 times.
|
151 | if ( old_192 ) |
| 26342 | { | ||
| 26343 | ✗ | al_trace("Encountered a warp in a 1.92b163 style quest, that was set as a Cancel Warp.\n %s\n", "Trying to redirect it into a Wave Effect"); | |
| 26344 | //for determining whether to exit cave | ||
| 26345 | ✗ | int32_t type1 = combobuf[MAPCOMBO(x,y-16)].type; | |
| 26346 | ✗ | int32_t type2 = combobuf[MAPCOMBO(x,y)].type; | |
| 26347 | ✗ | int32_t type3 = combobuf[MAPCOMBO(x,y+16)].type; | |
| 26348 | |||
| 26349 | ✗ | bool cavewarp = ((type1==cCAVE)||(type1>=cCAVEB && type1<=cCAVED) || (type2==cCAVE)||(type2>=cCAVEB && type2<=cCAVED) | |
| 26350 | ✗ | ||(type3==cCAVE2)||(type3>=cCAVE2B && type3<=cCAVE2D) || (type2==cCAVE2)||(type2>=cCAVE2B && type2<=cCAVE2D)); | |
| 26351 | |||
| 26352 | ✗ | if(!(tmpscr->flags3&fIWARPFULLSCREEN)) | |
| 26353 | { | ||
| 26354 | //ALLOFF kills the action, but we want to preserve Hero's action if he's swimming or diving -DD | ||
| 26355 | ✗ | bool wasswimming = (action == swimming); | |
| 26356 | ✗ | int32_t olddiveclk = diveclk; | |
| 26357 | ✗ | ALLOFF(); | |
| 26358 | |||
| 26359 | ✗ | if(wasswimming) | |
| 26360 | { | ||
| 26361 | ✗ | Hero.SetSwim(); | |
| 26362 | ✗ | diveclk = olddiveclk; | |
| 26363 | ✗ | } | |
| 26364 | |||
| 26365 | ✗ | kill_sfx(); | |
| 26366 | ✗ | } | |
| 26367 | //play sound | ||
| 26368 | ✗ | if(warpsfx > 0) sfx(warpsfx,pan(x.getInt())); | |
| 26369 | ✗ | if(wtype==wtIWARPZAP) | |
| 26370 | { | ||
| 26371 | ✗ | zapout(); | |
| 26372 | ✗ | } | |
| 26373 | ✗ | else if(wtype==wtIWARPWAVE) | |
| 26374 | { | ||
| 26375 | //only draw Hero if he's not in a cave -DD | ||
| 26376 | ✗ | wavyout(!cavewarp); | |
| 26377 | ✗ | } | |
| 26378 | ✗ | else if(wtype!=wtIWARP) | |
| 26379 | { | ||
| 26380 | ✗ | bool b2 = COOLSCROLL&&cavewarp; | |
| 26381 | ✗ | blackscr(30,b2?false:true); | |
| 26382 | ✗ | } | |
| 26383 | |||
| 26384 | ✗ | int32_t c = DMaps[currdmap].color; | |
| 26385 | ✗ | bool changedlevel = false; | |
| 26386 | ✗ | bool changeddmap = false; | |
| 26387 | ✗ | if(currdmap != wdmap) | |
| 26388 | { | ||
| 26389 | ✗ | timeExitAllGenscript(GENSCR_ST_CHANGE_DMAP); | |
| 26390 | ✗ | changeddmap = true; | |
| 26391 | ✗ | } | |
| 26392 | ✗ | if(dlevel != DMaps[wdmap].level) | |
| 26393 | { | ||
| 26394 | ✗ | timeExitAllGenscript(GENSCR_ST_CHANGE_LEVEL); | |
| 26395 | ✗ | changedlevel = true; | |
| 26396 | ✗ | } | |
| 26397 | ✗ | dlevel = DMaps[wdmap].level; | |
| 26398 | ✗ | currdmap = wdmap; | |
| 26399 | ✗ | if(changeddmap) | |
| 26400 | { | ||
| 26401 | ✗ | throwGenScriptEvent(GENSCR_EVENT_CHANGE_DMAP); | |
| 26402 | ✗ | } | |
| 26403 | ✗ | if(changedlevel) | |
| 26404 | { | ||
| 26405 | ✗ | throwGenScriptEvent(GENSCR_EVENT_CHANGE_LEVEL); | |
| 26406 | ✗ | } | |
| 26407 | ✗ | currmap = DMaps[currdmap].map; | |
| 26408 | ✗ | init_dmap(); | |
| 26409 | ✗ | update_subscreens(wdmap); | |
| 26410 | |||
| 26411 | ✗ | ringcolor(false); | |
| 26412 | |||
| 26413 | ✗ | if(DMaps[currdmap].color != c) | |
| 26414 | ✗ | loadlvlpal(DMaps[currdmap].color); | |
| 26415 | |||
| 26416 | ✗ | homescr = currscr = wscr + DMaps[currdmap].xoff; | |
| 26417 | |||
| 26418 | ✗ | lightingInstant(); // Also sets naturaldark | |
| 26419 | |||
| 26420 | ✗ | loadscr(0,currdmap,currscr,-1,overlay); | |
| 26421 | |||
| 26422 | ✗ | x = tmpscr->warpreturnx[wrindex]; | |
| 26423 | ✗ | y = tmpscr->warpreturny[wrindex]; | |
| 26424 | |||
| 26425 | ✗ | if(didpit) | |
| 26426 | { | ||
| 26427 | ✗ | didpit=false; | |
| 26428 | ✗ | x=pitx; | |
| 26429 | ✗ | y=pity; | |
| 26430 | ✗ | } | |
| 26431 | |||
| 26432 | ✗ | type1 = combobuf[MAPCOMBO(x,y-16)].type; | |
| 26433 | ✗ | type2 = combobuf[MAPCOMBO(x,y)].type; | |
| 26434 | ✗ | type3 = combobuf[MAPCOMBO(x,y+16)].type; | |
| 26435 | |||
| 26436 | ✗ | if(x==0) dir=right; | |
| 26437 | |||
| 26438 | ✗ | if(x==240) dir=left; | |
| 26439 | |||
| 26440 | ✗ | if(y==0) dir=down; | |
| 26441 | |||
| 26442 | ✗ | if(y==160) dir=up; | |
| 26443 | |||
| 26444 | ✗ | markBmap(dir^1); | |
| 26445 | |||
| 26446 | ✗ | if(iswaterex(MAPCOMBO(x,y+8), currmap, currscr, -1, x,y+8) && _walkflag(x,y+8,0,SWITCHBLOCK_STATE) && current_item(itype_flippers)) | |
| 26447 | { | ||
| 26448 | ✗ | hopclk=0xFF; | |
| 26449 | ✗ | SetSwim(); | |
| 26450 | ✗ | if (!IsSideSwim()) attackclk = charging = spins = 0; | |
| 26451 | ✗ | } | |
| 26452 | else | ||
| 26453 | { | ||
| 26454 | ✗ | action = none; | |
| 26455 | ✗ | FFCore.setHeroAction(none); | |
| 26456 | } | ||
| 26457 | //preloaded freeform combos | ||
| 26458 | ✗ | ffscript_engine(true); | |
| 26459 | |||
| 26460 | ✗ | putscr(scrollbuf,0,0,tmpscr); | |
| 26461 | ✗ | putscrdoors(scrollbuf,0,0,tmpscr); | |
| 26462 | |||
| 26463 | ✗ | if((type1==cCAVE)||(type1>=cCAVEB && type1<=cCAVED) || (type2==cCAVE)||(type2>=cCAVEB && type2<=cCAVED)) | |
| 26464 | { | ||
| 26465 | ✗ | reset_pal_cycling(); | |
| 26466 | ✗ | putscr(scrollbuf,0,0,tmpscr); | |
| 26467 | ✗ | putscrdoors(scrollbuf,0,0,tmpscr); | |
| 26468 | ✗ | walkup(COOLSCROLL); | |
| 26469 | ✗ | } | |
| 26470 | ✗ | else if((type3==cCAVE2)||(type3>=cCAVE2B && type3<=cCAVE2D) || (type2==cCAVE2)||(type2>=cCAVE2B && type2<=cCAVE2D)) | |
| 26471 | { | ||
| 26472 | ✗ | reset_pal_cycling(); | |
| 26473 | ✗ | putscr(scrollbuf,0,0,tmpscr); | |
| 26474 | ✗ | putscrdoors(scrollbuf,0,0,tmpscr); | |
| 26475 | ✗ | walkdown2(COOLSCROLL); | |
| 26476 | ✗ | } | |
| 26477 | ✗ | else if(wtype==wtIWARPZAP) | |
| 26478 | { | ||
| 26479 | ✗ | zapin(); | |
| 26480 | ✗ | } | |
| 26481 | ✗ | else if(wtype==wtIWARPWAVE) | |
| 26482 | { | ||
| 26483 | ✗ | wavyin(); | |
| 26484 | ✗ | } | |
| 26485 | ✗ | else if(wtype==wtIWARPOPEN) | |
| 26486 | { | ||
| 26487 | ✗ | openscreen(); | |
| 26488 | ✗ | } | |
| 26489 | ✗ | if(reposition_sword_postwarp) | |
| 26490 | { | ||
| 26491 | ✗ | weapon *swd=NULL; | |
| 26492 | ✗ | for(int32_t i=0; i<Lwpns.Count(); i++) | |
| 26493 | { | ||
| 26494 | ✗ | swd = (weapon*)Lwpns.spr(i); | |
| 26495 | |||
| 26496 | ✗ | if(swd->id == (attack==wSword ? wSword : wWand)) | |
| 26497 | { | ||
| 26498 | ✗ | int32_t itype = (attack==wFire ? itype_candle : attack==wCByrna ? itype_cbyrna : attack==wWand ? itype_wand : attack==wHammer ? itype_hammer : itype_sword); | |
| 26499 | ✗ | int32_t item_id = (directWpn>-1 && itemsbuf[directWpn].family==itype) ? directWpn : current_item_id(itype); | |
| 26500 | ✗ | positionSword(swd,item_id); | |
| 26501 | ✗ | break; | |
| 26502 | } | ||
| 26503 | ✗ | } | |
| 26504 | ✗ | } | |
| 26505 | ✗ | show_subscreen_life=true; | |
| 26506 | ✗ | show_subscreen_numbers=true; | |
| 26507 | ✗ | playLevelMusic(); | |
| 26508 | ✗ | currcset=DMaps[currdmap].color; | |
| 26509 | ✗ | dointro(); | |
| 26510 | ✗ | set_respawn_point(); | |
| 26511 | ✗ | trySideviewLadder(); | |
| 26512 | ✗ | break; | |
| 26513 | } | ||
| 26514 | else | ||
| 26515 | { | ||
| 26516 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 151 times.
|
151 | if(reposition_sword_postwarp) |
| 26517 | { | ||
| 26518 | ✗ | weapon *swd=NULL; | |
| 26519 | ✗ | for(int32_t i=0; i<Lwpns.Count(); i++) | |
| 26520 | { | ||
| 26521 | ✗ | swd = (weapon*)Lwpns.spr(i); | |
| 26522 | |||
| 26523 | ✗ | if(swd->id == (attack==wSword ? wSword : wWand)) | |
| 26524 | { | ||
| 26525 | ✗ | int32_t itype = (attack==wFire ? itype_candle : attack==wCByrna ? itype_cbyrna : attack==wWand ? itype_wand : attack==wHammer ? itype_hammer : itype_sword); | |
| 26526 | ✗ | int32_t item_id = (directWpn>-1 && itemsbuf[directWpn].family==itype) ? directWpn : current_item_id(itype); | |
| 26527 | ✗ | positionSword(swd,item_id); | |
| 26528 | ✗ | break; | |
| 26529 | } | ||
| 26530 | ✗ | } | |
| 26531 | ✗ | } | |
| 26532 | 151 | didpit=false; | |
| 26533 | 151 | update_subscreens(); | |
| 26534 | 151 | warp_sound = 0; | |
| 26535 | 151 | is_warping = false; | |
| 26536 | 151 | return false; | |
| 26537 | } | ||
| 26538 | } | ||
| 26539 | default: | ||
| 26540 | ✗ | didpit=false; | |
| 26541 | ✗ | update_subscreens(); | |
| 26542 | ✗ | warp_sound = 0; | |
| 26543 | ✗ | is_warping = false; | |
| 26544 | ✗ | if(reposition_sword_postwarp) | |
| 26545 | { | ||
| 26546 | ✗ | weapon *swd=NULL; | |
| 26547 | ✗ | for(int32_t i=0; i<Lwpns.Count(); i++) | |
| 26548 | { | ||
| 26549 | ✗ | swd = (weapon*)Lwpns.spr(i); | |
| 26550 | |||
| 26551 | ✗ | if(swd->id == (attack==wSword ? wSword : wWand)) | |
| 26552 | { | ||
| 26553 | ✗ | int32_t itype = (attack==wFire ? itype_candle : attack==wCByrna ? itype_cbyrna : attack==wWand ? itype_wand : attack==wHammer ? itype_hammer : itype_sword); | |
| 26554 | ✗ | int32_t item_id = (directWpn>-1 && itemsbuf[directWpn].family==itype) ? directWpn : current_item_id(itype); | |
| 26555 | ✗ | positionSword(swd,item_id); | |
| 26556 | ✗ | break; | |
| 26557 | } | ||
| 26558 | ✗ | } | |
| 26559 | ✗ | } | |
| 26560 | ✗ | return false; | |
| 26561 | } | ||
| 26562 | |||
| 26563 | // Stop Hero from drowning! | ||
| 26564 |
5/6✓ Branch 0 taken 6690 times.
✓ Branch 1 taken 343 times.
✓ Branch 2 taken 6690 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 343 times.
✓ Branch 5 taken 6347 times.
|
7033 | if(action==drowning || action==lavadrowning || action==sidedrowning) |
| 26565 | { | ||
| 26566 | 686 | drownclk=0; | |
| 26567 | 686 | drownclk=0; | |
| 26568 | 686 | action=none; FFCore.setHeroAction(none); | |
| 26569 | 686 | } | |
| 26570 | |||
| 26571 | 6347 | int32_t checkwater = iswaterex(MAPCOMBO(x,y+(bigHitbox?8:12)), currmap, currscr, -1, x,y+(bigHitbox?8:12)); | |
| 26572 | // But keep him swimming if he ought to be! | ||
| 26573 | // Unless the water is too high levelled, in which case... well, he'll drown on transition probably anyways. -Dimi | ||
| 26574 |
10/12✓ Branch 0 taken 6676 times.
✓ Branch 1 taken 329 times.
✓ Branch 2 taken 6624 times.
✓ Branch 3 taken 52 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 52 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 52 times.
✓ Branch 8 taken 3 times.
✓ Branch 9 taken 49 times.
✓ Branch 10 taken 6966 times.
✓ Branch 11 taken 39 times.
|
6397 | if(action!=rafting && checkwater && (_walkflag(x,y+(bigHitbox?8:12),0,SWITCHBLOCK_STATE) || get_qr(qr_DROWN)) |
| 26575 | //&& (current_item(itype_flippers) >= combobuf[checkwater].attribytes[0]) | ||
| 26576 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
|
52 | && (action!=inwind)) |
| 26577 | { | ||
| 26578 | 39 | hopclk=0xFF; | |
| 26579 | 39 | SetSwim(); | |
| 26580 | 39 | } | |
| 26581 | |||
| 26582 | 7005 | newscr_clk=frame; | |
| 26583 | 7005 | activated_timed_warp=false; | |
| 26584 | 7005 | eat_buttons(); | |
| 26585 | |||
| 26586 |
2/2✓ Branch 0 taken 1792 times.
✓ Branch 1 taken 5213 times.
|
7005 | if(wtype!=wtIWARP) |
| 26587 | 5213 | attackclk=0; | |
| 26588 | |||
| 26589 | 7005 | didstuff=0; | |
| 26590 | 7005 | usecounts.clear(); | |
| 26591 | 7005 | map_bkgsfx(true); | |
| 26592 | 7005 | loadside=dir^1; | |
| 26593 | 7005 | whistleclk=-1; | |
| 26594 | |||
| 26595 |
3/4✓ Branch 0 taken 6685 times.
✓ Branch 1 taken 320 times.
✓ Branch 2 taken 7005 times.
✗ Branch 3 not taken.
|
7005 | if((z>0 || fakez>0) && isSideViewHero()) |
| 26596 | { | ||
| 26597 | ✗ | y-=z; | |
| 26598 | ✗ | y-=fakez; | |
| 26599 | ✗ | fakez=0; | |
| 26600 | ✗ | z=0; | |
| 26601 | ✗ | } | |
| 26602 |
2/2✓ Branch 0 taken 434 times.
✓ Branch 1 taken 6571 times.
|
7005 | else if(!isSideViewHero()) |
| 26603 | { | ||
| 26604 | 6571 | fall=0; | |
| 26605 | 6571 | fakefall=0; | |
| 26606 | 6571 | } | |
| 26607 | |||
| 26608 | // If warping between top-down and sideview screens, | ||
| 26609 | // fix enemies that are carried over by Full Screen Warp | ||
| 26610 | 7005 | const bool tmpscr_is_sideview = isSideViewHero(); | |
| 26611 | |||
| 26612 |
4/4✓ Branch 0 taken 6573 times.
✓ Branch 1 taken 432 times.
✓ Branch 2 taken 6544 times.
✓ Branch 3 taken 29 times.
|
7005 | if(!wasSideview && tmpscr_is_sideview) |
| 26613 | { | ||
| 26614 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 29 times.
|
29 | for(int32_t i=0; i<guys.Count(); i++) |
| 26615 | { | ||
| 26616 | ✗ | if(guys.spr(i)->z > 0 || guys.spr(i)->fakez > 0) | |
| 26617 | { | ||
| 26618 | ✗ | guys.spr(i)->y -= guys.spr(i)->z; | |
| 26619 | ✗ | guys.spr(i)->y -= guys.spr(i)->fakez; | |
| 26620 | ✗ | guys.spr(i)->z = 0; | |
| 26621 | ✗ | guys.spr(i)->fakez = 0; | |
| 26622 | ✗ | } | |
| 26623 | |||
| 26624 | ✗ | if(((enemy*)guys.spr(i))->family!=eeTRAP && ((enemy*)guys.spr(i))->family!=eeSPINTILE) | |
| 26625 | ✗ | guys.spr(i)->yofs += 2; | |
| 26626 | ✗ | } | |
| 26627 | 29 | } | |
| 26628 |
4/4✓ Branch 0 taken 117 times.
✓ Branch 1 taken 6859 times.
✓ Branch 2 taken 90 times.
✓ Branch 3 taken 27 times.
|
6976 | else if(wasSideview && !tmpscr_is_sideview) |
| 26629 | { | ||
| 26630 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27 times.
|
27 | for(int32_t i=0; i<guys.Count(); i++) |
| 26631 | { | ||
| 26632 | ✗ | if(((enemy*)guys.spr(i))->family!=eeTRAP && ((enemy*)guys.spr(i))->family!=eeSPINTILE) | |
| 26633 | ✗ | guys.spr(i)->yofs -= 2; | |
| 26634 | ✗ | } | |
| 26635 | 27 | } | |
| 26636 | |||
| 26637 |
6/6✓ Branch 0 taken 4315 times.
✓ Branch 1 taken 2690 times.
✓ Branch 2 taken 426 times.
✓ Branch 3 taken 3889 times.
✓ Branch 4 taken 279 times.
✓ Branch 5 taken 179 times.
|
7005 | if((DMaps[currdmap].type&dmfCONTINUE) || (currdmap==0&&get_qr(qr_DMAP_0_CONTINUE_BUG))) |
| 26638 | { | ||
| 26639 |
2/2✓ Branch 0 taken 1346 times.
✓ Branch 1 taken 1447 times.
|
2969 | if(dlevel) |
| 26640 | { | ||
| 26641 | int32_t wrx,wry; | ||
| 26642 | |||
| 26643 |
2/2✓ Branch 0 taken 526 times.
✓ Branch 1 taken 820 times.
|
1346 | if(get_qr(qr_NOARRIVALPOINT)) |
| 26644 | { | ||
| 26645 | 526 | wrx=tmpscr->warpreturnx[0]; | |
| 26646 | 526 | wry=tmpscr->warpreturny[0]; | |
| 26647 | 526 | } | |
| 26648 | else | ||
| 26649 | { | ||
| 26650 | 820 | wrx=tmpscr->warparrivalx; | |
| 26651 | 820 | wry=tmpscr->warparrivaly; | |
| 26652 | } | ||
| 26653 | |||
| 26654 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 1 times.
|
1356 | if((wtype == wtEXIT) |
| 26655 |
10/10✓ Branch 0 taken 954 times.
✓ Branch 1 taken 392 times.
✓ Branch 2 taken 68 times.
✓ Branch 3 taken 886 times.
✓ Branch 4 taken 49 times.
✓ Branch 5 taken 19 times.
✓ Branch 6 taken 14 times.
✓ Branch 7 taken 35 times.
✓ Branch 8 taken 10 times.
✓ Branch 9 taken 4 times.
|
1346 | || (((wtype == wtSCROLL) && !intradmap) && ((wrx>0 || wry>0)||(get_qr(qr_WARPSIGNOREARRIVALPOINT))))) |
| 26656 | { | ||
| 26657 |
4/4✓ Branch 0 taken 48 times.
✓ Branch 1 taken 392 times.
✓ Branch 2 taken 20 times.
✓ Branch 3 taken 28 times.
|
440 | if(!(wtype==wtSCROLL)||!(get_qr(qr_NOSCROLLCONTINUE))) |
| 26658 | { | ||
| 26659 | 412 | game->set_continue_scrn(homescr); | |
| 26660 | //Z_message("continue_scrn = %02X e/e\n",game->get_continue_scrn()); | ||
| 26661 | 412 | } | |
| 26662 |
2/2✓ Branch 0 taken 13 times.
✓ Branch 1 taken 15 times.
|
28 | else if(currdmap != game->get_continue_dmap()) |
| 26663 | { | ||
| 26664 | 15 | game->set_continue_scrn(DMaps[currdmap].cont + DMaps[currdmap].xoff); | |
| 26665 | 15 | } | |
| 26666 | 440 | } | |
| 26667 | else | ||
| 26668 | { | ||
| 26669 |
2/2✓ Branch 0 taken 821 times.
✓ Branch 1 taken 85 times.
|
906 | if(currdmap != game->get_continue_dmap()) |
| 26670 | { | ||
| 26671 | 85 | game->set_continue_scrn(DMaps[currdmap].cont + DMaps[currdmap].xoff); | |
| 26672 | //Z_message("continue_scrn = %02X dlevel\n",game->get_continue_scrn()); | ||
| 26673 | 85 | } | |
| 26674 | } | ||
| 26675 | 1346 | } | |
| 26676 | else | ||
| 26677 | { | ||
| 26678 | 1447 | game->set_continue_scrn(DMaps[currdmap].cont + DMaps[currdmap].xoff); | |
| 26679 | //Z_message("continue_scrn = %02X\n !dlevel\n",game->get_continue_scrn()); | ||
| 26680 | } | ||
| 26681 | |||
| 26682 | 2793 | game->set_continue_dmap(currdmap); | |
| 26683 | 2793 | lastentrance_dmap = currdmap; | |
| 26684 | 2793 | lastentrance = game->get_continue_scrn(); | |
| 26685 | //Z_message("continue_map = %d\n",game->get_continue_dmap()); | ||
| 26686 | 2793 | } | |
| 26687 | |||
| 26688 |
1/2✓ Branch 0 taken 6861 times.
✗ Branch 1 not taken.
|
6861 | if(tmpscr->flags4&fAUTOSAVE) |
| 26689 | { | ||
| 26690 | ✗ | save_game(true,0); | |
| 26691 | ✗ | } | |
| 26692 | |||
| 26693 |
2/2✓ Branch 0 taken 6716 times.
✓ Branch 1 taken 145 times.
|
6861 | if(tmpscr->flags6&fCONTINUEHERE) |
| 26694 | { | ||
| 26695 | 145 | lastentrance_dmap = currdmap; | |
| 26696 | 145 | lastentrance = homescr; | |
| 26697 | 145 | } | |
| 26698 | |||
| 26699 | 6861 | update_subscreens(); | |
| 26700 | 6861 | verifyBothWeapons(); | |
| 26701 | |||
| 26702 |
2/2✓ Branch 0 taken 6278 times.
✓ Branch 1 taken 583 times.
|
6861 | if(wtype==wtCAVE) |
| 26703 | { | ||
| 26704 |
2/2✓ Branch 0 taken 429 times.
✓ Branch 1 taken 154 times.
|
583 | if(DMaps[currdmap].flags&dmfGUYCAVES) |
| 26705 | 858 | Z_eventlog("Entered %s containing %s.\n",DMaps[currdmap].flags&dmfCAVES ? "Cave" : "Item Cellar", | |
| 26706 | 429 | (char *)moduledata.roomtype_names[tmpscr[1].room]); | |
| 26707 | else | ||
| 26708 | 154 | Z_eventlog("Entered %s.",DMaps[currdmap].flags&dmfCAVES ? "Cave" : "Item Cellar"); | |
| 26709 | 583 | } | |
| 26710 | 12556 | else Z_eventlog("Warped to DMap %d: %s, screen %d, via %s.\n", currdmap, DMaps[currdmap].name,currscr, | |
| 26711 |
2/2✓ Branch 0 taken 493 times.
✓ Branch 1 taken 5785 times.
|
12063 | wtype==wtPASS ? "Passageway" : |
| 26712 |
2/2✓ Branch 0 taken 1635 times.
✓ Branch 1 taken 4150 times.
|
9935 | wtype==wtEXIT ? "Entrance/Exit" : |
| 26713 |
2/2✓ Branch 0 taken 837 times.
✓ Branch 1 taken 3313 times.
|
4150 | wtype==wtSCROLL ? "Scrolling Warp" : |
| 26714 | 3313 | wtype==wtWHISTLE ? "Whistle Warp" : | |
| 26715 | "Insta-Warp"); | ||
| 26716 | |||
| 26717 | 6861 | eventlog_mapflags(); | |
| 26718 |
1/2✓ Branch 0 taken 6861 times.
✗ Branch 1 not taken.
|
6861 | if(reposition_sword_postwarp) |
| 26719 | { | ||
| 26720 | ✗ | weapon *swd=NULL; | |
| 26721 | ✗ | for(int32_t i=0; i<Lwpns.Count(); i++) | |
| 26722 | { | ||
| 26723 | ✗ | swd = (weapon*)Lwpns.spr(i); | |
| 26724 | |||
| 26725 | ✗ | if(swd->id == (attack==wSword ? wSword : wWand)) | |
| 26726 | { | ||
| 26727 | ✗ | int32_t itype = (attack==wFire ? itype_candle : attack==wCByrna ? itype_cbyrna : attack==wWand ? itype_wand : attack==wHammer ? itype_hammer : itype_sword); | |
| 26728 | ✗ | int32_t item_id = (directWpn>-1 && itemsbuf[directWpn].family==itype) ? directWpn : current_item_id(itype); | |
| 26729 | ✗ | positionSword(swd,item_id); | |
| 26730 | ✗ | break; | |
| 26731 | } | ||
| 26732 | ✗ | } | |
| 26733 | ✗ | } | |
| 26734 | 6861 | FFCore.clear_combo_scripts(); | |
| 26735 |
4/4✓ Branch 0 taken 2369 times.
✓ Branch 1 taken 4492 times.
✓ Branch 2 taken 2163 times.
✓ Branch 3 taken 206 times.
|
6861 | if (!intradmap || get_qr(qr_WARPS_RESTART_DMAPSCRIPT)) |
| 26736 | { | ||
| 26737 | 6655 | FFScript::deallocateAllScriptOwned(ScriptType::DMap, olddmap); | |
| 26738 | 6655 | FFCore.initZScriptDMapScripts(); | |
| 26739 | 6655 | FFCore.initZScriptScriptedActiveSubscreen(); | |
| 26740 | 6655 | } | |
| 26741 | 6861 | is_warping = false; | |
| 26742 |
2/2✓ Branch 0 taken 6599 times.
✓ Branch 1 taken 262 times.
|
6861 | if(!get_qr(qr_SCROLLWARP_NO_RESET_FRAME)) |
| 26743 | 262 | GameFlags |= GAMEFLAG_RESET_GAME_LOOP; | |
| 26744 | 6861 | return true; | |
| 26745 | 7012 | } | |
| 26746 | |||
| 26747 | 384 | void HeroClass::exitcave() | |
| 26748 | { | ||
| 26749 | 384 | bool updatemusic = FFCore.can_dmap_change_music(currdmap); | |
| 26750 | 384 | bool musicnocut = FFCore.music_update_flags & MUSIC_UPDATE_FLAG_NOCUT; | |
| 26751 | |||
| 26752 | 384 | stop_sfx(QMisc.miscsfx[sfxLOWHEART]); | |
| 26753 | 384 | currscr=homescr; | |
| 26754 | 384 | loadscr(0,currdmap,currscr,255,false); // bogus direction | |
| 26755 | 384 | x = tmpscr->warpreturnx[0]; | |
| 26756 | 384 | y = tmpscr->warpreturny[0]; | |
| 26757 | |||
| 26758 |
1/2✓ Branch 0 taken 384 times.
✗ Branch 1 not taken.
|
384 | if(didpit) |
| 26759 | { | ||
| 26760 | ✗ | didpit=false; | |
| 26761 | ✗ | x=pitx; | |
| 26762 | ✗ | y=pity; | |
| 26763 | ✗ | } | |
| 26764 | |||
| 26765 |
2/2✓ Branch 0 taken 366 times.
✓ Branch 1 taken 18 times.
|
384 | if(x+y == 0) |
| 26766 | 18 | x = y = 80; | |
| 26767 | |||
| 26768 | 384 | int32_t type1 = combobuf[MAPCOMBO(x,y-16)].type; | |
| 26769 | 384 | int32_t type2 = combobuf[MAPCOMBO(x,y)].type; | |
| 26770 | 384 | int32_t type3 = combobuf[MAPCOMBO(x,y+16)].type; | |
| 26771 |
2/2✓ Branch 0 taken 49 times.
✓ Branch 1 taken 335 times.
|
735 | bool b = COOLSCROLL && |
| 26772 |
4/4✓ Branch 0 taken 216 times.
✓ Branch 1 taken 119 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 211 times.
|
335 | ((type1==cCAVE) || (type1>=cCAVEB && type1<=cCAVED) || |
| 26773 |
4/4✓ Branch 0 taken 213 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 208 times.
|
211 | (type2==cCAVE) || (type2>=cCAVEB && type2<=cCAVED) || |
| 26774 |
4/4✓ Branch 0 taken 195 times.
✓ Branch 1 taken 15 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 190 times.
|
208 | (type3==cCAVE2) || (type3>=cCAVE2B && type3<=cCAVE2D) || |
| 26775 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 195 times.
✓ Branch 2 taken 190 times.
✓ Branch 3 taken 5 times.
|
190 | (type2==cCAVE2) || (type2>=cCAVE2B && type2<=cCAVE2D)); |
| 26776 | 400 | ALLOFF(); | |
| 26777 | 400 | blackscr(30,b?false:true); | |
| 26778 | 400 | ringcolor(false); | |
| 26779 | 400 | loadlvlpal(DMaps[currdmap].color); | |
| 26780 | 400 | lighting(false, true); | |
| 26781 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 6 times.
|
400 | if (updatemusic || !musicnocut) |
| 26782 | 402 | music_stop(); | |
| 26783 | 408 | kill_sfx(); | |
| 26784 | 408 | putscr(scrollbuf,0,0,tmpscr); | |
| 26785 | 408 | putscrdoors(scrollbuf,0,0,tmpscr); | |
| 26786 | |||
| 26787 |
10/10✓ Branch 0 taken 240 times.
✓ Branch 1 taken 156 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 235 times.
✓ Branch 4 taken 237 times.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 5 times.
✓ Branch 7 taken 232 times.
✓ Branch 8 taken 2 times.
✓ Branch 9 taken 7 times.
|
408 | if((type1==cCAVE)||(type1>=cCAVEB && type1<=cCAVED) || (type2==cCAVE)||(type2>=cCAVEB && type2<=cCAVED)) |
| 26788 | { | ||
| 26789 | 165 | walkup(COOLSCROLL); | |
| 26790 | 165 | } | |
| 26791 |
9/10✓ Branch 0 taken 219 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 214 times.
✓ Branch 4 taken 219 times.
✓ Branch 5 taken 5 times.
✓ Branch 6 taken 5 times.
✓ Branch 7 taken 214 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 5 times.
|
239 | else if((type3==cCAVE2)||(type3>=cCAVE2B && type3<=cCAVE2D) || (type2==cCAVE2)||(type2>=cCAVE2B && type2<=cCAVE2D)) |
| 26792 | { | ||
| 26793 | 22 | walkdown2(COOLSCROLL); | |
| 26794 | 22 | } | |
| 26795 | |||
| 26796 | 402 | show_subscreen_life=true; | |
| 26797 | 402 | show_subscreen_numbers=true; | |
| 26798 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 402 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
402 | if (updatemusic || !musicnocut) |
| 26799 | 402 | playLevelMusic(); | |
| 26800 | 402 | currcset=DMaps[currdmap].color; | |
| 26801 | 402 | dointro(); | |
| 26802 | 402 | newscr_clk=frame; | |
| 26803 | 402 | activated_timed_warp=false; | |
| 26804 | 402 | dir=down; | |
| 26805 | 402 | set_respawn_point(); | |
| 26806 | 402 | eat_buttons(); | |
| 26807 | 402 | didstuff=0; | |
| 26808 | 402 | usecounts.clear(); | |
| 26809 | 402 | map_bkgsfx(true); | |
| 26810 | 402 | loadside=dir^1; | |
| 26811 | 402 | } | |
| 26812 | |||
| 26813 | |||
| 26814 | 11093 | void HeroClass::stepforward(int32_t steps, bool adjust) | |
| 26815 | { | ||
| 26816 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11093 times.
|
11093 | if ( FFCore.nostepforward ) return; |
| 26817 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11093 times.
|
11093 | if ( FFCore.temp_no_stepforward ) { FFCore.temp_no_stepforward = 0; return; } |
| 26818 | 11093 | zfix tx=x; //temp x | |
| 26819 | 11093 | zfix ty=y; //temp y | |
| 26820 | 11093 | zfix tstep(0); //temp single step distance | |
| 26821 | 11093 | zfix s(0); //calculated step distance for all steps | |
| 26822 | 11093 | z3step=2; | |
| 26823 | 11093 | int32_t sh=shiftdir; | |
| 26824 | 11093 | shiftdir=-1; | |
| 26825 | |||
| 26826 |
2/2✓ Branch 0 taken 189514 times.
✓ Branch 1 taken 11093 times.
|
200607 | for(int32_t i=steps; i>0; --i) |
| 26827 | { | ||
| 26828 |
2/2✓ Branch 0 taken 499 times.
✓ Branch 1 taken 189015 times.
|
189514 | if(diagonalMovement) |
| 26829 | { | ||
| 26830 |
3/4✓ Branch 0 taken 263 times.
✓ Branch 1 taken 236 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 263 times.
|
499 | if(get_qr(qr_NEW_HERO_MOVEMENT) || IsSideSwim()) |
| 26831 | { | ||
| 26832 | 236 | tstep = 1.5; | |
| 26833 | 236 | } | |
| 26834 | else | ||
| 26835 | { | ||
| 26836 | 263 | tstep=z3step; | |
| 26837 | 263 | z3step=(z3step%2)+1; | |
| 26838 | } | ||
| 26839 | 499 | } | |
| 26840 | else | ||
| 26841 | { | ||
| 26842 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 189015 times.
|
189015 | if(get_qr(qr_NEW_HERO_MOVEMENT)) |
| 26843 | { | ||
| 26844 | ✗ | tstep = 1.5; | |
| 26845 | ✗ | } | |
| 26846 | else | ||
| 26847 | { | ||
| 26848 |
2/2✓ Branch 0 taken 105421 times.
✓ Branch 1 taken 83594 times.
|
189015 | tstep=lsteps[int32_t((dir<left)?ty:tx)&7]; |
| 26849 | |||
| 26850 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 60091 times.
✓ Branch 2 taken 45330 times.
✓ Branch 3 taken 38591 times.
✓ Branch 4 taken 45003 times.
|
189015 | switch(dir) |
| 26851 | { | ||
| 26852 | case up: | ||
| 26853 | 60091 | ty-=tstep; | |
| 26854 | 60091 | break; | |
| 26855 | |||
| 26856 | case down: | ||
| 26857 | 45330 | ty+=tstep; | |
| 26858 | 45330 | break; | |
| 26859 | |||
| 26860 | case left: | ||
| 26861 | 38591 | tx-=tstep; | |
| 26862 | 38591 | break; | |
| 26863 | |||
| 26864 | case right: | ||
| 26865 | 45003 | tx+=tstep; | |
| 26866 | 45003 | break; | |
| 26867 | } | ||
| 26868 | } | ||
| 26869 | } | ||
| 26870 | |||
| 26871 | 189514 | s+=tstep; | |
| 26872 | 189514 | } | |
| 26873 | |||
| 26874 | 11093 | z3step=2; | |
| 26875 | |||
| 26876 | 11093 | x = x.getInt(); | |
| 26877 | 11093 | y = y.getInt(); | |
| 26878 |
2/2✓ Branch 0 taken 200374 times.
✓ Branch 1 taken 11090 times.
|
211464 | while(s>=0) |
| 26879 | { | ||
| 26880 |
2/2✓ Branch 0 taken 501 times.
✓ Branch 1 taken 199873 times.
|
200374 | if(diagonalMovement) |
| 26881 | { | ||
| 26882 |
5/6✓ Branch 0 taken 467 times.
✓ Branch 1 taken 34 times.
✓ Branch 2 taken 56 times.
✓ Branch 3 taken 445 times.
✓ Branch 4 taken 56 times.
✗ Branch 5 not taken.
|
501 | if((dir<left?x.getInt()&7:y.getInt()&7)&&adjust==true) |
| 26883 | { | ||
| 26884 | ✗ | if(get_qr(qr_NEW_HERO_MOVEMENT) || IsSideSwim()) | |
| 26885 | { | ||
| 26886 | ✗ | walkable = false; | |
| 26887 | ✗ | shiftdir = -1; | |
| 26888 | ✗ | int32_t tdir=dir<left?(x.getInt()&8?left:right):(y.getInt()&8?down:up); | |
| 26889 | ✗ | switch(tdir) | |
| 26890 | { | ||
| 26891 | case left: | ||
| 26892 | ✗ | --x; | |
| 26893 | ✗ | break; | |
| 26894 | case right: | ||
| 26895 | ✗ | ++x; | |
| 26896 | ✗ | break; | |
| 26897 | case up: | ||
| 26898 | ✗ | --y; | |
| 26899 | ✗ | break; | |
| 26900 | case down: | ||
| 26901 | ✗ | ++y; | |
| 26902 | ✗ | break; | |
| 26903 | } | ||
| 26904 | ✗ | } | |
| 26905 | else | ||
| 26906 | { | ||
| 26907 | ✗ | walkable=false; | |
| 26908 | ✗ | shiftdir=dir<left?(x.getInt()&8?left:right):(y.getInt()&8?down:up); | |
| 26909 | ✗ | moveOld2(dir, 150); | |
| 26910 | } | ||
| 26911 | ✗ | } | |
| 26912 | else | ||
| 26913 | { | ||
| 26914 |
3/4✓ Branch 0 taken 244 times.
✓ Branch 1 taken 257 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 244 times.
|
501 | if(get_qr(qr_NEW_HERO_MOVEMENT) || IsSideSwim()) |
| 26915 | { | ||
| 26916 | 257 | s-=1.5; | |
| 26917 | 257 | } | |
| 26918 | else | ||
| 26919 | { | ||
| 26920 | 244 | s-=z3step; | |
| 26921 | } | ||
| 26922 | 501 | walkable=true; | |
| 26923 | 501 | moveOld2(dir, 150); | |
| 26924 | } | ||
| 26925 | |||
| 26926 | 501 | shiftdir=-1; | |
| 26927 | 501 | } | |
| 26928 | else | ||
| 26929 | { | ||
| 26930 |
3/6✓ Branch 0 taken 111662 times.
✓ Branch 1 taken 88211 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 199873 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
199873 | if((dir<left?x.getInt()&7:y.getInt()&7)&&adjust==true) |
| 26931 | { | ||
| 26932 | ✗ | walkable=false; | |
| 26933 | ✗ | int32_t tdir=dir<left?(x.getInt()&8?left:right):(y.getInt()&8?down:up); | |
| 26934 | ✗ | switch(tdir) | |
| 26935 | { | ||
| 26936 | case left: | ||
| 26937 | ✗ | --x; | |
| 26938 | ✗ | break; | |
| 26939 | case right: | ||
| 26940 | ✗ | ++x; | |
| 26941 | ✗ | break; | |
| 26942 | case up: | ||
| 26943 | ✗ | --y; | |
| 26944 | ✗ | break; | |
| 26945 | case down: | ||
| 26946 | ✗ | ++y; | |
| 26947 | ✗ | break; | |
| 26948 | } | ||
| 26949 | ✗ | } | |
| 26950 | else | ||
| 26951 | { | ||
| 26952 |
2/4✓ Branch 0 taken 199873 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 199873 times.
|
199873 | if(get_qr(qr_NEW_HERO_MOVEMENT) || IsSideSwim()) |
| 26953 | { | ||
| 26954 | ✗ | s-=1.5; | |
| 26955 | ✗ | } | |
| 26956 |
2/2✓ Branch 0 taken 111662 times.
✓ Branch 1 taken 88211 times.
|
199873 | else if(dir<left) |
| 26957 | { | ||
| 26958 | 111662 | s-=lsteps[y.getInt()&7]; | |
| 26959 | 111662 | } | |
| 26960 | else | ||
| 26961 | { | ||
| 26962 | 88211 | s-=lsteps[x.getInt()&7]; | |
| 26963 | } | ||
| 26964 | |||
| 26965 | 199873 | moveOld2(dir, 150); | |
| 26966 | } | ||
| 26967 | } | ||
| 26968 | |||
| 26969 |
2/2✓ Branch 0 taken 189284 times.
✓ Branch 1 taken 11090 times.
|
200374 | if(s<0) |
| 26970 | { | ||
| 26971 | // Not quite sure how this is actually supposed to work. | ||
| 26972 | // There have to be two cases for each direction or Hero | ||
| 26973 | // either walks too far onto the screen or may get stuck | ||
| 26974 | // going through walk-through walls. | ||
| 26975 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 4000 times.
✓ Branch 2 taken 2454 times.
✓ Branch 3 taken 2115 times.
✓ Branch 4 taken 2521 times.
|
11090 | switch(dir) |
| 26976 | { | ||
| 26977 | case up: | ||
| 26978 |
2/2✓ Branch 0 taken 225 times.
✓ Branch 1 taken 3775 times.
|
4000 | if(y<8) // Leaving the screen |
| 26979 | 225 | y+=s; | |
| 26980 | else // Entering the screen | ||
| 26981 | 3775 | y-=s; | |
| 26982 | |||
| 26983 | 4000 | break; | |
| 26984 | |||
| 26985 | case down: | ||
| 26986 |
2/2✓ Branch 0 taken 216 times.
✓ Branch 1 taken 2238 times.
|
2454 | if(y>152) |
| 26987 | 216 | y-=s; | |
| 26988 | else | ||
| 26989 | 2238 | y+=s; | |
| 26990 | |||
| 26991 | 2454 | break; | |
| 26992 | |||
| 26993 | case left: | ||
| 26994 |
2/2✓ Branch 0 taken 175 times.
✓ Branch 1 taken 1940 times.
|
2115 | if(x<8) |
| 26995 | 175 | x+=s; | |
| 26996 | else | ||
| 26997 | 1940 | x-=s; | |
| 26998 | |||
| 26999 | 2115 | break; | |
| 27000 | |||
| 27001 | case right: | ||
| 27002 |
2/2✓ Branch 0 taken 195 times.
✓ Branch 1 taken 2326 times.
|
2521 | if(x>=232) |
| 27003 | 195 | x-=s; | |
| 27004 | else | ||
| 27005 | 2326 | x+=s; | |
| 27006 | |||
| 27007 | 2521 | break; | |
| 27008 | } | ||
| 27009 | 11090 | } | |
| 27010 | |||
| 27011 | |||
| 27012 | 200374 | clear_darkroom_bitmaps(); | |
| 27013 | 200374 | draw_screen(tmpscr); | |
| 27014 |
1/2✓ Branch 0 taken 200374 times.
✗ Branch 1 not taken.
|
200374 | if (canSideviewLadder()) setOnSideviewLadder(true); |
| 27015 | 200374 | advanceframe(true); | |
| 27016 | |||
| 27017 |
2/2✓ Branch 0 taken 200371 times.
✓ Branch 1 taken 3 times.
|
200374 | if(Quit) |
| 27018 | 3 | return; | |
| 27019 | } | ||
| 27020 |
4/4✓ Branch 0 taken 8569 times.
✓ Branch 1 taken 2521 times.
✓ Branch 2 taken 2454 times.
✓ Branch 3 taken 6115 times.
|
11090 | if(dir==right||dir==down) |
| 27021 | { | ||
| 27022 | 4975 | x=int32_t(x); | |
| 27023 | 4975 | y=int32_t(y); | |
| 27024 | 4975 | } | |
| 27025 | else | ||
| 27026 | { | ||
| 27027 | 6115 | x = x.getInt(); | |
| 27028 | 6115 | y = y.getInt(); | |
| 27029 | } | ||
| 27030 | 11090 | set_respawn_point(); | |
| 27031 | 11090 | draw_screen(tmpscr); | |
| 27032 | 11090 | eat_buttons(); | |
| 27033 | 11090 | shiftdir=sh; | |
| 27034 | 11093 | } | |
| 27035 | |||
| 27036 | 456 | void HeroClass::walkdown(bool opening) //entering cave | |
| 27037 | { | ||
| 27038 |
2/2✓ Branch 0 taken 58 times.
✓ Branch 1 taken 398 times.
|
456 | if(opening) |
| 27039 | { | ||
| 27040 | 398 | close_black_opening(x+8, y+8+playing_field_offset, false); | |
| 27041 | 398 | } | |
| 27042 | |||
| 27043 | 456 | hclk=0; | |
| 27044 | 456 | stop_item_sfx(itype_brang); | |
| 27045 | 456 | sfx(WAV_STAIRS,pan(x.getInt())); | |
| 27046 | 456 | clk=0; | |
| 27047 | // Fix Hero's position to the grid | ||
| 27048 | 456 | y=y.getInt()&0xF0; | |
| 27049 | 456 | action=climbcoverbottom; FFCore.setHeroAction(climbcoverbottom); | |
| 27050 | 456 | attack=wNone; | |
| 27051 | 456 | attackid=-1; | |
| 27052 | 456 | reset_swordcharge(); | |
| 27053 | 456 | climb_cover_x=x.getInt()&0xF0; | |
| 27054 | 456 | climb_cover_y=(y.getInt()&0xF0)+16; | |
| 27055 | |||
| 27056 | 456 | guys.clear(); | |
| 27057 | 456 | chainlinks.clear(); | |
| 27058 | 456 | Lwpns.clear(); | |
| 27059 | 456 | Ewpns.clear(); | |
| 27060 | 456 | items.clear(); | |
| 27061 |
2/2✓ Branch 0 taken 456 times.
✓ Branch 1 taken 29184 times.
|
29640 | for(int32_t i=0; i<64; i++) |
| 27062 | { | ||
| 27063 | 29184 | herostep(); | |
| 27064 | |||
| 27065 |
2/4✓ Branch 0 taken 29184 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 29184 times.
|
29184 | if(zinit.heroAnimationStyle==las_zelda3 || zinit.heroAnimationStyle==las_zelda3slow) |
| 27066 | ✗ | hero_count=(hero_count+1)%16; | |
| 27067 | |||
| 27068 |
2/2✓ Branch 0 taken 21888 times.
✓ Branch 1 taken 7296 times.
|
29184 | if((i&3)==3) |
| 27069 | 7296 | ++y; | |
| 27070 | |||
| 27071 | 29184 | draw_screen(tmpscr); | |
| 27072 | 29184 | advanceframe(true); | |
| 27073 | |||
| 27074 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 29184 times.
|
29184 | if(Quit) |
| 27075 | ✗ | break; | |
| 27076 | 29184 | } | |
| 27077 | |||
| 27078 | 456 | action=none; FFCore.setHeroAction(none); | |
| 27079 | 456 | } | |
| 27080 | |||
| 27081 | 120 | void HeroClass::walkdown2(bool opening) //exiting cave 2 | |
| 27082 | { | ||
| 27083 | 120 | int32_t type = combobuf[MAPCOMBO(x,y)].type; | |
| 27084 | |||
| 27085 | |||
| 27086 | // Fix Hero's position to the grid | ||
| 27087 | 120 | y=y.getInt()&0xF0; | |
| 27088 | |||
| 27089 |
3/6✓ Branch 0 taken 21 times.
✓ Branch 1 taken 99 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 21 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
120 | if((type==cCAVE2)||(type>=cCAVE2B && type<=cCAVE2D)) |
| 27090 | 99 | y -= 16; | |
| 27091 | |||
| 27092 | 120 | climb_cover_x=x.getInt()&0xF0; | |
| 27093 | 120 | climb_cover_y=y.getInt()&0xF0; | |
| 27094 | |||
| 27095 | 120 | dir=down; | |
| 27096 | 120 | z=fakez=fall=fakefall=0; | |
| 27097 | |||
| 27098 |
2/2✓ Branch 0 taken 95 times.
✓ Branch 1 taken 25 times.
|
120 | if(opening) |
| 27099 | { | ||
| 27100 | 25 | open_black_opening(x+8, y+8+playing_field_offset+16, false); | |
| 27101 | 25 | } | |
| 27102 | |||
| 27103 | 120 | hclk=0; | |
| 27104 | 120 | stop_item_sfx(itype_brang); | |
| 27105 | 120 | sfx(WAV_STAIRS,pan(x.getInt())); | |
| 27106 | 120 | clk=0; | |
| 27107 | 120 | action=climbcovertop; FFCore.setHeroAction(climbcovertop); | |
| 27108 | 120 | attack=wNone; | |
| 27109 | 120 | attackid=-1; | |
| 27110 | 120 | reset_swordcharge(); | |
| 27111 | |||
| 27112 | 120 | guys.clear(); | |
| 27113 | 120 | chainlinks.clear(); | |
| 27114 | 120 | Lwpns.clear(); | |
| 27115 | 120 | Ewpns.clear(); | |
| 27116 | 120 | items.clear(); | |
| 27117 | |||
| 27118 |
2/2✓ Branch 0 taken 120 times.
✓ Branch 1 taken 7680 times.
|
7800 | for(int32_t i=0; i<64; i++) |
| 27119 | { | ||
| 27120 | 7680 | herostep(); | |
| 27121 | |||
| 27122 |
2/4✓ Branch 0 taken 7680 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 7680 times.
|
7680 | if(zinit.heroAnimationStyle==las_zelda3 || zinit.heroAnimationStyle==las_zelda3slow) |
| 27123 | ✗ | hero_count=(hero_count+1)%16; | |
| 27124 | |||
| 27125 |
2/2✓ Branch 0 taken 5760 times.
✓ Branch 1 taken 1920 times.
|
7680 | if((i&3)==3) |
| 27126 | 1920 | ++y; | |
| 27127 | |||
| 27128 | 7680 | draw_screen(tmpscr); | |
| 27129 | 7680 | advanceframe(true); | |
| 27130 | |||
| 27131 |
1/2✓ Branch 0 taken 7680 times.
✗ Branch 1 not taken.
|
7680 | if(Quit) |
| 27132 | ✗ | break; | |
| 27133 | 7680 | } | |
| 27134 | |||
| 27135 | |||
| 27136 | 120 | action=none; FFCore.setHeroAction(none); | |
| 27137 | 120 | } | |
| 27138 | |||
| 27139 | 379 | void HeroClass::walkup(bool opening) //exiting cave | |
| 27140 | { | ||
| 27141 | 379 | int32_t type = combobuf[MAPCOMBO(x,y)].type; | |
| 27142 | |||
| 27143 |
5/6✓ Branch 0 taken 324 times.
✓ Branch 1 taken 55 times.
✓ Branch 2 taken 26 times.
✓ Branch 3 taken 298 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 26 times.
|
379 | if((type==cCAVE)||(type>=cCAVEB && type<=cCAVED)) |
| 27144 | 55 | y+=16; | |
| 27145 | |||
| 27146 | // Fix Hero's position to the grid | ||
| 27147 | 379 | y=y.getInt()&0xF0; | |
| 27148 | 379 | z=fakez=fall=fakefall=0; | |
| 27149 | |||
| 27150 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 331 times.
|
379 | if(opening) |
| 27151 | { | ||
| 27152 | 331 | open_black_opening(x+8, y+8+playing_field_offset-16, false); | |
| 27153 | 331 | } | |
| 27154 | |||
| 27155 | 379 | hclk=0; | |
| 27156 | 379 | stop_item_sfx(itype_brang); | |
| 27157 | 379 | sfx(WAV_STAIRS,pan(x.getInt())); | |
| 27158 | 379 | dir=down; | |
| 27159 | 379 | clk=0; | |
| 27160 | 379 | action=climbcoverbottom; FFCore.setHeroAction(climbcoverbottom); | |
| 27161 | 379 | attack=wNone; | |
| 27162 | 379 | attackid=-1; | |
| 27163 | 379 | reset_swordcharge(); | |
| 27164 | 379 | climb_cover_x=x.getInt()&0xF0; | |
| 27165 | 379 | climb_cover_y=y.getInt()&0xF0; | |
| 27166 | |||
| 27167 | 379 | guys.clear(); | |
| 27168 | 379 | chainlinks.clear(); | |
| 27169 | 379 | Lwpns.clear(); | |
| 27170 | 379 | Ewpns.clear(); | |
| 27171 | 379 | items.clear(); | |
| 27172 | |||
| 27173 |
2/2✓ Branch 0 taken 379 times.
✓ Branch 1 taken 24256 times.
|
24635 | for(int32_t i=0; i<64; i++) |
| 27174 | { | ||
| 27175 | 24256 | herostep(); | |
| 27176 | |||
| 27177 |
2/4✓ Branch 0 taken 24256 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 24256 times.
|
24256 | if(zinit.heroAnimationStyle==las_zelda3 || zinit.heroAnimationStyle==las_zelda3slow) |
| 27178 | ✗ | hero_count=(hero_count+1)%16; | |
| 27179 | |||
| 27180 |
2/2✓ Branch 0 taken 18192 times.
✓ Branch 1 taken 6064 times.
|
24256 | if((i&3)==0) |
| 27181 | 6064 | --y; | |
| 27182 | |||
| 27183 | 24256 | draw_screen(tmpscr); | |
| 27184 | 24256 | advanceframe(true); | |
| 27185 | |||
| 27186 |
1/2✓ Branch 0 taken 24256 times.
✗ Branch 1 not taken.
|
24256 | if(Quit) |
| 27187 | ✗ | break; | |
| 27188 | 24256 | } | |
| 27189 | 379 | map_bkgsfx(true); | |
| 27190 | 379 | loadside=dir^1; | |
| 27191 | 379 | action=none; FFCore.setHeroAction(none); | |
| 27192 | 379 | } | |
| 27193 | |||
| 27194 | 421 | void HeroClass::walkup2(bool opening) //entering cave2 | |
| 27195 | { | ||
| 27196 |
2/2✓ Branch 0 taken 96 times.
✓ Branch 1 taken 325 times.
|
421 | if(opening) |
| 27197 | { | ||
| 27198 | 325 | close_black_opening(x+8, y+8+playing_field_offset, false); | |
| 27199 | 325 | } | |
| 27200 | |||
| 27201 | 421 | hclk=0; | |
| 27202 | 421 | stop_item_sfx(itype_brang); | |
| 27203 | 421 | sfx(WAV_STAIRS,pan(x.getInt())); | |
| 27204 | 421 | dir=up; | |
| 27205 | 421 | clk=0; | |
| 27206 | 421 | action=climbcovertop; FFCore.setHeroAction(climbcovertop); | |
| 27207 | 421 | attack=wNone; | |
| 27208 | 421 | attackid=-1; | |
| 27209 | 421 | reset_swordcharge(); | |
| 27210 | 421 | climb_cover_x=x.getInt()&0xF0; | |
| 27211 | 421 | climb_cover_y=(y.getInt()&0xF0)-16; | |
| 27212 | |||
| 27213 | 421 | guys.clear(); | |
| 27214 | 421 | chainlinks.clear(); | |
| 27215 | 421 | Lwpns.clear(); | |
| 27216 | 421 | Ewpns.clear(); | |
| 27217 | 421 | items.clear(); | |
| 27218 | |||
| 27219 |
2/2✓ Branch 0 taken 421 times.
✓ Branch 1 taken 26944 times.
|
27365 | for(int32_t i=0; i<64; i++) |
| 27220 | { | ||
| 27221 | 26944 | herostep(); | |
| 27222 | |||
| 27223 |
2/4✓ Branch 0 taken 26944 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 26944 times.
|
26944 | if(zinit.heroAnimationStyle==las_zelda3 || zinit.heroAnimationStyle==las_zelda3slow) |
| 27224 | ✗ | hero_count=(hero_count+1)%16; | |
| 27225 | |||
| 27226 |
2/2✓ Branch 0 taken 20208 times.
✓ Branch 1 taken 6736 times.
|
26944 | if((i&3)==0) |
| 27227 | 6736 | --y; | |
| 27228 | |||
| 27229 | 26944 | draw_screen(tmpscr); | |
| 27230 | 26944 | advanceframe(true); | |
| 27231 | |||
| 27232 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26944 times.
|
26944 | if(Quit) |
| 27233 | ✗ | break; | |
| 27234 | 26944 | } | |
| 27235 | 421 | map_bkgsfx(true); | |
| 27236 | 421 | loadside=dir^1; | |
| 27237 | 421 | action=none; FFCore.setHeroAction(none); | |
| 27238 | 421 | } | |
| 27239 | |||
| 27240 | 455 | void HeroClass::stepout() // Step out of item cellars and passageways | |
| 27241 | { | ||
| 27242 | 455 | bool updatemusic = FFCore.can_dmap_change_music(currdmap); | |
| 27243 | 455 | bool musicnocut = FFCore.music_update_flags & MUSIC_UPDATE_FLAG_NOCUT; | |
| 27244 | |||
| 27245 | 455 | int32_t sc = specialcave; // This gets erased by ALLOFF() | |
| 27246 | 455 | ALLOFF(); | |
| 27247 | 455 | stop_sfx(QMisc.miscsfx[sfxLOWHEART]); | |
| 27248 | 455 | kill_sfx(); | |
| 27249 | 455 | draw_screen(tmpscr,false); | |
| 27250 | 455 | fade(sc>=GUYCAVE?10:11,true,false); | |
| 27251 | 455 | blackscr(30,true); | |
| 27252 | 455 | ringcolor(false); | |
| 27253 | |||
| 27254 |
4/4✓ Branch 0 taken 135 times.
✓ Branch 1 taken 320 times.
✓ Branch 2 taken 184 times.
✓ Branch 3 taken 271 times.
|
455 | if(sc==PASSAGEWAY && abs(x-warpx)>16) // How did Hero leave the passageway? |
| 27255 | { | ||
| 27256 | 271 | currdmap=stepoutdmap; | |
| 27257 | 271 | currmap=DMaps[currdmap].map; | |
| 27258 | 271 | dlevel=DMaps[currdmap].level; | |
| 27259 | |||
| 27260 | //we might have just left a passage, so be sure to update the CSet record -DD | ||
| 27261 | 271 | currcset=DMaps[currdmap].color; | |
| 27262 | |||
| 27263 | 271 | init_dmap(); | |
| 27264 | 271 | homescr=stepoutscr; | |
| 27265 | 271 | } | |
| 27266 | |||
| 27267 | 455 | currscr=homescr; | |
| 27268 | 455 | loadscr(0,currdmap,currscr,255,false); // bogus direction | |
| 27269 | 455 | draw_screen(tmpscr,false); | |
| 27270 | |||
| 27271 |
4/4✓ Branch 0 taken 454 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 444 times.
✓ Branch 3 taken 10 times.
|
455 | if(get_qr(qr_NEW_DARKROOM) || !(tmpscr->flags&fDARK)) |
| 27272 | { | ||
| 27273 | 445 | darkroom = naturaldark = false; | |
| 27274 | 445 | fade(DMaps[currdmap].color,true,true); | |
| 27275 | 445 | } | |
| 27276 | else | ||
| 27277 | { | ||
| 27278 | 10 | darkroom = naturaldark = true; | |
| 27279 | |||
| 27280 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 2 times.
|
10 | if(get_qr(qr_FADE)) |
| 27281 | { | ||
| 27282 | 8 | interpolatedfade(); | |
| 27283 | 8 | } | |
| 27284 | else | ||
| 27285 | { | ||
| 27286 | 2 | loadfadepal((DMaps[currdmap].color)*pdLEVEL+poFADE3); | |
| 27287 | } | ||
| 27288 | 10 | byte *si = colordata + CSET(DMaps[currdmap].color*pdLEVEL+poLEVEL)*3; | |
| 27289 | 10 | si+=3*48; | |
| 27290 | |||
| 27291 |
2/2✓ Branch 0 taken 160 times.
✓ Branch 1 taken 10 times.
|
170 | for(int32_t i=0; i<16; i++) |
| 27292 | { | ||
| 27293 | 160 | RAMpal[CSET(9)+i] = _RGB(si); | |
| 27294 | 160 | tempgreypal[CSET(9)+i] = _RGB(si); //preserve monochrome | |
| 27295 | 160 | si+=3; | |
| 27296 | 160 | } | |
| 27297 | } | ||
| 27298 | |||
| 27299 | 455 | x = tmpscr->warpreturnx[stepoutwr]; | |
| 27300 | 455 | y = tmpscr->warpreturny[stepoutwr]; | |
| 27301 | |||
| 27302 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | if(didpit) |
| 27303 | { | ||
| 27304 | ✗ | didpit=false; | |
| 27305 | ✗ | x=pitx; | |
| 27306 | ✗ | y=pity; | |
| 27307 | ✗ | } | |
| 27308 | |||
| 27309 |
2/2✓ Branch 0 taken 435 times.
✓ Branch 1 taken 20 times.
|
455 | if(x+y == 0) |
| 27310 | 20 | x = y = 80; | |
| 27311 | |||
| 27312 | 455 | dir=down; | |
| 27313 | |||
| 27314 | 455 | set_respawn_point(); | |
| 27315 | |||
| 27316 | // Let's use the 'exit cave' animation if we entered this cellar via a cave combo. | ||
| 27317 | 455 | int32_t type = combobuf[MAPCOMBO(tmpscr->warpreturnx[stepoutwr],tmpscr->warpreturny[stepoutwr])].type; | |
| 27318 | |||
| 27319 |
4/6✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 449 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 6 times.
|
455 | if((type==cCAVE)||(type>=cCAVEB && type<=cCAVED)) |
| 27320 | { | ||
| 27321 | ✗ | walkup(false); | |
| 27322 | ✗ | } | |
| 27323 |
4/6✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 449 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 6 times.
|
455 | else if((type==cCAVE2)||(type>=cCAVE2B && type<=cCAVE2D)) |
| 27324 | { | ||
| 27325 | ✗ | walkdown2(false); | |
| 27326 | ✗ | } | |
| 27327 | |||
| 27328 | 455 | newscr_clk=frame; | |
| 27329 | 455 | activated_timed_warp=false; | |
| 27330 | 455 | didstuff=0; | |
| 27331 | 455 | usecounts.clear(); | |
| 27332 | 455 | eat_buttons(); | |
| 27333 | 455 | markBmap(-1); | |
| 27334 | 455 | map_bkgsfx(true); | |
| 27335 | |||
| 27336 |
2/2✓ Branch 0 taken 401 times.
✓ Branch 1 taken 54 times.
|
455 | if(!get_qr(qr_CAVEEXITNOSTOPMUSIC)) |
| 27337 | { | ||
| 27338 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 54 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
54 | if (updatemusic || !musicnocut) |
| 27339 | { | ||
| 27340 | 54 | music_stop(); | |
| 27341 | 54 | playLevelMusic(); | |
| 27342 | 54 | } | |
| 27343 | 54 | } | |
| 27344 |
1/2✓ Branch 0 taken 401 times.
✗ Branch 1 not taken.
|
401 | else if(get_qr(qr_SCREEN80_OWN_MUSIC)) |
| 27345 | { | ||
| 27346 | ✗ | if (updatemusic || !musicnocut) | |
| 27347 | ✗ | playLevelMusic(); | |
| 27348 | ✗ | } | |
| 27349 | |||
| 27350 | 455 | loadside=dir^1; | |
| 27351 | 455 | } | |
| 27352 | |||
| 27353 | 30759 | bool HeroClass::nextcombo_wf(int32_t d2) | |
| 27354 | { | ||
| 27355 |
6/8✓ Branch 0 taken 30699 times.
✓ Branch 1 taken 60 times.
✓ Branch 2 taken 30260 times.
✓ Branch 3 taken 439 times.
✓ Branch 4 taken 30260 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 439 times.
✗ Branch 7 not taken.
|
30759 | if(toogam || (action!=swimming && !IsSideSwim() && action != swimhit) || hopclk==0) //!DIMITODO: ...does swimming just let you ignore smart scrolling entirely!? |
| 27356 | 30759 | return false; | |
| 27357 | |||
| 27358 | // assumes Hero is about to scroll screens | ||
| 27359 | int ns; | ||
| 27360 | ✗ | if(auto scr = nextscr(d2,false)) | |
| 27361 | ✗ | ns = *scr; | |
| 27362 | ✗ | else return false; | |
| 27363 | |||
| 27364 | ✗ | int32_t cx = x; | |
| 27365 | ✗ | int32_t cy = y; | |
| 27366 | |||
| 27367 | ✗ | switch(d2) | |
| 27368 | { | ||
| 27369 | case up: | ||
| 27370 | ✗ | cy=160; | |
| 27371 | ✗ | break; | |
| 27372 | |||
| 27373 | case down: | ||
| 27374 | ✗ | cy=0; | |
| 27375 | ✗ | break; | |
| 27376 | |||
| 27377 | case left: | ||
| 27378 | ✗ | cx=240; | |
| 27379 | ✗ | break; | |
| 27380 | |||
| 27381 | case right: | ||
| 27382 | ✗ | cx=0; | |
| 27383 | ✗ | break; | |
| 27384 | } | ||
| 27385 | |||
| 27386 | // check lower half of combo | ||
| 27387 | ✗ | cy += 8; | |
| 27388 | |||
| 27389 | // from MAPCOMBO() | ||
| 27390 | ✗ | int32_t cmb = (cy&0xF0)+(cx>>4); | |
| 27391 | |||
| 27392 | ✗ | if(cmb>175) | |
| 27393 | ✗ | return true; | |
| 27394 | |||
| 27395 | ✗ | const newcombo* c = &combobuf[TheMaps[ns].data[cmb]]; | |
| 27396 | ✗ | bool dried = iswater_type(c->type) && DRIEDLAKE; | |
| 27397 | ✗ | bool swim = iswater_type(c->type) && (current_item(itype_flippers)) && !dried; | |
| 27398 | ✗ | int32_t b=1; | |
| 27399 | |||
| 27400 | ✗ | if(cx&8) b<<=2; | |
| 27401 | |||
| 27402 | ✗ | if(cy&8) b<<=1; | |
| 27403 | |||
| 27404 | ✗ | if((c->walk&b) && !dried && !swim) | |
| 27405 | ✗ | return true; | |
| 27406 | |||
| 27407 | // next block (i.e. cnt==2) | ||
| 27408 | ✗ | if(!(cx&8)) | |
| 27409 | { | ||
| 27410 | ✗ | b<<=2; | |
| 27411 | ✗ | } | |
| 27412 | else | ||
| 27413 | { | ||
| 27414 | ✗ | c = &combobuf[TheMaps[ns].data[++cmb]]; | |
| 27415 | ✗ | dried = iswater_type(c->type) && DRIEDLAKE; | |
| 27416 | ✗ | swim = iswater_type(c->type) && (current_item(itype_flippers)) && !dried; | |
| 27417 | ✗ | b=1; | |
| 27418 | |||
| 27419 | ✗ | if(cy&8) | |
| 27420 | { | ||
| 27421 | ✗ | b<<=1; | |
| 27422 | ✗ | } | |
| 27423 | } | ||
| 27424 | |||
| 27425 | ✗ | return (c->walk&b) ? !dried && !swim : false; | |
| 27426 | 30759 | } | |
| 27427 | |||
| 27428 | ✗ | bool HeroClass::nextcombo_solid(int32_t d2) | |
| 27429 | { | ||
| 27430 | ✗ | if(toogam || currscr>=128) | |
| 27431 | ✗ | return false; | |
| 27432 | |||
| 27433 | // assumes Hero is about to scroll screens | ||
| 27434 | int ns; | ||
| 27435 | ✗ | if(auto scr = nextscr(d2,false)) | |
| 27436 | ✗ | ns = *scr; | |
| 27437 | ✗ | else return false; | |
| 27438 | |||
| 27439 | ✗ | int32_t screen = (ns%MAPSCRS); | |
| 27440 | ✗ | int32_t map = (ns - screen) / MAPSCRS; | |
| 27441 | |||
| 27442 | ✗ | int32_t cx = x; | |
| 27443 | ✗ | int32_t cy = y; | |
| 27444 | |||
| 27445 | ✗ | switch(d2) | |
| 27446 | { | ||
| 27447 | case up: | ||
| 27448 | ✗ | cy=160; | |
| 27449 | ✗ | break; | |
| 27450 | |||
| 27451 | case down: | ||
| 27452 | ✗ | cy=0; | |
| 27453 | ✗ | break; | |
| 27454 | |||
| 27455 | case left: | ||
| 27456 | ✗ | cx=240; | |
| 27457 | ✗ | break; | |
| 27458 | |||
| 27459 | case right: | ||
| 27460 | ✗ | cx=0; | |
| 27461 | ✗ | break; | |
| 27462 | } | ||
| 27463 | |||
| 27464 | ✗ | if(d2==up) cy += 8; | |
| 27465 | |||
| 27466 | ✗ | if(d2==left||d2==right) cy+=bigHitbox?0:8; | |
| 27467 | |||
| 27468 | ✗ | int32_t initcx = cx; | |
| 27469 | ✗ | int32_t initcy = cy; | |
| 27470 | // from MAPCOMBO() | ||
| 27471 | |||
| 27472 | ✗ | for(int32_t i=0; i<=((bigHitbox&&!(d2==up||d2==down))?((initcy&7)?2:1):((initcy&7)?1:0)) && cy < 176; cy+=(cy%2)?7:8,i++) | |
| 27473 | { | ||
| 27474 | ✗ | cx = initcx; | |
| 27475 | ✗ | for(int32_t k=0; k<=(get_qr(qr_SMARTER_SMART_SCROLL)?((initcx&7)?2:1):0) && cx < 256; cx+=(cx%2)?7:8,k++) | |
| 27476 | { | ||
| 27477 | ✗ | int32_t cmb = (cy&0xF0)+(cx>>4); | |
| 27478 | |||
| 27479 | ✗ | if(cmb>175) | |
| 27480 | { | ||
| 27481 | ✗ | return true; | |
| 27482 | } | ||
| 27483 | |||
| 27484 | ✗ | newcombo const& c = combobuf[MAPCOMBO3(map, screen, -1,cx,cy, get_qr(qr_SMARTER_SMART_SCROLL))]; | |
| 27485 | |||
| 27486 | ✗ | int32_t b=1; | |
| 27487 | |||
| 27488 | ✗ | if(cx&8) b<<=2; | |
| 27489 | |||
| 27490 | ✗ | if(cy&8) b<<=1; | |
| 27491 | |||
| 27492 | //bool bridgedetected = false; | ||
| 27493 | |||
| 27494 | ✗ | int32_t walk = c.walk; | |
| 27495 | ✗ | if (get_qr(qr_SMARTER_SMART_SCROLL)) | |
| 27496 | { | ||
| 27497 | ✗ | for (int32_t m = 0; m <= 1; m++) | |
| 27498 | { | ||
| 27499 | ✗ | newcombo const& cmb = combobuf[MAPCOMBO3(map, screen, m,cx,cy, true)]; | |
| 27500 | ✗ | if (cmb.type == cBRIDGE) | |
| 27501 | { | ||
| 27502 | ✗ | if (!get_qr(qr_OLD_BRIDGE_COMBOS)) | |
| 27503 | { | ||
| 27504 | ✗ | int efflag = (cmb.walk & 0xF0)>>4; | |
| 27505 | ✗ | int newsolid = (cmb.walk & 0xF); | |
| 27506 | ✗ | walk = ((newsolid | walk) & (~efflag)) | (newsolid & efflag); | |
| 27507 | ✗ | } | |
| 27508 | ✗ | else walk &= cmb.walk; | |
| 27509 | ✗ | } | |
| 27510 | ✗ | else walk |= cmb.walk; | |
| 27511 | ✗ | } | |
| 27512 | ✗ | } | |
| 27513 | /* | ||
| 27514 | if (bridgedetected) | ||
| 27515 | { | ||
| 27516 | continue; | ||
| 27517 | }*/ | ||
| 27518 | |||
| 27519 | //bool swim = iswater_type(c.type) && (current_item(itype_flippers) || action==rafting); | ||
| 27520 | ✗ | bool swim = iswaterex(MAPCOMBO3(map, screen, -1,cx,cy, get_qr(qr_SMARTER_SMART_SCROLL)), map, screen, -1, cx, cy, true, false, true) && (current_item(itype_flippers) || action==rafting); | |
| 27521 | |||
| 27522 | ✗ | if((walk&b) && !swim) | |
| 27523 | { | ||
| 27524 | ✗ | return true; | |
| 27525 | } | ||
| 27526 | ✗ | } | |
| 27527 | |||
| 27528 | /* | ||
| 27529 | #if 0 | ||
| 27530 | |||
| 27531 | // | ||
| 27532 | // next block (i.e. cnt==2) | ||
| 27533 | if(!(cx&8)) | ||
| 27534 | { | ||
| 27535 | b<<=2; | ||
| 27536 | } | ||
| 27537 | else | ||
| 27538 | { | ||
| 27539 | c = combobuf[TheMaps[ns].data[++cmb]]; | ||
| 27540 | dried = iswater_type(c.type) && DRIEDLAKE; | ||
| 27541 | //swim = iswater_type(c.type) && (current_item(itype_flippers)); | ||
| 27542 | b=1; | ||
| 27543 | |||
| 27544 | if(cy&8) | ||
| 27545 | { | ||
| 27546 | b<<=1; | ||
| 27547 | } | ||
| 27548 | } | ||
| 27549 | |||
| 27550 | swim = iswaterex(c, map, screen, -1, cx+8, cy, true, false, true) && current_item(itype_flippers); | ||
| 27551 | |||
| 27552 | if((c.walk&b) && !dried && !swim) | ||
| 27553 | { | ||
| 27554 | return true; | ||
| 27555 | } | ||
| 27556 | |||
| 27557 | cx+=8; | ||
| 27558 | |||
| 27559 | if(cx&7) | ||
| 27560 | { | ||
| 27561 | if(!(cx&8)) | ||
| 27562 | { | ||
| 27563 | b<<=2; | ||
| 27564 | } | ||
| 27565 | else | ||
| 27566 | { | ||
| 27567 | c = combobuf[TheMaps[ns].data[++cmb]]; | ||
| 27568 | dried = iswater_type(c.type) && DRIEDLAKE; | ||
| 27569 | //swim = iswaterex(cmb, map, screen, -1, cx+8, cy, true, false, true) && current_item(itype_flippers); | ||
| 27570 | b=1; | ||
| 27571 | |||
| 27572 | if(cy&8) | ||
| 27573 | { | ||
| 27574 | b<<=1; | ||
| 27575 | } | ||
| 27576 | } | ||
| 27577 | |||
| 27578 | swim = iswaterex(c, map, screen, -1, cx+8, cy, true, false, true) && current_item(itype_flippers); | ||
| 27579 | |||
| 27580 | if((c.walk&b) && !dried && !swim) | ||
| 27581 | return true; | ||
| 27582 | } | ||
| 27583 | |||
| 27584 | #endif | ||
| 27585 | */ | ||
| 27586 | ✗ | } | |
| 27587 | |||
| 27588 | ✗ | return false; | |
| 27589 | ✗ | } | |
| 27590 | |||
| 27591 | 14151814 | void HeroClass::checkscroll() | |
| 27592 | { | ||
| 27593 | //DO NOT scroll if Hero is vibrating due to Divine Escape effect -DD | ||
| 27594 |
3/4✓ Branch 0 taken 14147916 times.
✓ Branch 1 taken 3898 times.
✓ Branch 2 taken 14147916 times.
✗ Branch 3 not taken.
|
14151814 | if(action == casting||action==sideswimcasting) |
| 27595 | 3898 | return; | |
| 27596 | |||
| 27597 |
2/2✓ Branch 0 taken 8719 times.
✓ Branch 1 taken 14139197 times.
|
14147916 | if(y<0) |
| 27598 | { | ||
| 27599 | 8719 | bool doit=true; | |
| 27600 | 8719 | y=0; | |
| 27601 | |||
| 27602 |
5/6✓ Branch 0 taken 8660 times.
✓ Branch 1 taken 59 times.
✓ Branch 2 taken 8660 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 8664 times.
✓ Branch 5 taken 55 times.
|
8719 | if((z > 0 || fakez > 0 || stomping) && get_qr(qr_NO_SCROLL_WHILE_IN_AIR)) |
| 27603 | 55 | doit = false; | |
| 27604 |
3/4✓ Branch 0 taken 11 times.
✓ Branch 1 taken 8708 times.
✓ Branch 2 taken 11 times.
✗ Branch 3 not taken.
|
8719 | if(lift_wpn && get_qr(qr_NO_SCROLL_WHILE_CARRYING)) |
| 27605 | ✗ | doit = false; | |
| 27606 | |||
| 27607 |
1/2✓ Branch 0 taken 8719 times.
✗ Branch 1 not taken.
|
8719 | if(nextcombo_wf(up)) |
| 27608 | ✗ | doit=false; | |
| 27609 | |||
| 27610 |
1/10✗ Branch 0 not taken.
✓ Branch 1 taken 8719 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
8719 | if(get_qr(qr_SMARTSCREENSCROLL)&&(!(tmpscr->flags&fMAZE))&&action!=inwind &&action!=scrolling && !(tmpscr->flags2&wfUP)) |
| 27611 | { | ||
| 27612 | ✗ | if(nextcombo_solid(up)) | |
| 27613 | ✗ | doit=false; | |
| 27614 | ✗ | } | |
| 27615 | |||
| 27616 |
3/4✓ Branch 0 taken 55 times.
✓ Branch 1 taken 8664 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 55 times.
|
8719 | if(doit || action==inwind) |
| 27617 | { | ||
| 27618 |
2/2✓ Branch 0 taken 454 times.
✓ Branch 1 taken 8210 times.
|
8664 | if(currscr>=128) |
| 27619 | { | ||
| 27620 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 454 times.
|
454 | if(specialcave >= GUYCAVE) |
| 27621 | ✗ | exitcave(); | |
| 27622 | 454 | else stepout(); | |
| 27623 | 454 | } | |
| 27624 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8210 times.
|
8210 | else if(action==inwind) |
| 27625 | { | ||
| 27626 | ✗ | if(DMaps[currdmap].flags&dmfWHIRLWINDRET) | |
| 27627 | { | ||
| 27628 | ✗ | action=none; FFCore.setHeroAction(none); | |
| 27629 | ✗ | restart_level(); | |
| 27630 | ✗ | } | |
| 27631 | else | ||
| 27632 | { | ||
| 27633 | ✗ | dowarp(2,up); | |
| 27634 | } | ||
| 27635 | ✗ | } | |
| 27636 |
3/6✓ Branch 0 taken 382 times.
✓ Branch 1 taken 7828 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 382 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
8210 | else if(tmpscr->flags2&wfUP && (!(tmpscr->flags8&fMAZEvSIDEWARP) || checkmaze(tmpscr,false))) |
| 27637 | { | ||
| 27638 | 382 | sdir=up; | |
| 27639 | 382 | dowarp(1,(tmpscr->sidewarpindex)&3); | |
| 27640 | 382 | } | |
| 27641 |
2/2✓ Branch 0 taken 51 times.
✓ Branch 1 taken 7777 times.
|
7828 | else if(!edge_of_dmap(up)) |
| 27642 | { | ||
| 27643 | 7777 | scrolling_map = currmap; | |
| 27644 | 7777 | scrollscr(up); | |
| 27645 | |||
| 27646 |
1/2✓ Branch 0 taken 7777 times.
✗ Branch 1 not taken.
|
7777 | if(tmpscr->flags4&fAUTOSAVE) |
| 27647 | { | ||
| 27648 | ✗ | save_game(true,0); | |
| 27649 | ✗ | } | |
| 27650 | |||
| 27651 |
2/2✓ Branch 0 taken 7452 times.
✓ Branch 1 taken 325 times.
|
7777 | if(tmpscr->flags6&fCONTINUEHERE) |
| 27652 | { | ||
| 27653 | 325 | lastentrance_dmap = currdmap; | |
| 27654 | 325 | lastentrance = homescr; | |
| 27655 | 325 | } | |
| 27656 | 7777 | } | |
| 27657 | 8664 | } | |
| 27658 | 8719 | } | |
| 27659 | |||
| 27660 |
2/2✓ Branch 0 taken 7056 times.
✓ Branch 1 taken 14140860 times.
|
14147916 | if(y>160) |
| 27661 | { | ||
| 27662 | 7056 | bool doit=true; | |
| 27663 | 7056 | y=160; | |
| 27664 | |||
| 27665 |
5/6✓ Branch 0 taken 6995 times.
✓ Branch 1 taken 61 times.
✓ Branch 2 taken 6995 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6998 times.
✓ Branch 5 taken 58 times.
|
7056 | if((z > 0 || fakez > 0 || stomping) && get_qr(qr_NO_SCROLL_WHILE_IN_AIR)) |
| 27666 | 58 | doit = false; | |
| 27667 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 7050 times.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
7056 | if(lift_wpn && get_qr(qr_NO_SCROLL_WHILE_CARRYING)) |
| 27668 | ✗ | doit = false; | |
| 27669 | |||
| 27670 |
1/2✓ Branch 0 taken 7056 times.
✗ Branch 1 not taken.
|
7056 | if(nextcombo_wf(down)) |
| 27671 | ✗ | doit=false; | |
| 27672 | |||
| 27673 |
1/10✗ Branch 0 not taken.
✓ Branch 1 taken 7056 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
7056 | if(get_qr(qr_SMARTSCREENSCROLL)&&(!(tmpscr->flags&fMAZE))&&action!=inwind &&action!=scrolling &&!(tmpscr->flags2&wfDOWN)) |
| 27674 | { | ||
| 27675 | ✗ | if(nextcombo_solid(down)) | |
| 27676 | ✗ | doit=false; | |
| 27677 | ✗ | } | |
| 27678 | |||
| 27679 |
3/4✓ Branch 0 taken 58 times.
✓ Branch 1 taken 6998 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 58 times.
|
7056 | if(doit || action==inwind) |
| 27680 | { | ||
| 27681 |
2/2✓ Branch 0 taken 346 times.
✓ Branch 1 taken 6652 times.
|
6998 | if(currscr>=128) |
| 27682 | { | ||
| 27683 |
2/2✓ Branch 0 taken 345 times.
✓ Branch 1 taken 1 times.
|
346 | if(specialcave >= GUYCAVE) |
| 27684 | 345 | exitcave(); | |
| 27685 | 1 | else stepout(); | |
| 27686 | 346 | } | |
| 27687 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6652 times.
|
6652 | else if(action==inwind) |
| 27688 | { | ||
| 27689 | ✗ | if(DMaps[currdmap].flags&dmfWHIRLWINDRET) | |
| 27690 | { | ||
| 27691 | ✗ | action=none; FFCore.setHeroAction(none); | |
| 27692 | ✗ | restart_level(); | |
| 27693 | ✗ | } | |
| 27694 | else | ||
| 27695 | { | ||
| 27696 | ✗ | dowarp(2,down); | |
| 27697 | } | ||
| 27698 | ✗ | } | |
| 27699 |
3/6✓ Branch 0 taken 950 times.
✓ Branch 1 taken 5702 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 950 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
6652 | else if(tmpscr->flags2&wfDOWN && (!(tmpscr->flags8&fMAZEvSIDEWARP) || checkmaze(tmpscr,false))) |
| 27700 | { | ||
| 27701 | 950 | sdir=down; | |
| 27702 | 950 | dowarp(1,(tmpscr->sidewarpindex>>2)&3); | |
| 27703 | 950 | } | |
| 27704 |
2/2✓ Branch 0 taken 38 times.
✓ Branch 1 taken 5664 times.
|
5702 | else if(!edge_of_dmap(down)) |
| 27705 | { | ||
| 27706 | 5664 | scrolling_map = currmap; | |
| 27707 | 5664 | scrollscr(down); | |
| 27708 | |||
| 27709 |
1/2✓ Branch 0 taken 5664 times.
✗ Branch 1 not taken.
|
5664 | if(tmpscr->flags4&fAUTOSAVE) |
| 27710 | { | ||
| 27711 | ✗ | save_game(true,0); | |
| 27712 | ✗ | } | |
| 27713 | |||
| 27714 |
2/2✓ Branch 0 taken 5550 times.
✓ Branch 1 taken 114 times.
|
5664 | if(tmpscr->flags6&fCONTINUEHERE) |
| 27715 | { | ||
| 27716 | 114 | lastentrance_dmap = currdmap; | |
| 27717 | 114 | lastentrance = homescr; | |
| 27718 | 114 | } | |
| 27719 | 5664 | } | |
| 27720 | 6998 | } | |
| 27721 | 7056 | } | |
| 27722 | |||
| 27723 |
2/2✓ Branch 0 taken 6614 times.
✓ Branch 1 taken 14141302 times.
|
14147916 | if(x<0) |
| 27724 | { | ||
| 27725 | 6614 | bool doit=true; | |
| 27726 | 6614 | x=0; | |
| 27727 | |||
| 27728 |
4/6✓ Branch 0 taken 6611 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 6611 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6614 times.
✗ Branch 5 not taken.
|
6614 | if((z > 0 || fakez > 0 || stomping) && get_qr(qr_NO_SCROLL_WHILE_IN_AIR)) |
| 27729 | ✗ | doit = false; | |
| 27730 |
3/4✓ Branch 0 taken 53 times.
✓ Branch 1 taken 6561 times.
✓ Branch 2 taken 53 times.
✗ Branch 3 not taken.
|
6614 | if(lift_wpn && get_qr(qr_NO_SCROLL_WHILE_CARRYING)) |
| 27731 | ✗ | doit = false; | |
| 27732 | |||
| 27733 |
1/2✓ Branch 0 taken 6614 times.
✗ Branch 1 not taken.
|
6614 | if(nextcombo_wf(left)) |
| 27734 | ✗ | doit=false; | |
| 27735 | |||
| 27736 |
1/10✗ Branch 0 not taken.
✓ Branch 1 taken 6614 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
6614 | if(get_qr(qr_SMARTSCREENSCROLL)&&(!(tmpscr->flags&fMAZE))&&action!=inwind &&action!=scrolling &&!(tmpscr->flags2&wfLEFT)) |
| 27737 | { | ||
| 27738 | ✗ | if(nextcombo_solid(left)) | |
| 27739 | ✗ | doit=false; | |
| 27740 | ✗ | } | |
| 27741 | |||
| 27742 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 6614 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
6614 | if(doit || action==inwind) |
| 27743 | { | ||
| 27744 |
1/2✓ Branch 0 taken 6614 times.
✗ Branch 1 not taken.
|
6614 | if(currscr>=128) |
| 27745 | { | ||
| 27746 | ✗ | if(specialcave >= GUYCAVE) | |
| 27747 | ✗ | exitcave(); | |
| 27748 | ✗ | else stepout(); | |
| 27749 | ✗ | } | |
| 27750 | |||
| 27751 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6614 times.
|
6614 | if(action==inwind) |
| 27752 | { | ||
| 27753 | ✗ | if(DMaps[currdmap].flags&dmfWHIRLWINDRET) | |
| 27754 | { | ||
| 27755 | ✗ | action=none; FFCore.setHeroAction(none); | |
| 27756 | ✗ | restart_level(); | |
| 27757 | ✗ | } | |
| 27758 | else | ||
| 27759 | { | ||
| 27760 | ✗ | dowarp(2,left); | |
| 27761 | } | ||
| 27762 | ✗ | } | |
| 27763 |
3/6✓ Branch 0 taken 266 times.
✓ Branch 1 taken 6348 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 266 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
6614 | else if(tmpscr->flags2&wfLEFT && (!(tmpscr->flags8&fMAZEvSIDEWARP) || checkmaze(tmpscr,false))) |
| 27764 | { | ||
| 27765 | 266 | sdir=left; | |
| 27766 | 266 | dowarp(1,(tmpscr->sidewarpindex>>4)&3); | |
| 27767 | 266 | } | |
| 27768 |
2/2✓ Branch 0 taken 136 times.
✓ Branch 1 taken 6212 times.
|
6348 | else if(!edge_of_dmap(left)) |
| 27769 | { | ||
| 27770 | 6212 | scrolling_map = currmap; | |
| 27771 | 6212 | scrollscr(left); | |
| 27772 | |||
| 27773 |
1/2✓ Branch 0 taken 6212 times.
✗ Branch 1 not taken.
|
6212 | if(tmpscr->flags4&fAUTOSAVE) |
| 27774 | { | ||
| 27775 | ✗ | save_game(true,0); | |
| 27776 | ✗ | } | |
| 27777 | |||
| 27778 |
2/2✓ Branch 0 taken 6174 times.
✓ Branch 1 taken 38 times.
|
6212 | if(tmpscr->flags6&fCONTINUEHERE) |
| 27779 | { | ||
| 27780 | 38 | lastentrance_dmap = currdmap; | |
| 27781 | 38 | lastentrance = homescr; | |
| 27782 | 38 | } | |
| 27783 | 6212 | } | |
| 27784 | 6614 | } | |
| 27785 | 6614 | } | |
| 27786 | |||
| 27787 |
2/2✓ Branch 0 taken 7464 times.
✓ Branch 1 taken 14140452 times.
|
14147916 | if(x>240) |
| 27788 | { | ||
| 27789 | 7464 | bool doit=true; | |
| 27790 | 7464 | x=240; | |
| 27791 | |||
| 27792 |
5/6✓ Branch 0 taken 7432 times.
✓ Branch 1 taken 32 times.
✓ Branch 2 taken 7432 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7432 times.
✓ Branch 5 taken 32 times.
|
7464 | if((z > 0 || fakez > 0 || stomping) && get_qr(qr_NO_SCROLL_WHILE_IN_AIR)) |
| 27793 | 32 | doit = false; | |
| 27794 |
3/4✓ Branch 0 taken 11 times.
✓ Branch 1 taken 7453 times.
✓ Branch 2 taken 11 times.
✗ Branch 3 not taken.
|
7464 | if(lift_wpn && get_qr(qr_NO_SCROLL_WHILE_CARRYING)) |
| 27795 | ✗ | doit = false; | |
| 27796 | |||
| 27797 |
1/2✓ Branch 0 taken 7464 times.
✗ Branch 1 not taken.
|
7464 | if(nextcombo_wf(right)) |
| 27798 | ✗ | doit=false; | |
| 27799 | |||
| 27800 |
1/10✗ Branch 0 not taken.
✓ Branch 1 taken 7464 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
7464 | if(get_qr(qr_SMARTSCREENSCROLL)&&(!(tmpscr->flags&fMAZE))&&action!=inwind &&action!=scrolling &&!(tmpscr->flags2&wfRIGHT)) |
| 27801 | { | ||
| 27802 | ✗ | if(nextcombo_solid(right)) | |
| 27803 | ✗ | doit=false; | |
| 27804 | ✗ | } | |
| 27805 | |||
| 27806 |
3/4✓ Branch 0 taken 32 times.
✓ Branch 1 taken 7432 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 32 times.
|
7464 | if(doit || action==inwind) |
| 27807 | { | ||
| 27808 |
1/2✓ Branch 0 taken 7432 times.
✗ Branch 1 not taken.
|
7432 | if(currscr>=128) |
| 27809 | { | ||
| 27810 | ✗ | if(specialcave >= GUYCAVE) | |
| 27811 | ✗ | exitcave(); | |
| 27812 | ✗ | else stepout(); | |
| 27813 | ✗ | } | |
| 27814 | |||
| 27815 |
2/2✓ Branch 0 taken 112 times.
✓ Branch 1 taken 7320 times.
|
7432 | if(action==inwind) |
| 27816 | { | ||
| 27817 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 111 times.
|
112 | if(DMaps[currdmap].flags&dmfWHIRLWINDRET) |
| 27818 | { | ||
| 27819 | 1 | action=none; FFCore.setHeroAction(none); | |
| 27820 | 1 | restart_level(); | |
| 27821 | 1 | } | |
| 27822 | else | ||
| 27823 | { | ||
| 27824 | 111 | dowarp(2,right); | |
| 27825 | } | ||
| 27826 | 112 | } | |
| 27827 |
3/6✓ Branch 0 taken 285 times.
✓ Branch 1 taken 7035 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 285 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
7320 | else if(tmpscr->flags2&wfRIGHT && (!(tmpscr->flags8&fMAZEvSIDEWARP) || checkmaze(tmpscr,false))) |
| 27828 | { | ||
| 27829 | 285 | sdir=right; | |
| 27830 | 285 | dowarp(1,(tmpscr->sidewarpindex>>6)&3); | |
| 27831 | 285 | } | |
| 27832 |
2/2✓ Branch 0 taken 112 times.
✓ Branch 1 taken 6923 times.
|
7035 | else if(!edge_of_dmap(right)) |
| 27833 | { | ||
| 27834 | 6923 | scrolling_map = currmap; | |
| 27835 | 6923 | scrollscr(right); | |
| 27836 | |||
| 27837 |
1/2✓ Branch 0 taken 6923 times.
✗ Branch 1 not taken.
|
6923 | if(tmpscr->flags4&fAUTOSAVE) |
| 27838 | { | ||
| 27839 | ✗ | save_game(true,0); | |
| 27840 | ✗ | } | |
| 27841 | |||
| 27842 |
2/2✓ Branch 0 taken 6871 times.
✓ Branch 1 taken 52 times.
|
6923 | if(tmpscr->flags6&fCONTINUEHERE) |
| 27843 | { | ||
| 27844 | 52 | lastentrance_dmap = currdmap; | |
| 27845 | 52 | lastentrance = homescr; | |
| 27846 | 52 | } | |
| 27847 | 6923 | } | |
| 27848 | 7432 | } | |
| 27849 | 7464 | } | |
| 27850 | 14151814 | } | |
| 27851 | |||
| 27852 | // assumes current direction is in lastdir[3] | ||
| 27853 | // compares directions with scr->path and scr->exitdir | ||
| 27854 | 79906 | bool HeroClass::checkmaze(mapscr *scr, bool sound) | |
| 27855 | { | ||
| 27856 |
2/2✓ Branch 0 taken 79408 times.
✓ Branch 1 taken 498 times.
|
79906 | if(!(scr->flags&fMAZE)) |
| 27857 | 79408 | return true; | |
| 27858 | |||
| 27859 |
2/2✓ Branch 0 taken 54 times.
✓ Branch 1 taken 444 times.
|
498 | if(lastdir[3]==scr->exitdir) |
| 27860 | 54 | return true; | |
| 27861 | |||
| 27862 |
2/2✓ Branch 0 taken 698 times.
✓ Branch 1 taken 66 times.
|
764 | for(int32_t i=0; i<4; i++) |
| 27863 |
2/2✓ Branch 0 taken 320 times.
✓ Branch 1 taken 378 times.
|
698 | if(lastdir[i]!=scr->path[i]) |
| 27864 | 378 | return false; | |
| 27865 | |||
| 27866 |
2/2✓ Branch 0 taken 33 times.
✓ Branch 1 taken 33 times.
|
66 | if(sound) |
| 27867 | 33 | sfx(scr->secretsfx); | |
| 27868 | |||
| 27869 | 66 | return true; | |
| 27870 | 79906 | } | |
| 27871 | |||
| 27872 | 53330 | bool HeroClass::edge_of_dmap(int32_t side) | |
| 27873 | { | ||
| 27874 |
2/2✓ Branch 0 taken 53111 times.
✓ Branch 1 taken 219 times.
|
53330 | if(checkmaze(tmpscr,false)==false) |
| 27875 | 219 | return false; | |
| 27876 | |||
| 27877 | // needs fixin' | ||
| 27878 | // should check dmap style | ||
| 27879 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 15470 times.
✓ Branch 2 taken 11308 times.
✓ Branch 3 taken 12468 times.
✓ Branch 4 taken 13865 times.
|
53111 | switch(side) |
| 27880 | { | ||
| 27881 | case up: | ||
| 27882 | 15470 | return currscr<16; | |
| 27883 | |||
| 27884 | case down: | ||
| 27885 | 11308 | return currscr>=112; | |
| 27886 | |||
| 27887 | case left: | ||
| 27888 |
2/2✓ Branch 0 taken 12333 times.
✓ Branch 1 taken 135 times.
|
12468 | if((currscr&15)==0) |
| 27889 | 135 | return true; | |
| 27890 | |||
| 27891 |
2/2✓ Branch 0 taken 7105 times.
✓ Branch 1 taken 5228 times.
|
12333 | if((DMaps[currdmap].type&dmfTYPE)!=dmOVERW) |
| 27892 | // if(dlevel) | ||
| 27893 | 7105 | return (((currscr&15)-DMaps[currdmap].xoff)<=0); | |
| 27894 | |||
| 27895 | 5228 | break; | |
| 27896 | |||
| 27897 | case right: | ||
| 27898 |
2/2✓ Branch 0 taken 112 times.
✓ Branch 1 taken 13753 times.
|
13865 | if((currscr&15)==15) |
| 27899 | 112 | return true; | |
| 27900 | |||
| 27901 |
2/2✓ Branch 0 taken 7813 times.
✓ Branch 1 taken 5940 times.
|
13753 | if((DMaps[currdmap].type&dmfTYPE)!=dmOVERW) |
| 27902 | // if(dlevel) | ||
| 27903 | 7813 | return (((currscr&15)-DMaps[currdmap].xoff)>=7); | |
| 27904 | |||
| 27905 | 5940 | break; | |
| 27906 | } | ||
| 27907 | |||
| 27908 | 11168 | return false; | |
| 27909 | 53330 | } | |
| 27910 | |||
| 27911 | 454 | bool HeroClass::lookaheadraftflag(int32_t d2) | |
| 27912 | { | ||
| 27913 | // Helper for scrollscr that gets next combo on next screen. | ||
| 27914 | // Can use destscr for scrolling warps, | ||
| 27915 | // but assumes currmap is correct. | ||
| 27916 | |||
| 27917 | 454 | int32_t cx = x; | |
| 27918 | 454 | int32_t cy = y + 8; | |
| 27919 | |||
| 27920 | 454 | bound(cx, 0, 240); //Fix crash during screen scroll when Hero is moving too quickly through a corner - DarkDragon | |
| 27921 | 454 | bound(cy, 0, 168); //Fix crash during screen scroll when Hero is moving too quickly through a corner - DarkDragon | |
| 27922 | //y+8 could be 168 //Attempt to fix a frash where scrolling through the lower-left corner could crassh ZC as reported by Lut. -Z | ||
| 27923 | //Applying this here, too. -Z | ||
| 27924 | |||
| 27925 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 128 times.
✓ Branch 2 taken 111 times.
✓ Branch 3 taken 100 times.
✓ Branch 4 taken 115 times.
|
454 | switch(d2) |
| 27926 | { | ||
| 27927 | case up: | ||
| 27928 | 128 | cy=160; | |
| 27929 | 128 | break; | |
| 27930 | |||
| 27931 | case down: | ||
| 27932 | 111 | cy=0; | |
| 27933 | 111 | break; | |
| 27934 | |||
| 27935 | case left: | ||
| 27936 | 100 | cx=240; | |
| 27937 | 100 | break; | |
| 27938 | |||
| 27939 | case right: | ||
| 27940 | 115 | cx=0; | |
| 27941 | 115 | break; | |
| 27942 | } | ||
| 27943 | |||
| 27944 | 454 | int32_t combo = (cy&0xF0)+(cx>>4); | |
| 27945 | |||
| 27946 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 454 times.
|
454 | if(combo>175) |
| 27947 | ✗ | return 0; | |
| 27948 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 454 times.
|
454 | return ( isRaftFlag(combobuf[tmpscr[0].data[combo]].flag) || isRaftFlag(tmpscr[0].sflag[combo])); |
| 27949 | |||
| 27950 | 454 | } | |
| 27951 | 27534 | int32_t HeroClass::lookahead(int32_t d2) // Helper for scrollscr that gets next combo on next screen. | |
| 27952 | { | ||
| 27953 | // Can use destscr for scrolling warps, | ||
| 27954 | // but assumes currmap is correct. | ||
| 27955 | |||
| 27956 | 27534 | int32_t cx = vbound(x,0_zf,240_zf); //var = vbound(val, n1, n2), not bound(var, n1, n2) -Z | |
| 27957 | 27534 | int32_t cy = vbound(y + 8,0_zf,160_zf); | |
| 27958 | //bound(cx, 0, 240); //Fix crash during screen scroll when Hero is moving too quickly through a corner - DarkDragon | ||
| 27959 | //bound(cy, 0, 168); //Fix crash during screen scroll when Hero is moving too quickly through a corner - DarkDragon | ||
| 27960 | //y+8 could be 168 //Attempt to fix a frash where scrolling through the lower-left corner could crassh ZC as reported by Lut. -Z | ||
| 27961 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 8002 times.
✓ Branch 2 taken 5871 times.
✓ Branch 3 taken 6412 times.
✓ Branch 4 taken 7249 times.
|
27534 | switch(d2) |
| 27962 | { | ||
| 27963 | case up: | ||
| 27964 | 8002 | cy=160; | |
| 27965 | 8002 | break; | |
| 27966 | |||
| 27967 | case down: | ||
| 27968 | 5871 | cy=0; | |
| 27969 | 5871 | break; | |
| 27970 | |||
| 27971 | case left: | ||
| 27972 | 6412 | cx=240; | |
| 27973 | 6412 | break; | |
| 27974 | |||
| 27975 | case right: | ||
| 27976 | 7249 | cx=0; | |
| 27977 | 7249 | break; | |
| 27978 | } | ||
| 27979 | |||
| 27980 | 27534 | int32_t combo = (cy&0xF0)+(cx>>4); | |
| 27981 | |||
| 27982 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27534 times.
|
27534 | if(combo>175) |
| 27983 | ✗ | return 0; | |
| 27984 | |||
| 27985 | 27534 | return tmpscr[0].data[combo]; // entire combo code | |
| 27986 | 27534 | } | |
| 27987 | |||
| 27988 | 27534 | int32_t HeroClass::lookaheadflag(int32_t d2) | |
| 27989 | { | ||
| 27990 | // Helper for scrollscr that gets next combo on next screen. | ||
| 27991 | // Can use destscr for scrolling warps, | ||
| 27992 | // but assumes currmap is correct. | ||
| 27993 | |||
| 27994 | 27534 | int32_t cx = vbound(x,0_zf,240_zf); | |
| 27995 | 27534 | int32_t cy = vbound(y + 8,0_zf,160_zf); | |
| 27996 | |||
| 27997 | //bound(cx, 0, 240); //Fix crash during screen scroll when Hero is moving too quickly through a corner - DarkDragon | ||
| 27998 | //bound(cy, 0, 168); //Fix crash during screen scroll when Hero is moving too quickly through a corner - DarkDragon | ||
| 27999 | //y+8 could be 168 //Attempt to fix a frash where scrolling through the lower-left corner could crassh ZC as reported by Lut. -Z | ||
| 28000 | //Applying this here, too. -Z | ||
| 28001 | |||
| 28002 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 8002 times.
✓ Branch 2 taken 5871 times.
✓ Branch 3 taken 6412 times.
✓ Branch 4 taken 7249 times.
|
27534 | switch(d2) |
| 28003 | { | ||
| 28004 | case up: | ||
| 28005 | 8002 | cy=160; | |
| 28006 | 8002 | break; | |
| 28007 | |||
| 28008 | case down: | ||
| 28009 | 5871 | cy=0; | |
| 28010 | 5871 | break; | |
| 28011 | |||
| 28012 | case left: | ||
| 28013 | 6412 | cx=240; | |
| 28014 | 6412 | break; | |
| 28015 | |||
| 28016 | case right: | ||
| 28017 | 7249 | cx=0; | |
| 28018 | 7249 | break; | |
| 28019 | } | ||
| 28020 | |||
| 28021 | 27534 | int32_t combo = (cy&0xF0)+(cx>>4); | |
| 28022 | |||
| 28023 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27534 times.
|
27534 | if(combo>175) |
| 28024 | ✗ | return 0; | |
| 28025 | |||
| 28026 |
2/2✓ Branch 0 taken 26671 times.
✓ Branch 1 taken 863 times.
|
27534 | if(!tmpscr[0].sflag[combo]) |
| 28027 | { | ||
| 28028 | 26671 | return combobuf[tmpscr[0].data[combo]].flag; // flag | |
| 28029 | } | ||
| 28030 | |||
| 28031 | 863 | return tmpscr[0].sflag[combo]; // flag | |
| 28032 | 27534 | } | |
| 28033 | |||
| 28034 | 3213147 | void HeroClass::run_scrolling_script_int(bool waitdraw) | |
| 28035 | { | ||
| 28036 |
2/2✓ Branch 0 taken 1605744 times.
✓ Branch 1 taken 1607403 times.
|
3213147 | if(waitdraw) |
| 28037 | { | ||
| 28038 |
3/4✓ Branch 0 taken 1605744 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1129664 times.
✓ Branch 3 taken 476080 times.
|
1605744 | if ((!( FFCore.system_suspend[susptGLOBALGAME] )) && FFCore.waitdraw(ScriptType::Global, GLOBAL_SCRIPT_GAME)) |
| 28039 | { | ||
| 28040 | 476080 | ZScriptVersion::RunScript(ScriptType::Global, GLOBAL_SCRIPT_GAME, GLOBAL_SCRIPT_GAME); | |
| 28041 | 476080 | FFCore.waitdraw(ScriptType::Global, GLOBAL_SCRIPT_GAME) = false; | |
| 28042 | 476080 | } | |
| 28043 | 1605744 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_GLOBAL_WAITDRAW); | |
| 28044 |
5/6✓ Branch 0 taken 1605087 times.
✓ Branch 1 taken 657 times.
✓ Branch 2 taken 35905 times.
✓ Branch 3 taken 1569182 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 35905 times.
|
1605744 | if ( (!( FFCore.system_suspend[susptHEROACTIVE] )) && FFCore.waitdraw(ScriptType::Player) && FFCore.getQuestHeaderInfo(vZelda) >= 0x255 ) |
| 28045 | { | ||
| 28046 | 35905 | ZScriptVersion::RunScript(ScriptType::Player, SCRIPT_PLAYER_ACTIVE); | |
| 28047 | 35905 | FFCore.waitdraw(ScriptType::Player) = false; | |
| 28048 | 35905 | } | |
| 28049 | 1605744 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_PLAYER_WAITDRAW); | |
| 28050 |
4/6✓ Branch 0 taken 1605744 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1989 times.
✓ Branch 3 taken 1603755 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1989 times.
|
1605744 | if ( (!( FFCore.system_suspend[susptDMAPSCRIPT] )) && FFCore.waitdraw(ScriptType::DMap) && FFCore.getQuestHeaderInfo(vZelda) >= 0x255 ) |
| 28051 | { | ||
| 28052 | 1989 | ZScriptVersion::RunScript(ScriptType::DMap, DMaps[currdmap].script,currdmap); | |
| 28053 | 1989 | FFCore.waitdraw(ScriptType::DMap) = false; | |
| 28054 | 1989 | } | |
| 28055 | 1605744 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_DMAPDATA_ACTIVE_WAITDRAW); | |
| 28056 |
2/6✓ Branch 0 taken 1605744 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1605744 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1605744 | if ( (!( FFCore.system_suspend[susptDMAPSCRIPT] )) && FFCore.waitdraw(ScriptType::ScriptedPassiveSubscreen) && FFCore.getQuestHeaderInfo(vZelda) >= 0x255 ) |
| 28057 | { | ||
| 28058 | ✗ | ZScriptVersion::RunScript(ScriptType::ScriptedPassiveSubscreen, DMaps[currdmap].passive_sub_script,currdmap); | |
| 28059 | ✗ | FFCore.waitdraw(ScriptType::ScriptedPassiveSubscreen) = false; | |
| 28060 | ✗ | } | |
| 28061 | 1605744 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_DMAPDATA_PASSIVESUBSCREEN_WAITDRAW); | |
| 28062 |
5/10✓ Branch 0 taken 1605154 times.
✓ Branch 1 taken 590 times.
✓ Branch 2 taken 1976 times.
✓ Branch 3 taken 1603178 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1976 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
1605744 | if ( (!( FFCore.system_suspend[susptSCREENSCRIPTS] )) && tmpscr->script != 0 && FFCore.waitdraw(ScriptType::Screen, currscr) && tmpscr->preloadscript && FFCore.getQuestHeaderInfo(vZelda) >= 0x255 ) |
| 28063 | { | ||
| 28064 | ✗ | ZScriptVersion::RunScript(ScriptType::Screen, tmpscr->script, currscr); | |
| 28065 | ✗ | FFCore.waitdraw(ScriptType::Screen, currscr) = 0; | |
| 28066 | ✗ | } | |
| 28067 | 1605744 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_SCREEN_WAITDRAW); | |
| 28068 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1605744 times.
|
1605744 | if ( !FFCore.system_suspend[susptITEMSCRIPTENGINE] ) |
| 28069 | { | ||
| 28070 | 1605744 | FFCore.itemScriptEngineOnWaitdraw(); | |
| 28071 | 1605744 | } | |
| 28072 | 1605744 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_ITEM_WAITDRAW); | |
| 28073 | 1605744 | } | |
| 28074 | else | ||
| 28075 | { | ||
| 28076 |
7/8✓ Branch 0 taken 1606813 times.
✓ Branch 1 taken 590 times.
✓ Branch 2 taken 2012 times.
✓ Branch 3 taken 1604801 times.
✓ Branch 4 taken 987 times.
✓ Branch 5 taken 1025 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 987 times.
|
1607403 | if ( (!( FFCore.system_suspend[susptSCREENSCRIPTS] )) && tmpscr->script != 0 && tmpscr->preloadscript && FFCore.getQuestHeaderInfo(vZelda) >= 0x255 ) |
| 28077 | { | ||
| 28078 | 987 | ZScriptVersion::RunScript(ScriptType::Screen, tmpscr->script, currscr); | |
| 28079 | 987 | } | |
| 28080 | 1607403 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_FFCS); | |
| 28081 |
3/4✓ Branch 0 taken 1607403 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 528393 times.
✓ Branch 3 taken 1079010 times.
|
1607403 | if ((!( FFCore.system_suspend[susptGLOBALGAME] )) && FFCore.doscript(ScriptType::Global, GLOBAL_SCRIPT_GAME)) |
| 28082 | { | ||
| 28083 | 528393 | ZScriptVersion::RunScript(ScriptType::Global, GLOBAL_SCRIPT_GAME, GLOBAL_SCRIPT_GAME); | |
| 28084 | 528393 | } | |
| 28085 | 1607403 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_GLOBAL_ACTIVE); | |
| 28086 |
6/6✓ Branch 0 taken 1606745 times.
✓ Branch 1 taken 658 times.
✓ Branch 2 taken 1545217 times.
✓ Branch 3 taken 61528 times.
✓ Branch 4 taken 1508839 times.
✓ Branch 5 taken 36378 times.
|
1607403 | if ((!( FFCore.system_suspend[susptHEROACTIVE] )) && FFCore.doscript(ScriptType::Player) && FFCore.getQuestHeaderInfo(vZelda) >= 0x255) |
| 28087 | { | ||
| 28088 | 36378 | ZScriptVersion::RunScript(ScriptType::Player, SCRIPT_PLAYER_ACTIVE); | |
| 28089 | 36378 | } | |
| 28090 | 1607403 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_PLAYER_ACTIVE); | |
| 28091 |
5/6✓ Branch 0 taken 1607403 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1606811 times.
✓ Branch 3 taken 592 times.
✓ Branch 4 taken 1508839 times.
✓ Branch 5 taken 97972 times.
|
1607403 | if ( (!( FFCore.system_suspend[susptDMAPSCRIPT] )) && FFCore.doscript(ScriptType::DMap) && FFCore.getQuestHeaderInfo(vZelda) >= 0x255 ) |
| 28092 | { | ||
| 28093 | 97972 | ZScriptVersion::RunScript(ScriptType::DMap, DMaps[currdmap].script,currdmap); | |
| 28094 | 97972 | } | |
| 28095 | 1607403 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_DMAPDATA_ACTIVE); | |
| 28096 |
4/6✓ Branch 0 taken 1607403 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1607403 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1508839 times.
✓ Branch 5 taken 98564 times.
|
1607403 | if ( (!( FFCore.system_suspend[susptDMAPSCRIPT] )) && FFCore.doscript(ScriptType::ScriptedPassiveSubscreen) && FFCore.getQuestHeaderInfo(vZelda) >= 0x255 ) |
| 28097 | { | ||
| 28098 | 98564 | ZScriptVersion::RunScript(ScriptType::ScriptedPassiveSubscreen, DMaps[currdmap].passive_sub_script,currdmap); | |
| 28099 | 98564 | } | |
| 28100 | 1607403 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_DMAPDATA_PASSIVESUBSCREEN); | |
| 28101 | 1607403 | bool old = get_qr(qr_OLD_ITEMDATA_SCRIPT_TIMING); | |
| 28102 |
3/4✓ Branch 0 taken 1607403 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 54798 times.
✓ Branch 3 taken 1552605 times.
|
1607403 | if(!FFCore.system_suspend[susptITEMSCRIPTENGINE] && old) |
| 28103 | 1552605 | FFCore.itemScriptEngine(); | |
| 28104 | 1607403 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_OLD_ITEMDATA_SCRIPT); | |
| 28105 |
3/4✓ Branch 0 taken 1607403 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1552605 times.
✓ Branch 3 taken 54798 times.
|
1607403 | if(!FFCore.system_suspend[susptITEMSCRIPTENGINE] && !old) |
| 28106 | 54798 | FFCore.itemScriptEngine(); | |
| 28107 | } | ||
| 28108 | 3213147 | } | |
| 28109 | //Bit of a messy kludge to give the correct Hero->X/Hero->Y in the script | ||
| 28110 | 3213147 | void HeroClass::run_scrolling_script(int32_t scrolldir, int32_t cx, int32_t sx, int32_t sy, bool end_frames, bool waitdraw) | |
| 28111 | { | ||
| 28112 | // For rafting (and possibly other esoteric things) | ||
| 28113 | // Hero's action should remain unchanged while scrolling, | ||
| 28114 | // but for the sake of scripts, here's an eye-watering kludge. | ||
| 28115 | 3213147 | actiontype lastaction = action; | |
| 28116 | 3213147 | action=scrolling; FFCore.setHeroAction(scrolling); | |
| 28117 |
2/2✓ Branch 0 taken 1605744 times.
✓ Branch 1 taken 1607403 times.
|
3213147 | if(waitdraw) |
| 28118 | { | ||
| 28119 | 1605744 | FFCore.runGenericPassiveEngine(SCR_TIMING_WAITDRAW); | |
| 28120 | 1605744 | } | |
| 28121 | else | ||
| 28122 | { | ||
| 28123 | 1607403 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_FFCS-1); | |
| 28124 | } | ||
| 28125 | 3213147 | zfix storex = x, storey = y; | |
| 28126 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 807926 times.
✓ Branch 2 taken 580781 times.
✓ Branch 3 taken 853654 times.
✓ Branch 4 taken 970786 times.
|
3213147 | switch(scrolldir) |
| 28127 | { | ||
| 28128 | case up: | ||
| 28129 |
2/2✓ Branch 0 taken 660080 times.
✓ Branch 1 taken 147846 times.
|
807926 | if(y < 160) y = 176; |
| 28130 |
4/4✓ Branch 0 taken 123891 times.
✓ Branch 1 taken 23955 times.
✓ Branch 2 taken 52619 times.
✓ Branch 3 taken 71272 times.
|
147846 | else if(cx > 0 && !end_frames) y = sy + 156; |
| 28131 | 76574 | else y = 160; | |
| 28132 | |||
| 28133 | 807926 | break; | |
| 28134 | |||
| 28135 | case down: | ||
| 28136 |
2/2✓ Branch 0 taken 472869 times.
✓ Branch 1 taken 107912 times.
|
580781 | if(y > 0) y = -16; |
| 28137 |
4/4✓ Branch 0 taken 90117 times.
✓ Branch 1 taken 17795 times.
✓ Branch 2 taken 39732 times.
✓ Branch 3 taken 50385 times.
|
107912 | else if(cx > 0 && !end_frames) y = sy - 172; |
| 28138 | 57527 | else y = 0; | |
| 28139 | |||
| 28140 | 580781 | break; | |
| 28141 | |||
| 28142 | case left: | ||
| 28143 |
2/2✓ Branch 0 taken 782451 times.
✓ Branch 1 taken 71203 times.
|
853654 | if(x < 240) x = 256; |
| 28144 |
2/2✓ Branch 0 taken 57973 times.
✓ Branch 1 taken 13230 times.
|
71203 | else if(cx > 0) x = sx + 236; |
| 28145 | 13230 | else x = 240; | |
| 28146 | |||
| 28147 | 853654 | break; | |
| 28148 | |||
| 28149 | case right: | ||
| 28150 |
2/2✓ Branch 0 taken 890029 times.
✓ Branch 1 taken 80757 times.
|
970786 | if(x > 0) x = -16; |
| 28151 |
2/2✓ Branch 0 taken 65824 times.
✓ Branch 1 taken 14933 times.
|
80757 | else if(cx > 0) x = sx - 252; |
| 28152 | 14933 | else x = 0; | |
| 28153 | |||
| 28154 | 970786 | break; | |
| 28155 | } | ||
| 28156 | 3213147 | run_scrolling_script_int(waitdraw); | |
| 28157 | |||
| 28158 | 3213147 | x = storex, y = storey; | |
| 28159 | |||
| 28160 | 3213147 | action=lastaction; FFCore.setHeroAction(lastaction); | |
| 28161 | 3213147 | } | |
| 28162 | |||
| 28163 | //Has solving the maze enabled a side warp? | ||
| 28164 | //Only used just before scrolling screens | ||
| 28165 | // Note: since scrollscr() calls this, and dowarp() calls scrollscr(), | ||
| 28166 | // return true to abort the topmost scrollscr() call. -L | ||
| 28167 | 27534 | bool HeroClass::maze_enabled_sizewarp(int32_t scrolldir) | |
| 28168 | { | ||
| 28169 |
2/2✓ Branch 0 taken 82602 times.
✓ Branch 1 taken 27534 times.
|
110136 | for(int32_t i = 0; i < 3; i++) lastdir[i] = lastdir[i+1]; |
| 28170 | |||
| 28171 |
2/2✓ Branch 0 taken 222 times.
✓ Branch 1 taken 27312 times.
|
27534 | lastdir[3] = tmpscr->flags&fMAZE ? scrolldir : 0xFF; |
| 28172 | |||
| 28173 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 27534 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
27534 | if(tmpscr->flags8&fMAZEvSIDEWARP && tmpscr->flags&fMAZE && scrolldir != tmpscr->exitdir) |
| 28174 | { | ||
| 28175 | ✗ | switch(scrolldir) | |
| 28176 | { | ||
| 28177 | case up: | ||
| 28178 | ✗ | if(tmpscr->flags2&wfUP && checkmaze(tmpscr,true)) | |
| 28179 | { | ||
| 28180 | ✗ | lastdir[3] = 0xFF; | |
| 28181 | ✗ | sdir=up; | |
| 28182 | ✗ | dowarp(1,(tmpscr->sidewarpindex)&3); | |
| 28183 | ✗ | return true; | |
| 28184 | } | ||
| 28185 | |||
| 28186 | ✗ | break; | |
| 28187 | |||
| 28188 | case down: | ||
| 28189 | ✗ | if(tmpscr->flags2&wfDOWN && checkmaze(tmpscr,true)) | |
| 28190 | { | ||
| 28191 | ✗ | lastdir[3] = 0xFF; | |
| 28192 | ✗ | sdir=down; | |
| 28193 | ✗ | dowarp(1,(tmpscr->sidewarpindex>>2)&3); | |
| 28194 | ✗ | return true; | |
| 28195 | } | ||
| 28196 | |||
| 28197 | ✗ | break; | |
| 28198 | |||
| 28199 | case left: | ||
| 28200 | ✗ | if(tmpscr->flags2&wfLEFT && checkmaze(tmpscr,true)) | |
| 28201 | { | ||
| 28202 | ✗ | lastdir[3] = 0xFF; | |
| 28203 | ✗ | sdir=left; | |
| 28204 | ✗ | dowarp(1,(tmpscr->sidewarpindex>>4)&3); | |
| 28205 | ✗ | return true; | |
| 28206 | } | ||
| 28207 | |||
| 28208 | ✗ | break; | |
| 28209 | |||
| 28210 | case right: | ||
| 28211 | ✗ | if(tmpscr->flags2&wfRIGHT && checkmaze(tmpscr,true)) | |
| 28212 | { | ||
| 28213 | ✗ | lastdir[3] = 0xFF; | |
| 28214 | ✗ | sdir=right; | |
| 28215 | ✗ | dowarp(1,(tmpscr->sidewarpindex)&3); | |
| 28216 | ✗ | return true; | |
| 28217 | } | ||
| 28218 | |||
| 28219 | ✗ | break; | |
| 28220 | } | ||
| 28221 | ✗ | } | |
| 28222 | |||
| 28223 | 27534 | return false; | |
| 28224 | 27534 | } | |
| 28225 | |||
| 28226 | 27534 | int32_t HeroClass::get_scroll_step(int32_t scrolldir) | |
| 28227 | { | ||
| 28228 | // For side-scrollers, where the relative speed of 'fast' scrolling is a bit slow. | ||
| 28229 |
2/2✓ Branch 0 taken 2578 times.
✓ Branch 1 taken 24956 times.
|
27534 | if(get_qr(qr_VERYFASTSCROLLING)) |
| 28230 | 2578 | return 16; | |
| 28231 | |||
| 28232 |
2/2✓ Branch 0 taken 23500 times.
✓ Branch 1 taken 1456 times.
|
24956 | if(get_qr(qr_SMOOTHVERTICALSCROLLING) != 0) |
| 28233 | { | ||
| 28234 |
2/2✓ Branch 0 taken 15514 times.
✓ Branch 1 taken 7986 times.
|
23500 | return (isdungeon() && !get_qr(qr_FASTDNGN)) ? 2 : 4; |
| 28235 | } | ||
| 28236 | else | ||
| 28237 | { | ||
| 28238 |
4/4✓ Branch 0 taken 971 times.
✓ Branch 1 taken 485 times.
✓ Branch 2 taken 195 times.
✓ Branch 3 taken 776 times.
|
1456 | if(scrolldir == up || scrolldir == down) |
| 28239 | { | ||
| 28240 | 680 | return 8; | |
| 28241 | } | ||
| 28242 | else | ||
| 28243 | { | ||
| 28244 |
2/2✓ Branch 0 taken 341 times.
✓ Branch 1 taken 435 times.
|
776 | return (isdungeon() && !get_qr(qr_FASTDNGN)) ? 2 : 4; |
| 28245 | } | ||
| 28246 | } | ||
| 28247 | 27534 | } | |
| 28248 | |||
| 28249 | 27534 | int32_t HeroClass::get_scroll_delay(int32_t scrolldir) | |
| 28250 | { | ||
| 28251 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27534 times.
|
27534 | if(get_qr(qr_NOSCROLL)) |
| 28252 | ✗ | return 0; | |
| 28253 | |||
| 28254 |
4/4✓ Branch 0 taken 24956 times.
✓ Branch 1 taken 2578 times.
✓ Branch 2 taken 23500 times.
✓ Branch 3 taken 1456 times.
|
27534 | if( (get_qr(qr_VERYFASTSCROLLING) != 0) || |
| 28255 | 24956 | (get_qr(qr_SMOOTHVERTICALSCROLLING) != 0) ) | |
| 28256 | { | ||
| 28257 | 26078 | return 1; | |
| 28258 | } | ||
| 28259 | else | ||
| 28260 | { | ||
| 28261 |
4/4✓ Branch 0 taken 971 times.
✓ Branch 1 taken 485 times.
✓ Branch 2 taken 195 times.
✓ Branch 3 taken 776 times.
|
1456 | if(scrolldir == up || scrolldir == down) |
| 28262 | { | ||
| 28263 |
2/2✓ Branch 0 taken 359 times.
✓ Branch 1 taken 321 times.
|
680 | return (isdungeon() && !get_qr(qr_FASTDNGN)) ? 4 : 2; |
| 28264 | } | ||
| 28265 | else | ||
| 28266 | { | ||
| 28267 | 776 | return 1; | |
| 28268 | } | ||
| 28269 | } | ||
| 28270 | 27534 | } | |
| 28271 | |||
| 28272 | 249483 | void HeroClass::calc_darkroom_hero(int32_t x1, int32_t y1, int32_t x2, int32_t y2) | |
| 28273 | { | ||
| 28274 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 249483 times.
|
249483 | if(!get_qr(qr_NEW_DARKROOM)) return; |
| 28275 | 249483 | int32_t lampid = current_item_id(itype_lantern); | |
| 28276 |
2/2✓ Branch 0 taken 248624 times.
✓ Branch 1 taken 859 times.
|
249483 | if(lampid < 0) return; |
| 28277 |
2/4✓ Branch 0 taken 248624 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 248624 times.
✗ Branch 3 not taken.
|
248624 | if(!(checkbunny(lampid) && checkmagiccost(lampid,lamp_paid))) |
| 28278 | { | ||
| 28279 | ✗ | lamp_paid = false; | |
| 28280 | ✗ | return; | |
| 28281 | } | ||
| 28282 | 248624 | lamp_paid = true; | |
| 28283 | 248624 | paymagiccost(lampid,false,true); | |
| 28284 | 248624 | int32_t hx1 = x.getInt() - x1 + 8; | |
| 28285 | 248624 | int32_t hy1 = y.getInt() - y1 + 8; | |
| 28286 | 248624 | int32_t hx2 = x.getInt() - x2 + 8; | |
| 28287 | 248624 | int32_t hy2 = y.getInt() - y2 + 8; | |
| 28288 | |||
| 28289 | 248624 | itemdata& lamp = itemsbuf[lampid]; | |
| 28290 | 248624 | handle_lighting(hx1,hy1,lamp.misc1,lamp.misc2,dir,darkscr_bmp_curscr); | |
| 28291 | 248624 | handle_lighting(hx2,hy2,lamp.misc1,lamp.misc2,dir,darkscr_bmp_scrollscr); | |
| 28292 | 249483 | } | |
| 28293 | |||
| 28294 | 27534 | void HeroClass::scrollscr(int32_t scrolldir, int32_t destscr, int32_t destdmap) | |
| 28295 | { | ||
| 28296 |
2/4✓ Branch 0 taken 27534 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 27534 times.
|
27534 | if(action==freeze||action==sideswimfreeze) |
| 28297 | { | ||
| 28298 | ✗ | return; | |
| 28299 | } | ||
| 28300 | |||
| 28301 | 27534 | bool overlay = false; | |
| 28302 | |||
| 28303 |
2/4✓ Branch 0 taken 27534 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 27534 times.
|
27534 | if(scrolldir >= 0 && scrolldir <= 3) |
| 28304 | { | ||
| 28305 | 27534 | overlay = get_bit(&tmpscr[(currscr < 128) ? 0 : 1].sidewarpoverlayflags, scrolldir) ? true : false; | |
| 28306 | 27534 | } | |
| 28307 | |||
| 28308 | 27534 | bool updatemusic = FFCore.can_dmap_change_music(destdmap); | |
| 28309 | 27534 | bool musicrevert = FFCore.music_update_flags & MUSIC_UPDATE_FLAG_REVERT; | |
| 28310 | |||
| 28311 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27534 times.
|
27534 | if(maze_enabled_sizewarp(scrolldir)) // dowarp() was called |
| 28312 | ✗ | return; | |
| 28313 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 27534 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
27534 | bool isForceFaceUp = getOnSideviewLadder() && canSideviewLadder() && |
| 28314 | ✗ | !(jumping<0 || fall!=0 || fakefall!=0) && get_qr(qr_SIDEVIEWLADDER_FACEUP); | |
| 28315 | 27534 | bool room_was_dark = room_is_dark; | |
| 28316 |
1/2✓ Branch 0 taken 27534 times.
✗ Branch 1 not taken.
|
27534 | if(isForceFaceUp) dir = up; |
| 28317 | 27534 | kill_enemy_sfx(); | |
| 28318 | 27534 | stop_sfx(QMisc.miscsfx[sfxLOWHEART]); | |
| 28319 | 27534 | screenscrolling = true; | |
| 28320 | 27534 | FFCore.ScrollingData[SCROLLDATA_DIR] = scrolldir; | |
| 28321 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 8002 times.
✓ Branch 2 taken 5871 times.
✓ Branch 3 taken 6412 times.
✓ Branch 4 taken 7249 times.
|
27534 | switch(scrolldir) |
| 28322 | { | ||
| 28323 | case up: | ||
| 28324 | 8002 | FFCore.ScrollingData[SCROLLDATA_NX] = 0; | |
| 28325 | 8002 | FFCore.ScrollingData[SCROLLDATA_NY] = -176; | |
| 28326 | 8002 | FFCore.ScrollingData[SCROLLDATA_OX] = 0; | |
| 28327 | 8002 | FFCore.ScrollingData[SCROLLDATA_OY] = 0; | |
| 28328 | 8002 | break; | |
| 28329 | case down: | ||
| 28330 | 5871 | FFCore.ScrollingData[SCROLLDATA_NX] = 0; | |
| 28331 | 5871 | FFCore.ScrollingData[SCROLLDATA_NY] = 176; | |
| 28332 | 5871 | FFCore.ScrollingData[SCROLLDATA_OX] = 0; | |
| 28333 | 5871 | FFCore.ScrollingData[SCROLLDATA_OY] = 0; | |
| 28334 | 5871 | break; | |
| 28335 | case left: | ||
| 28336 | 6412 | FFCore.ScrollingData[SCROLLDATA_NX] = -256; | |
| 28337 | 6412 | FFCore.ScrollingData[SCROLLDATA_NY] = 0; | |
| 28338 | 6412 | FFCore.ScrollingData[SCROLLDATA_OX] = 0; | |
| 28339 | 6412 | FFCore.ScrollingData[SCROLLDATA_OY] = 0; | |
| 28340 | 6412 | break; | |
| 28341 | case right: | ||
| 28342 | 7249 | FFCore.ScrollingData[SCROLLDATA_NX] = 256; | |
| 28343 | 7249 | FFCore.ScrollingData[SCROLLDATA_NY] = 0; | |
| 28344 | 7249 | FFCore.ScrollingData[SCROLLDATA_OX] = 0; | |
| 28345 | 7249 | FFCore.ScrollingData[SCROLLDATA_OY] = 0; | |
| 28346 | 7249 | break; | |
| 28347 | } | ||
| 28348 | 27534 | FFCore.clear_combo_scripts(); | |
| 28349 | 27534 | tmpscr[1] = tmpscr[0]; | |
| 28350 | |||
| 28351 |
2/2✓ Branch 0 taken 165204 times.
✓ Branch 1 taken 27534 times.
|
192738 | for(int32_t i = 0; i < 6; i++) |
| 28352 | { | ||
| 28353 | 165204 | tmpscr3[i] = tmpscr2[i]; | |
| 28354 | 165204 | } | |
| 28355 | |||
| 28356 | 27534 | conveyclk = 2; | |
| 28357 | |||
| 28358 | 27534 | mapscr *newscr = &tmpscr[0]; | |
| 28359 | 27534 | mapscr *oldscr = &tmpscr[1]; | |
| 28360 | |||
| 28361 | //scroll x, scroll y, old screen x, old screen y, new screen x, new screen y | ||
| 28362 | 27534 | int32_t sx = 0, sy = 0, tx = 0, ty = 0, tx2 = 0, ty2 = 0; | |
| 28363 | 27534 | int32_t cx = 0; | |
| 28364 | 27534 | int32_t step = get_scroll_step(scrolldir); | |
| 28365 | 27534 | int32_t delay = get_scroll_delay(scrolldir); | |
| 28366 | 27534 | bool end_frames = false; | |
| 28367 | |||
| 28368 | 27534 | int32_t scx = get_qr(qr_FASTDNGN) ? 30 : 0; | |
| 28369 |
2/2✓ Branch 0 taken 24956 times.
✓ Branch 1 taken 2578 times.
|
27534 | if(get_qr(qr_VERYFASTSCROLLING)) //just a minor adjustment. |
| 28370 | 2578 | scx = 32; //for sideview very fast screolling. | |
| 28371 | |||
| 28372 | |||
| 28373 | 27534 | int32_t lastattackclk = attackclk, lastspins = spins, lastcharging = charging; bool lasttapping = tapping; | |
| 28374 | 27534 | actiontype lastaction = action; | |
| 28375 | 27534 | ALLOFF(false, false); | |
| 28376 | // for now, restore Hero's previous action | ||
| 28377 |
2/2✓ Branch 0 taken 25835 times.
✓ Branch 1 taken 1699 times.
|
27534 | if(!get_qr(qr_SCROLLING_KILLS_CHARGE)) |
| 28378 | 1699 | charging = lastcharging; | |
| 28379 |
2/2✓ Branch 0 taken 9096 times.
✓ Branch 1 taken 18438 times.
|
27534 | if (replay_version_check(0, 28)) |
| 28380 | { | ||
| 28381 | // nargads_trail_crystal_crusades replay tests need this. | ||
| 28382 |
2/2✓ Branch 0 taken 18222 times.
✓ Branch 1 taken 216 times.
|
18438 | if(!get_qr(qr_SCROLLING_KILLS_CHARGE)) attackclk = lastattackclk; |
| 28383 | 18438 | spins = lastspins; charging = lastcharging; tapping = lasttapping; | |
| 28384 | 18438 | } | |
| 28385 | |||
| 28386 | 27534 | action=lastaction; FFCore.setHeroAction(lastaction); | |
| 28387 | |||
| 28388 | 27534 | lstep = (lstep + 6) % 12; | |
| 28389 | 27534 | cx = scx; | |
| 28390 | 27534 | FFCore.runGenericPassiveEngine(SCR_TIMING_WAITDRAW); | |
| 28391 |
3/4✓ Branch 0 taken 27534 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 18187 times.
✓ Branch 3 taken 9347 times.
|
27534 | if((!( FFCore.system_suspend[susptGLOBALGAME] )) && FFCore.waitdraw(ScriptType::Global, GLOBAL_SCRIPT_GAME)) |
| 28392 | { | ||
| 28393 | 9347 | ZScriptVersion::RunScript(ScriptType::Global, GLOBAL_SCRIPT_GAME, GLOBAL_SCRIPT_GAME); | |
| 28394 | 9347 | FFCore.waitdraw(ScriptType::Global, GLOBAL_SCRIPT_GAME) = false; | |
| 28395 | 9347 | } | |
| 28396 | 27534 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_GLOBAL_WAITDRAW); | |
| 28397 |
5/6✓ Branch 0 taken 27523 times.
✓ Branch 1 taken 11 times.
✓ Branch 2 taken 883 times.
✓ Branch 3 taken 26640 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 883 times.
|
27534 | if ( (!( FFCore.system_suspend[susptHEROACTIVE] )) && FFCore.waitdraw(ScriptType::Player) && FFCore.getQuestHeaderInfo(vZelda) >= 0x255 ) |
| 28398 | { | ||
| 28399 | 883 | ZScriptVersion::RunScript(ScriptType::Player, SCRIPT_PLAYER_ACTIVE); | |
| 28400 | 883 | FFCore.waitdraw(ScriptType::Player) = false; | |
| 28401 | 883 | } | |
| 28402 | 27534 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_PLAYER_WAITDRAW); | |
| 28403 |
4/6✓ Branch 0 taken 27534 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
✓ Branch 3 taken 27498 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 36 times.
|
27534 | if ( (!( FFCore.system_suspend[susptDMAPSCRIPT] )) && FFCore.waitdraw(ScriptType::DMap) && FFCore.getQuestHeaderInfo(vZelda) >= 0x255 ) |
| 28404 | { | ||
| 28405 | 36 | ZScriptVersion::RunScript(ScriptType::DMap, DMaps[currdmap].script,currdmap); | |
| 28406 | 36 | FFCore.waitdraw(ScriptType::DMap) = false; | |
| 28407 | 36 | } | |
| 28408 | 27534 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_DMAPDATA_ACTIVE_WAITDRAW); | |
| 28409 |
2/6✓ Branch 0 taken 27534 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 27534 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
27534 | if ( (!( FFCore.system_suspend[susptDMAPSCRIPT] )) && FFCore.waitdraw(ScriptType::ScriptedPassiveSubscreen) && FFCore.getQuestHeaderInfo(vZelda) >= 0x255 ) |
| 28410 | { | ||
| 28411 | ✗ | ZScriptVersion::RunScript(ScriptType::ScriptedPassiveSubscreen, DMaps[currdmap].passive_sub_script,currdmap); | |
| 28412 | ✗ | FFCore.waitdraw(ScriptType::ScriptedPassiveSubscreen) = false; | |
| 28413 | ✗ | } | |
| 28414 | 27534 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_DMAPDATA_PASSIVESUBSCREEN_WAITDRAW); | |
| 28415 |
7/8✓ Branch 0 taken 27524 times.
✓ Branch 1 taken 10 times.
✓ Branch 2 taken 17 times.
✓ Branch 3 taken 27507 times.
✓ Branch 4 taken 6 times.
✓ Branch 5 taken 11 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 6 times.
|
27534 | if ( (!( FFCore.system_suspend[susptSCREENSCRIPTS] )) && tmpscr->script != 0 && FFCore.waitdraw(ScriptType::Screen, currscr) && FFCore.getQuestHeaderInfo(vZelda) >= 0x255 ) |
| 28416 | { | ||
| 28417 | 6 | ZScriptVersion::RunScript(ScriptType::Screen, tmpscr->script, currscr); | |
| 28418 | 6 | FFCore.waitdraw(ScriptType::Screen, currscr) = 0; | |
| 28419 | 6 | } | |
| 28420 | 27534 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_SCREEN_WAITDRAW); | |
| 28421 | |||
| 28422 | 27534 | word c = tmpscr->numFFC(); | |
| 28423 |
2/2✓ Branch 0 taken 823958 times.
✓ Branch 1 taken 27534 times.
|
851492 | for ( word q = 0; q < c; ++q ) |
| 28424 | { | ||
| 28425 |
1/2✓ Branch 0 taken 823958 times.
✗ Branch 1 not taken.
|
823958 | if (FFCore.waitdraw(ScriptType::FFC, q)) |
| 28426 | { | ||
| 28427 | ✗ | if(tmpscr->ffcs[q].script != 0) | |
| 28428 | { | ||
| 28429 | ✗ | ZScriptVersion::RunScript(ScriptType::FFC, tmpscr->ffcs[q].script, q); | |
| 28430 | ✗ | FFCore.waitdraw(ScriptType::FFC, q) = false; | |
| 28431 | ✗ | } | |
| 28432 | ✗ | } | |
| 28433 | 823958 | } | |
| 28434 | 27534 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_FFC_WAITDRAW); | |
| 28435 | 27534 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_COMBO_WAITDRAW); | |
| 28436 | //Waitdraw for item scripts. | ||
| 28437 | 27534 | FFCore.itemScriptEngineOnWaitdraw(); | |
| 28438 | 27534 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_ITEM_WAITDRAW); | |
| 28439 | 27534 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_NPC_WAITDRAW); | |
| 28440 | |||
| 28441 | //Sprite scripts on Waitdraw | ||
| 28442 | 27534 | FFCore.eweaponScriptEngineOnWaitdraw(); | |
| 28443 | 27534 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_EWPN_WAITDRAW); | |
| 28444 | 27534 | FFCore.itemSpriteScriptEngineOnWaitdraw(); | |
| 28445 | 27534 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_ITEMSPRITE_WAITDRAW); | |
| 28446 | |||
| 28447 | //This is no longer a do-while, as the first iteration is now slightly different. -Em | ||
| 28448 | 27534 | draw_screen(tmpscr,true,true); | |
| 28449 | |||
| 28450 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27534 times.
|
27534 | if(cx == scx) |
| 28451 | 27534 | rehydratelake(false); | |
| 28452 | |||
| 28453 | 27534 | FFCore.runGenericPassiveEngine(SCR_TIMING_END_FRAME); | |
| 28454 | 27534 | advanceframe(true); | |
| 28455 | |||
| 28456 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27534 times.
|
27534 | if(Quit) |
| 28457 | { | ||
| 28458 | ✗ | screenscrolling = false; | |
| 28459 | ✗ | return; | |
| 28460 | } | ||
| 28461 | |||
| 28462 | 27534 | ++cx; | |
| 28463 |
2/2✓ Branch 0 taken 138596 times.
✓ Branch 1 taken 27534 times.
|
166130 | while(cx < 32) |
| 28464 | { | ||
| 28465 |
1/2✓ Branch 0 taken 138596 times.
✗ Branch 1 not taken.
|
138596 | if(isForceFaceUp) dir = up; |
| 28466 |
2/2✓ Branch 0 taken 558 times.
✓ Branch 1 taken 138038 times.
|
138596 | if(get_qr(qr_FIXSCRIPTSDURINGSCROLLING)) |
| 28467 | { | ||
| 28468 | 558 | script_drawing_commands.Clear(); | |
| 28469 | 558 | FFCore.runGenericPassiveEngine(SCR_TIMING_START_FRAME); | |
| 28470 | 558 | ZScriptVersion::RunScrollingScript(scrolldir, cx, sx, sy, end_frames, false); //Prewaitdraw | |
| 28471 | 558 | ZScriptVersion::RunScrollingScript(scrolldir, cx, sx, sy, end_frames, true); //Waitdraw | |
| 28472 | 558 | } | |
| 28473 | 138038 | else FFCore.runGenericPassiveEngine(SCR_TIMING_START_FRAME); | |
| 28474 | 138596 | draw_screen(tmpscr,true,true); | |
| 28475 | |||
| 28476 |
1/2✓ Branch 0 taken 138596 times.
✗ Branch 1 not taken.
|
138596 | if(cx == scx) |
| 28477 | ✗ | rehydratelake(false); | |
| 28478 | |||
| 28479 | 138596 | FFCore.runGenericPassiveEngine(SCR_TIMING_END_FRAME); | |
| 28480 | 138596 | advanceframe(true); | |
| 28481 | |||
| 28482 |
1/2✓ Branch 0 taken 138596 times.
✗ Branch 1 not taken.
|
138596 | if(Quit) |
| 28483 | { | ||
| 28484 | ✗ | screenscrolling = false; | |
| 28485 | ✗ | return; | |
| 28486 | } | ||
| 28487 | |||
| 28488 | 138596 | ++cx; | |
| 28489 | } | ||
| 28490 | 27534 | script_drawing_commands.Clear(); | |
| 28491 | 27534 | FFCore.runGenericPassiveEngine(SCR_TIMING_START_FRAME); | |
| 28492 | |||
| 28493 | |||
| 28494 | //clear Hero's last hits | ||
| 28495 | //for ( int32_t q = 0; q < 4; q++ ) sethitHeroUID(q, 0); | ||
| 28496 | |||
| 28497 |
3/4✓ Branch 0 taken 12023 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6831 times.
✓ Branch 3 taken 8680 times.
|
27534 | switch(DMaps[currdmap].type&dmfTYPE) |
| 28498 | { | ||
| 28499 | case dmDNGN: | ||
| 28500 |
2/2✓ Branch 0 taken 8673 times.
✓ Branch 1 taken 7 times.
|
8680 | if(!get_qr(qr_DUNGEONS_USE_CLASSIC_CHARTING)) |
| 28501 | { | ||
| 28502 | 7 | markBmap(scrolldir); | |
| 28503 | 7 | } | |
| 28504 | 8680 | break; | |
| 28505 | case dmOVERW: case dmBSOVERW: | ||
| 28506 |
2/2✓ Branch 0 taken 11799 times.
✓ Branch 1 taken 224 times.
|
12023 | if(get_qr(qr_NO_OVERWORLD_MAP_CHARTING)) |
| 28507 | 11799 | break; | |
| 28508 | [[fallthrough]]; | ||
| 28509 | case dmCAVE: | ||
| 28510 | 7055 | markBmap(scrolldir); | |
| 28511 | 7055 | break; | |
| 28512 | } | ||
| 28513 | |||
| 28514 |
1/2✓ Branch 0 taken 27534 times.
✗ Branch 1 not taken.
|
27534 | if(fixed_door) |
| 28515 | { | ||
| 28516 | ✗ | unsetmapflag(mSECRET); | |
| 28517 | ✗ | fixed_door = false; | |
| 28518 | ✗ | } | |
| 28519 | |||
| 28520 | 27534 | playing_field_offset = original_playing_field_offset; | |
| 28521 | |||
| 28522 | 27534 | scrolling_scr = currscr; | |
| 28523 | |||
| 28524 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 8002 times.
✓ Branch 2 taken 5871 times.
✓ Branch 3 taken 6412 times.
✓ Branch 4 taken 7249 times.
|
27534 | switch(scrolldir) |
| 28525 | { | ||
| 28526 | case up: | ||
| 28527 | { | ||
| 28528 |
2/2✓ Branch 0 taken 225 times.
✓ Branch 1 taken 7777 times.
|
8002 | if(destscr != -1) |
| 28529 | 225 | currscr = destscr; | |
| 28530 |
3/4✓ Branch 0 taken 7715 times.
✓ Branch 1 taken 62 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7715 times.
|
7777 | else if(checkmaze(oldscr,true) && !edge_of_dmap(scrolldir)) |
| 28531 | 7715 | currscr -= 16; | |
| 28532 | |||
| 28533 | 8002 | loadscr(0,destdmap,currscr,scrolldir,overlay); | |
| 28534 | 8002 | blit(scrollbuf,scrollbuf,0,0,0,176,256,176); | |
| 28535 | 8002 | putscr(scrollbuf,0,0,newscr); | |
| 28536 | 8002 | putscrdoors(scrollbuf,0,0,newscr); | |
| 28537 | 8002 | sy=176; | |
| 28538 | |||
| 28539 |
2/2✓ Branch 0 taken 7517 times.
✓ Branch 1 taken 485 times.
|
8002 | if(get_qr(qr_SMOOTHVERTICALSCROLLING) == 0) |
| 28540 | 485 | sy+=3; | |
| 28541 | |||
| 28542 | 8002 | cx=176/step; | |
| 28543 | 8002 | FFCore.clear_combo_scripts(); | |
| 28544 | } | ||
| 28545 | 8002 | break; | |
| 28546 | |||
| 28547 | case down: | ||
| 28548 | { | ||
| 28549 |
2/2✓ Branch 0 taken 207 times.
✓ Branch 1 taken 5664 times.
|
5871 | if(destscr != -1) |
| 28550 | 207 | currscr = destscr; | |
| 28551 |
3/4✓ Branch 0 taken 5642 times.
✓ Branch 1 taken 22 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5642 times.
|
5664 | else if(checkmaze(oldscr,true) && !edge_of_dmap(scrolldir)) |
| 28552 | 5642 | currscr += 16; | |
| 28553 | |||
| 28554 | 5871 | loadscr(0,destdmap,currscr,scrolldir,overlay); | |
| 28555 | 5871 | putscr(scrollbuf,0,176,newscr); | |
| 28556 | 5871 | putscrdoors(scrollbuf,0,176,newscr); | |
| 28557 | 5871 | sy = 0; | |
| 28558 | |||
| 28559 |
2/2✓ Branch 0 taken 5676 times.
✓ Branch 1 taken 195 times.
|
5871 | if(get_qr(qr_SMOOTHVERTICALSCROLLING) == 0) |
| 28560 | 195 | sy+=3; | |
| 28561 | |||
| 28562 | 5871 | cx = 176 / step; | |
| 28563 | 5871 | FFCore.clear_combo_scripts(); | |
| 28564 | } | ||
| 28565 | 5871 | break; | |
| 28566 | |||
| 28567 | case left: | ||
| 28568 | { | ||
| 28569 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 6212 times.
|
6412 | if(destscr!=-1) |
| 28570 | 200 | currscr = destscr; | |
| 28571 |
3/4✓ Branch 0 taken 6179 times.
✓ Branch 1 taken 33 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6179 times.
|
6212 | else if(checkmaze(oldscr,true) && !edge_of_dmap(scrolldir)) |
| 28572 | 6179 | --currscr; | |
| 28573 | |||
| 28574 | 6412 | loadscr(0,destdmap,currscr,scrolldir,overlay); | |
| 28575 | 6412 | blit(scrollbuf,scrollbuf,0,0,256,0,256,176); | |
| 28576 | 6412 | putscr(scrollbuf,0,0,newscr); | |
| 28577 | 6412 | putscrdoors(scrollbuf,0,0,newscr); | |
| 28578 | 6412 | sx = 256; | |
| 28579 | 6412 | cx = 256 / step; | |
| 28580 | 6412 | FFCore.clear_combo_scripts(); | |
| 28581 | } | ||
| 28582 | 6412 | break; | |
| 28583 | |||
| 28584 | case right: | ||
| 28585 | { | ||
| 28586 |
2/2✓ Branch 0 taken 326 times.
✓ Branch 1 taken 6923 times.
|
7249 | if(destscr != -1) |
| 28587 | 326 | currscr = destscr; | |
| 28588 |
3/4✓ Branch 0 taken 6881 times.
✓ Branch 1 taken 42 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6881 times.
|
6923 | else if(checkmaze(oldscr,true) && !edge_of_dmap(scrolldir)) |
| 28589 | 6881 | ++currscr; | |
| 28590 | |||
| 28591 | 7249 | loadscr(0,destdmap,currscr,scrolldir,overlay); | |
| 28592 | 7249 | putscr(scrollbuf,256,0,newscr); | |
| 28593 | 7249 | putscrdoors(scrollbuf,256,0,tmpscr); | |
| 28594 | 7249 | sx = 0; | |
| 28595 | 7249 | cx = 256 / step; | |
| 28596 | 7249 | FFCore.clear_combo_scripts(); | |
| 28597 | } | ||
| 28598 | 7249 | break; | |
| 28599 | } | ||
| 28600 | |||
| 28601 | // change Hero's state if entering water | ||
| 28602 | 27534 | int32_t ahead = lookahead(scrolldir); | |
| 28603 | 27534 | int32_t aheadflag = lookaheadflag(scrolldir); | |
| 28604 | 27534 | int32_t lookaheadx = vbound(x+8,0_zf,240_zf); //var = vbound(val, n1, n2), not bound(var, n1, n2) -Z | |
| 28605 | 27534 | int32_t lookaheady = vbound(y + (bigHitbox?8:12),0_zf,160_zf); | |
| 28606 | 27534 | int32_t wateraheadx1 = vbound(x+4,0_zf,240_zf); | |
| 28607 | 27534 | int32_t wateraheadx2 = vbound(x+11,0_zf,240_zf); | |
| 28608 | 27534 | int32_t wateraheady1 = vbound(y+9,0_zf,160_zf); | |
| 28609 | 27534 | int32_t wateraheady2 = vbound(y+15,0_zf,160_zf); | |
| 28610 | //bound(cx, 0, 240); //Fix crash during screen scroll when Hero is moving too quickly through a corner - DarkDragon | ||
| 28611 | //bound(cy, 0, 168); //Fix crash during screen scroll when Hero is moving too quickly through a corner - DarkDragon | ||
| 28612 | //y+8 could be 168 //Attempt to fix a frash where scrolling through the lower-left corner could crassh ZC as reported by Lut. -Z | ||
| 28613 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 8002 times.
✓ Branch 2 taken 5871 times.
✓ Branch 3 taken 6412 times.
✓ Branch 4 taken 7249 times.
|
27534 | switch(scrolldir) |
| 28614 | { | ||
| 28615 | case up: | ||
| 28616 | 8002 | lookaheady=160; | |
| 28617 | 8002 | wateraheady1=160; | |
| 28618 | 8002 | wateraheady2=160; | |
| 28619 | 8002 | break; | |
| 28620 | |||
| 28621 | case down: | ||
| 28622 | 5871 | lookaheady=0; | |
| 28623 | 5871 | wateraheady1=0; | |
| 28624 | 5871 | wateraheady2=0; | |
| 28625 | 5871 | break; | |
| 28626 | |||
| 28627 | case left: | ||
| 28628 | 6412 | lookaheadx=240; | |
| 28629 | 6412 | wateraheadx1=240; | |
| 28630 | 6412 | wateraheadx2=240; | |
| 28631 | 6412 | break; | |
| 28632 | |||
| 28633 | case right: | ||
| 28634 | 7249 | lookaheadx=0; | |
| 28635 | 7249 | wateraheadx1=0; | |
| 28636 | 7249 | wateraheadx2=0; | |
| 28637 | 7249 | break; | |
| 28638 | } | ||
| 28639 | |||
| 28640 | 27534 | bool nowinwater = false; | |
| 28641 | |||
| 28642 |
2/2✓ Branch 0 taken 111 times.
✓ Branch 1 taken 27423 times.
|
27534 | if(lastaction != inwind) |
| 28643 | { | ||
| 28644 |
2/2✓ Branch 0 taken 454 times.
✓ Branch 1 taken 26969 times.
|
27423 | if(lastaction == rafting ) //&& isRaftFlag(aheadflag)) |
| 28645 | { | ||
| 28646 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 438 times.
|
454 | if (lookaheadraftflag(scrolldir)) |
| 28647 | { | ||
| 28648 | 438 | action=rafting; FFCore.setHeroAction(rafting); | |
| 28649 | 438 | raftclk=0; | |
| 28650 | 438 | } | |
| 28651 | 454 | } | |
| 28652 |
6/6✓ Branch 0 taken 380 times.
✓ Branch 1 taken 26589 times.
✓ Branch 2 taken 373 times.
✓ Branch 3 taken 7 times.
✓ Branch 4 taken 25 times.
✓ Branch 5 taken 348 times.
|
26969 | else if(iswaterex(ahead, currmap, currscr, -1, wateraheadx1,wateraheady1) && iswaterex(ahead, currmap, currscr, -1, wateraheadx2,wateraheady2) && (current_item(itype_flippers))) |
| 28653 | { | ||
| 28654 |
9/16✓ Branch 0 taken 20 times.
✓ Branch 1 taken 328 times.
✓ Branch 2 taken 20 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 20 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 20 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 20 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 20 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 20 times.
|
348 | if(lastaction==swimming || lastaction == sideswimming || lastaction == sideswimattacking || lastaction == sideswimhit || lastaction == swimhit || lastaction == sideswimcasting || lastaction == sidewaterhold1 || lastaction == sidewaterhold2) |
| 28655 | { | ||
| 28656 | 328 | SetSwim(); | |
| 28657 | 328 | hopclk = 0xFF; | |
| 28658 | 328 | nowinwater = true; | |
| 28659 | 328 | } | |
| 28660 | else | ||
| 28661 | { | ||
| 28662 | 20 | action=hopping; FFCore.setHeroAction(hopping); | |
| 28663 | 20 | hopclk = 2; | |
| 28664 | 20 | nowinwater = true; | |
| 28665 | } | ||
| 28666 | 348 | } | |
| 28667 |
4/4✓ Branch 0 taken 26575 times.
✓ Branch 1 taken 46 times.
✓ Branch 2 taken 32 times.
✓ Branch 3 taken 26589 times.
|
26621 | else if((lastaction == attacking || lastaction == sideswimattacking) && charging) |
| 28668 | { | ||
| 28669 | 32 | action = lastaction; FFCore.setHeroAction(lastaction); | |
| 28670 | 32 | } | |
| 28671 | else | ||
| 28672 | { | ||
| 28673 | 26589 | action=none; FFCore.setHeroAction(none); | |
| 28674 | } | ||
| 28675 | 27423 | } | |
| 28676 | |||
| 28677 |
1/2✓ Branch 0 taken 27534 times.
✗ Branch 1 not taken.
|
27534 | isForceFaceUp = isForceFaceUp && canSideviewLadderRemote(lookaheadx,lookaheady); |
| 28678 | |||
| 28679 | // The naturaldark state can be read/set by an FFC script before | ||
| 28680 | // fade() or lighting() is called. | ||
| 28681 |
2/2✓ Branch 0 taken 2034 times.
✓ Branch 1 taken 25500 times.
|
27534 | naturaldark = !get_qr(qr_NEW_DARKROOM) && (newscr->flags & fDARK); |
| 28682 | |||
| 28683 |
2/2✓ Branch 0 taken 27232 times.
✓ Branch 1 taken 302 times.
|
27534 | if(newscr->oceansfx != oldscr->oceansfx) adjust_sfx(oldscr->oceansfx, 128, false); |
| 28684 | |||
| 28685 |
2/2✓ Branch 0 taken 27079 times.
✓ Branch 1 taken 455 times.
|
27534 | if(newscr->bosssfx != oldscr->bosssfx) adjust_sfx(oldscr->bosssfx, 128, false); |
| 28686 | //Preloaded ffc scripts | ||
| 28687 | 27534 | homescr=currscr; | |
| 28688 | 27534 | auto olddmap = currdmap; | |
| 28689 |
2/2✓ Branch 0 taken 958 times.
✓ Branch 1 taken 26576 times.
|
27534 | auto newdmap = (destdmap >= 0) ? destdmap : currdmap; |
| 28690 | |||
| 28691 | 27534 | currdmap = newdmap; | |
| 28692 | 27534 | ffscript_engine(true); | |
| 28693 | 27534 | currdmap = olddmap; | |
| 28694 | |||
| 28695 | // There are two occasions when scrolling must be darkened: | ||
| 28696 | // 1) When scrolling into a dark room. | ||
| 28697 | // 2) When scrolling between DMaps of different colours. | ||
| 28698 |
4/4✓ Branch 0 taken 958 times.
✓ Branch 1 taken 26576 times.
✓ Branch 2 taken 457 times.
✓ Branch 3 taken 501 times.
|
27534 | if(destdmap != -1 && DMaps[destdmap].color != currcset) |
| 28699 | { | ||
| 28700 |
1/2✓ Branch 0 taken 501 times.
✗ Branch 1 not taken.
|
501 | fade((specialcave > 0) ? (specialcave >= GUYCAVE) ? 10 : 11 : currcset, true, false); |
| 28701 | 501 | darkroom = true; | |
| 28702 | 501 | } | |
| 28703 |
2/2✓ Branch 0 taken 254 times.
✓ Branch 1 taken 26779 times.
|
27033 | else if(!darkroom) |
| 28704 | 26779 | lighting(false, false); // NES behaviour: fade to dark before scrolling | |
| 28705 | |||
| 28706 |
2/2✓ Branch 0 taken 454 times.
✓ Branch 1 taken 27080 times.
|
27534 | if(action != rafting) // Is this supposed to be here?! |
| 28707 | |||
| 28708 | 27080 | cx++; //This was the easiest way to re-arrange the loop so drawing is in the middle | |
| 28709 | |||
| 28710 | 27534 | cx *= delay; //so we can have drawing re-done every frame, | |
| 28711 | //previously it was for(0 to delay) advanceframes at end of loop | ||
| 28712 | 27534 | int32_t no_move = 0; | |
| 28713 | |||
| 28714 | 27534 | currdmap = newdmap; | |
| 28715 |
4/4✓ Branch 0 taken 27531 times.
✓ Branch 1 taken 1605189 times.
✓ Branch 2 taken 1605189 times.
✓ Branch 3 taken 27531 times.
|
1632720 | for(word i = 0; cx >= 0 && delay != 0; i++, cx--) //Go! |
| 28716 | { | ||
| 28717 |
2/2✓ Branch 0 taken 1445813 times.
✓ Branch 1 taken 159376 times.
|
1605189 | if (replay_version_check(0, 3)) |
| 28718 | { | ||
| 28719 | 159376 | replay_poll(); | |
| 28720 | 159376 | } | |
| 28721 |
2/2✓ Branch 0 taken 1605186 times.
✓ Branch 1 taken 3 times.
|
1605189 | if(Quit) |
| 28722 | { | ||
| 28723 | 3 | screenscrolling = false; | |
| 28724 | 3 | return; | |
| 28725 | } | ||
| 28726 | |||
| 28727 | |||
| 28728 | 1605186 | ZScriptVersion::RunScrollingScript(scrolldir, cx, sx, sy, end_frames, false); | |
| 28729 | |||
| 28730 |
2/2✓ Branch 0 taken 1490300 times.
✓ Branch 1 taken 114886 times.
|
1605186 | if(no_move > 0) |
| 28731 | 114886 | no_move--; | |
| 28732 | |||
| 28733 | //Don't want to move things on the first or last iteration, or between delays | ||
| 28734 |
6/6✓ Branch 0 taken 1577652 times.
✓ Branch 1 taken 27534 times.
✓ Branch 2 taken 1536928 times.
✓ Branch 3 taken 40724 times.
✓ Branch 4 taken 33025 times.
✓ Branch 5 taken 1503903 times.
|
1605186 | if(i == 0 || cx == 0 || cx % delay != 0) |
| 28735 | 101283 | no_move++; | |
| 28736 | |||
| 28737 |
4/4✓ Branch 0 taken 1201578 times.
✓ Branch 1 taken 403608 times.
✓ Branch 2 taken 290076 times.
✓ Branch 3 taken 911502 times.
|
1605186 | if(scrolldir == up || scrolldir == down) |
| 28738 | { | ||
| 28739 |
2/2✓ Branch 0 taken 643663 times.
✓ Branch 1 taken 50021 times.
|
693684 | if(!get_qr(qr_SMOOTHVERTICALSCROLLING)) |
| 28740 | { | ||
| 28741 | //Add a few extra frames if on the second loop and cool scrolling is not set | ||
| 28742 |
2/2✓ Branch 0 taken 49341 times.
✓ Branch 1 taken 680 times.
|
50021 | if(i == 1) |
| 28743 | { | ||
| 28744 | 680 | cx += (scrolldir == down) ? 3 : 2; | |
| 28745 | 680 | no_move += (scrolldir == down) ? 3 : 2; | |
| 28746 | 680 | } | |
| 28747 | 50021 | } | |
| 28748 | else | ||
| 28749 | { | ||
| 28750 | //4 frames after we've finished scrolling of being still | ||
| 28751 |
4/4✓ Branch 0 taken 26386 times.
✓ Branch 1 taken 617277 times.
✓ Branch 2 taken 13193 times.
✓ Branch 3 taken 13193 times.
|
643663 | if(cx == 0 && !end_frames) |
| 28752 | { | ||
| 28753 | 13193 | cx += 4; | |
| 28754 | 13193 | no_move += 4; | |
| 28755 | 13193 | end_frames = true; | |
| 28756 | 13193 | } | |
| 28757 | } | ||
| 28758 | 693684 | } | |
| 28759 | |||
| 28760 | //Move Hero and the scroll position | ||
| 28761 |
2/2✓ Branch 0 taken 142417 times.
✓ Branch 1 taken 1462769 times.
|
1605186 | if(!no_move) |
| 28762 | { | ||
| 28763 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 332280 times.
✓ Branch 2 taken 246306 times.
✓ Branch 3 taken 413652 times.
✓ Branch 4 taken 470531 times.
|
1462769 | switch(scrolldir) |
| 28764 | { | ||
| 28765 | case up: | ||
| 28766 | 332280 | sy -= step; | |
| 28767 | 332280 | y += step; | |
| 28768 | 332280 | break; | |
| 28769 | |||
| 28770 | case down: | ||
| 28771 | 246306 | sy += step; | |
| 28772 | 246306 | y -= step; | |
| 28773 | 246306 | break; | |
| 28774 | |||
| 28775 | case left: | ||
| 28776 | 413652 | sx -= step; | |
| 28777 | 413652 | x += step; | |
| 28778 | 413652 | break; | |
| 28779 | |||
| 28780 | case right: | ||
| 28781 | 470531 | sx += step; | |
| 28782 | 470531 | x -= step; | |
| 28783 | 470531 | break; | |
| 28784 | } | ||
| 28785 | |||
| 28786 | //bound Hero when me move him off the screen in the last couple of frames of scrolling | ||
| 28787 |
2/2✓ Branch 0 taken 29650 times.
✓ Branch 1 taken 1433119 times.
|
1462769 | if(y > 160) y = 160; |
| 28788 | |||
| 28789 |
2/2✓ Branch 0 taken 21936 times.
✓ Branch 1 taken 1440833 times.
|
1462769 | if(y < 0) y = 0; |
| 28790 | |||
| 28791 |
2/2✓ Branch 0 taken 25788 times.
✓ Branch 1 taken 1436981 times.
|
1462769 | if(x > 240) x = 240; |
| 28792 | |||
| 28793 |
2/2✓ Branch 0 taken 29298 times.
✓ Branch 1 taken 1433471 times.
|
1462769 | if(x < 0) x = 0; |
| 28794 | |||
| 28795 |
4/4✓ Branch 0 taken 1462523 times.
✓ Branch 1 taken 246 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 1462513 times.
|
1462769 | if(ladderx > 0 || laddery > 0) |
| 28796 | { | ||
| 28797 | // If the ladder moves on both axes, the player can | ||
| 28798 | // gradually shift it by going back and forth | ||
| 28799 |
2/4✓ Branch 0 taken 256 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 256 times.
|
256 | if(scrolldir==up || scrolldir==down) |
| 28800 | ✗ | laddery = y.getInt(); | |
| 28801 | else | ||
| 28802 | 256 | ladderx = x.getInt(); | |
| 28803 | 256 | } | |
| 28804 | 1462769 | } | |
| 28805 | |||
| 28806 | //Drawing | ||
| 28807 | 1605186 | tx = sx; | |
| 28808 | 1605186 | ty = sy; | |
| 28809 | 1605186 | tx2 = sx; | |
| 28810 | 1605186 | ty2 = sy; | |
| 28811 | |||
| 28812 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 485028 times.
✓ Branch 2 taken 290076 times.
✓ Branch 3 taken 426474 times.
✓ Branch 4 taken 403608 times.
|
1605186 | switch(scrolldir) |
| 28813 | { | ||
| 28814 | case right: | ||
| 28815 | 485028 | FFCore.ScrollingData[SCROLLDATA_NX] = 256-tx2; | |
| 28816 | 485028 | FFCore.ScrollingData[SCROLLDATA_NY] = 0; | |
| 28817 | 485028 | FFCore.ScrollingData[SCROLLDATA_OX] = -tx2; | |
| 28818 | 485028 | FFCore.ScrollingData[SCROLLDATA_OY] = 0; | |
| 28819 | 485028 | tx -= 256; | |
| 28820 | 485028 | break; | |
| 28821 | |||
| 28822 | case down: | ||
| 28823 | 290076 | FFCore.ScrollingData[SCROLLDATA_NX] = 0; | |
| 28824 | 290076 | FFCore.ScrollingData[SCROLLDATA_NY] = 176-ty2; | |
| 28825 | 290076 | FFCore.ScrollingData[SCROLLDATA_OX] = 0; | |
| 28826 | 290076 | FFCore.ScrollingData[SCROLLDATA_OY] = -ty2; | |
| 28827 | 290076 | ty -= 176; | |
| 28828 | 290076 | break; | |
| 28829 | |||
| 28830 | case left: | ||
| 28831 | 426474 | FFCore.ScrollingData[SCROLLDATA_NX] = -tx2; | |
| 28832 | 426474 | FFCore.ScrollingData[SCROLLDATA_NY] = 0; | |
| 28833 | 426474 | FFCore.ScrollingData[SCROLLDATA_OX] = 256-tx2; | |
| 28834 | 426474 | FFCore.ScrollingData[SCROLLDATA_OY] = 0; | |
| 28835 | 426474 | tx2 -= 256; | |
| 28836 | 426474 | break; | |
| 28837 | |||
| 28838 | case up: | ||
| 28839 | 403608 | FFCore.ScrollingData[SCROLLDATA_NX] = 0; | |
| 28840 | 403608 | FFCore.ScrollingData[SCROLLDATA_NY] = -ty2; | |
| 28841 | 403608 | FFCore.ScrollingData[SCROLLDATA_OX] = 0; | |
| 28842 | 403608 | FFCore.ScrollingData[SCROLLDATA_OY] = 176-ty2; | |
| 28843 | 403608 | ty2 -= 176; | |
| 28844 | 403608 | break; | |
| 28845 | } | ||
| 28846 | |||
| 28847 | //FFScript.OnWaitdraw() | ||
| 28848 | 1605186 | ZScriptVersion::RunScrollingScript(scrolldir, cx, sx, sy, end_frames, true); //Waitdraw | |
| 28849 | |||
| 28850 | 1605186 | FFCore.runGenericPassiveEngine(SCR_TIMING_PRE_DRAW); | |
| 28851 | 1605186 | clear_bitmap(scrollbuf); | |
| 28852 | 1605186 | clear_bitmap(framebuf); | |
| 28853 | 1605186 | clear_info_bmp(); | |
| 28854 | |||
| 28855 | 1605186 | combotile_add_x = 0; | |
| 28856 | 1605186 | combotile_add_y = playing_field_offset; | |
| 28857 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 403608 times.
✓ Branch 2 taken 290076 times.
✓ Branch 3 taken 426474 times.
✓ Branch 4 taken 485028 times.
|
1605186 | switch(scrolldir) |
| 28858 | { | ||
| 28859 | case up: | ||
| 28860 |
2/2✓ Branch 0 taken 402930 times.
✓ Branch 1 taken 678 times.
|
403608 | if(XOR(newscr->flags7&fLAYER2BG, DMaps[currdmap].flags&dmfLAYER2BG)) do_layer(scrollbuf, 0, 2, newscr, 0, playing_field_offset, 2); |
| 28861 | |||
| 28862 |
2/2✓ Branch 0 taken 403269 times.
✓ Branch 1 taken 339 times.
|
403608 | if(XOR(oldscr->flags7&fLAYER2BG, DMaps[currdmap].flags&dmfLAYER2BG)) do_layer(scrollbuf, 0, 2, oldscr, 0, -176+playing_field_offset, 3); |
| 28863 | |||
| 28864 |
2/2✓ Branch 0 taken 402423 times.
✓ Branch 1 taken 1185 times.
|
403608 | if(XOR(newscr->flags7&fLAYER3BG, DMaps[currdmap].flags&dmfLAYER3BG)) do_layer(scrollbuf, 0, 3, newscr, 0, playing_field_offset, 2); |
| 28865 | |||
| 28866 |
2/2✓ Branch 0 taken 402723 times.
✓ Branch 1 taken 885 times.
|
403608 | if(XOR(oldscr->flags7&fLAYER3BG, DMaps[currdmap].flags&dmfLAYER3BG)) do_layer(scrollbuf, 0, 3, oldscr, 0, -176+playing_field_offset, 3); |
| 28867 | |||
| 28868 | // Draw both screens' background layer primitives together, after both layers' combos. | ||
| 28869 | // Not ideal, but probably good enough for all realistic purposes. | ||
| 28870 |
4/4✓ Branch 0 taken 678 times.
✓ Branch 1 taken 402930 times.
✓ Branch 2 taken 402591 times.
✓ Branch 3 taken 1017 times.
|
403608 | if(XOR((newscr->flags7&fLAYER2BG) || (oldscr->flags7&fLAYER2BG), DMaps[currdmap].flags&dmfLAYER2BG)) do_primitives(scrollbuf, 2, newscr, sx, sy); |
| 28871 | |||
| 28872 |
4/4✓ Branch 0 taken 1185 times.
✓ Branch 1 taken 402423 times.
✓ Branch 2 taken 402173 times.
✓ Branch 3 taken 1435 times.
|
403608 | if(XOR((newscr->flags7&fLAYER3BG) || (oldscr->flags7&fLAYER3BG), DMaps[currdmap].flags&dmfLAYER3BG)) do_primitives(scrollbuf, 3, newscr, sx, sy); |
| 28873 | |||
| 28874 | 403608 | combotile_add_y -= sy; | |
| 28875 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 403608 times.
|
403608 | if(lenscheck(newscr,0)) putscr(scrollbuf, 0, 0, newscr); |
| 28876 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 403608 times.
|
403608 | if(lenscheck(oldscr,0)) putscr(scrollbuf, 0, 176, oldscr); |
| 28877 | 403608 | break; | |
| 28878 | |||
| 28879 | case down: | ||
| 28880 |
2/2✓ Branch 0 taken 289925 times.
✓ Branch 1 taken 151 times.
|
290076 | if(XOR(newscr->flags7&fLAYER2BG, DMaps[currdmap].flags&dmfLAYER2BG)) do_layer(scrollbuf, 0, 2, newscr, 0, -176+playing_field_offset, 2); |
| 28881 | |||
| 28882 |
2/2✓ Branch 0 taken 289738 times.
✓ Branch 1 taken 338 times.
|
290076 | if(XOR(oldscr->flags7&fLAYER2BG, DMaps[currdmap].flags&dmfLAYER2BG)) do_layer(scrollbuf, 0, 2, oldscr, 0, playing_field_offset, 3); |
| 28883 | |||
| 28884 |
2/2✓ Branch 0 taken 289626 times.
✓ Branch 1 taken 450 times.
|
290076 | if(XOR(newscr->flags7&fLAYER3BG, DMaps[currdmap].flags&dmfLAYER3BG)) do_layer(scrollbuf, 0, 3, newscr, 0, -176+playing_field_offset, 2); |
| 28885 | |||
| 28886 |
2/2✓ Branch 0 taken 289326 times.
✓ Branch 1 taken 750 times.
|
290076 | if(XOR(oldscr->flags7&fLAYER3BG, DMaps[currdmap].flags&dmfLAYER3BG)) do_layer(scrollbuf, 0, 3, oldscr, 0, playing_field_offset, 3); |
| 28887 | |||
| 28888 |
4/4✓ Branch 0 taken 151 times.
✓ Branch 1 taken 289925 times.
✓ Branch 2 taken 289587 times.
✓ Branch 3 taken 489 times.
|
290076 | if(XOR((newscr->flags7&fLAYER2BG) || (oldscr->flags7&fLAYER2BG), DMaps[currdmap].flags&dmfLAYER2BG)) do_primitives(scrollbuf, 2, newscr, sx, sy); |
| 28889 | |||
| 28890 |
4/4✓ Branch 0 taken 450 times.
✓ Branch 1 taken 289626 times.
✓ Branch 2 taken 289176 times.
✓ Branch 3 taken 900 times.
|
290076 | if(XOR((newscr->flags7&fLAYER3BG) || (oldscr->flags7&fLAYER3BG), DMaps[currdmap].flags&dmfLAYER3BG)) do_primitives(scrollbuf, 3, newscr, sx, sy); |
| 28891 | |||
| 28892 | 290076 | combotile_add_y -= sy; | |
| 28893 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 290076 times.
|
290076 | if(lenscheck(oldscr,0)) putscr(scrollbuf, 0, 0, oldscr); |
| 28894 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 290076 times.
|
290076 | if(lenscheck(newscr,0)) putscr(scrollbuf, 0, 176, newscr); |
| 28895 | 290076 | break; | |
| 28896 | |||
| 28897 | case left: | ||
| 28898 |
2/2✓ Branch 0 taken 426456 times.
✓ Branch 1 taken 18 times.
|
426474 | if(XOR(newscr->flags7&fLAYER2BG, DMaps[currdmap].flags&dmfLAYER2BG)) do_layer(scrollbuf, 0, 2, newscr, 0, playing_field_offset, 2); |
| 28899 | |||
| 28900 |
2/2✓ Branch 0 taken 426408 times.
✓ Branch 1 taken 66 times.
|
426474 | if(XOR(oldscr->flags7&fLAYER2BG, DMaps[currdmap].flags&dmfLAYER2BG)) do_layer(scrollbuf, 0, 2, oldscr, -256, playing_field_offset, 3); |
| 28901 | |||
| 28902 |
2/2✓ Branch 0 taken 424668 times.
✓ Branch 1 taken 1806 times.
|
426474 | if(XOR(newscr->flags7&fLAYER3BG, DMaps[currdmap].flags&dmfLAYER3BG)) do_layer(scrollbuf, 0, 3, newscr, 0, playing_field_offset, 2); |
| 28903 | |||
| 28904 |
2/2✓ Branch 0 taken 424602 times.
✓ Branch 1 taken 1872 times.
|
426474 | if(XOR(oldscr->flags7&fLAYER3BG, DMaps[currdmap].flags&dmfLAYER3BG)) do_layer(scrollbuf, 0, 3, oldscr, -256, playing_field_offset, 3); |
| 28905 | |||
| 28906 |
4/4✓ Branch 0 taken 18 times.
✓ Branch 1 taken 426456 times.
✓ Branch 2 taken 426390 times.
✓ Branch 3 taken 84 times.
|
426474 | if(XOR((newscr->flags7&fLAYER2BG) || (oldscr->flags7&fLAYER2BG), DMaps[currdmap].flags&dmfLAYER2BG)) do_primitives(scrollbuf, 2, newscr, sx, sy); |
| 28907 | |||
| 28908 |
4/4✓ Branch 0 taken 1806 times.
✓ Branch 1 taken 424668 times.
✓ Branch 2 taken 424206 times.
✓ Branch 3 taken 2268 times.
|
426474 | if(XOR((newscr->flags7&fLAYER3BG) || (oldscr->flags7&fLAYER3BG), DMaps[currdmap].flags&dmfLAYER3BG)) do_primitives(scrollbuf, 3, newscr, sx, sy); |
| 28909 | |||
| 28910 | 426474 | combotile_add_x -= sx; | |
| 28911 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 426474 times.
|
426474 | if(lenscheck(newscr,0)) putscr(scrollbuf, 0, 0, newscr); |
| 28912 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 426474 times.
|
426474 | if(lenscheck(oldscr,0)) putscr(scrollbuf, 256, 0, oldscr); |
| 28913 | 426474 | break; | |
| 28914 | |||
| 28915 | case right: | ||
| 28916 |
1/2✓ Branch 0 taken 485028 times.
✗ Branch 1 not taken.
|
485028 | if(XOR(newscr->flags7&fLAYER2BG, DMaps[currdmap].flags&dmfLAYER2BG)) do_layer(scrollbuf, 0, 2, newscr, -256, playing_field_offset, 2); |
| 28917 | |||
| 28918 |
2/2✓ Branch 0 taken 485010 times.
✓ Branch 1 taken 18 times.
|
485028 | if(XOR(oldscr->flags7&fLAYER2BG, DMaps[currdmap].flags&dmfLAYER2BG)) do_layer(scrollbuf, 0, 2, oldscr, 0, playing_field_offset, 3); |
| 28919 | |||
| 28920 |
2/2✓ Branch 0 taken 483456 times.
✓ Branch 1 taken 1572 times.
|
485028 | if(XOR(newscr->flags7&fLAYER3BG, DMaps[currdmap].flags&dmfLAYER3BG)) do_layer(scrollbuf, 0, 3, newscr, -256, playing_field_offset, 2); |
| 28921 | |||
| 28922 |
2/2✓ Branch 0 taken 483456 times.
✓ Branch 1 taken 1572 times.
|
485028 | if(XOR(oldscr->flags7&fLAYER3BG, DMaps[currdmap].flags&dmfLAYER3BG)) do_layer(scrollbuf, 0, 3, oldscr, 0, playing_field_offset, 3); |
| 28923 | |||
| 28924 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 485028 times.
✓ Branch 2 taken 485010 times.
✓ Branch 3 taken 18 times.
|
485028 | if(XOR((newscr->flags7&fLAYER2BG) || (oldscr->flags7&fLAYER2BG), DMaps[currdmap].flags&dmfLAYER2BG)) do_primitives(scrollbuf, 2, newscr, sx, sy); |
| 28925 | |||
| 28926 |
4/4✓ Branch 0 taken 1572 times.
✓ Branch 1 taken 483456 times.
✓ Branch 2 taken 482994 times.
✓ Branch 3 taken 2034 times.
|
485028 | if(XOR((newscr->flags7&fLAYER3BG) || (oldscr->flags7&fLAYER3BG), DMaps[currdmap].flags&dmfLAYER3BG)) do_primitives(scrollbuf, 3, newscr, sx, sy); |
| 28927 | |||
| 28928 | 485028 | combotile_add_x -= sx; | |
| 28929 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 485028 times.
|
485028 | if(lenscheck(oldscr,0)) putscr(scrollbuf, 0, 0, oldscr); |
| 28930 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 485028 times.
|
485028 | if(lenscheck(newscr,0)) putscr(scrollbuf, 256, 0, newscr); |
| 28931 | 485028 | break; | |
| 28932 | } | ||
| 28933 | |||
| 28934 | 1605186 | combotile_add_x = 0; | |
| 28935 | 1605186 | combotile_add_y = 0; | |
| 28936 | |||
| 28937 | 1605186 | blit(scrollbuf, framebuf, sx, sy, 0, playing_field_offset, 256, 168); | |
| 28938 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1605186 times.
|
1605186 | if(lenscheck(newscr,0)) |
| 28939 | 1605186 | do_primitives(framebuf, 0, newscr, 0, playing_field_offset); | |
| 28940 | |||
| 28941 | 1605186 | do_layer(framebuf, 0, 1, oldscr, tx2, ty2, 3); | |
| 28942 | 1605186 | do_layer(framebuf, 0, 1, newscr, tx, ty, 2, false, true); | |
| 28943 | |||
| 28944 |
2/2✓ Branch 0 taken 1160654 times.
✓ Branch 1 taken 444532 times.
|
1605186 | if(get_qr(qr_FFCSCROLL)) |
| 28945 | { | ||
| 28946 | 444532 | do_layer(framebuf, -3, 0, oldscr, tx2, ty2, 3, true); //ffcs | |
| 28947 | 444532 | do_layer(framebuf, -3, 0, newscr, tx, ty, 2, true); | |
| 28948 | 444532 | } | |
| 28949 | |||
| 28950 |
2/2✓ Branch 0 taken 761 times.
✓ Branch 1 taken 1604425 times.
|
1605186 | if(!(XOR(oldscr->flags7&fLAYER2BG, DMaps[currdmap].flags&dmfLAYER2BG)) ) do_layer(framebuf, 0, 2, oldscr, tx2, ty2, 3); |
| 28951 |
2/2✓ Branch 0 taken 847 times.
✓ Branch 1 taken 1604339 times.
|
1605186 | if(!(XOR(newscr->flags7&fLAYER2BG, DMaps[currdmap].flags&dmfLAYER2BG))) do_layer(framebuf, 0, 2, newscr, tx, ty, 2, false, !(oldscr->flags7&fLAYER2BG)); |
| 28952 | |||
| 28953 | //push blocks | ||
| 28954 |
2/2✓ Branch 0 taken 16458 times.
✓ Branch 1 taken 1588728 times.
|
1605186 | if(get_qr(qr_PUSHBLOCK_SPRITE_LAYER)) |
| 28955 | { | ||
| 28956 | 1588728 | do_layer(framebuf, -2, 0, oldscr, tx2, ty2, 3); | |
| 28957 | 1588728 | do_layer(framebuf, -2, 0, newscr, tx, ty, 2); | |
| 28958 |
2/2✓ Branch 0 taken 1549830 times.
✓ Branch 1 taken 38898 times.
|
1588728 | if(get_qr(qr_PUSHBLOCK_LAYER_1_2)) |
| 28959 | { | ||
| 28960 | 38898 | do_layer(framebuf, -2, 1, oldscr, tx2, ty2, 3); | |
| 28961 | 38898 | do_layer(framebuf, -2, 1, newscr, tx, ty, 2); | |
| 28962 | 38898 | do_layer(framebuf, -2, 2, oldscr, tx2, ty2, 3); | |
| 28963 | 38898 | do_layer(framebuf, -2, 2, newscr, tx, ty, 2); | |
| 28964 | 38898 | } | |
| 28965 | 1588728 | do_primitives(framebuf, SPLAYER_PUSHBLOCK, newscr, 0, playing_field_offset); | |
| 28966 | 1588728 | } | |
| 28967 | |||
| 28968 | 1605186 | do_walkflags(oldscr, tx2, ty2,3); //show walkflags if the cheat is on | |
| 28969 | 1605186 | do_walkflags(newscr, tx, ty,2); | |
| 28970 | |||
| 28971 | 1605186 | do_effectflags(oldscr, tx2, ty2,3); //show effectflags if the cheat is on | |
| 28972 | 1605186 | do_effectflags(newscr, tx, ty,2); | |
| 28973 | |||
| 28974 | |||
| 28975 | 1605186 | putscrdoors(framebuf, 0-tx2, 0-ty2+playing_field_offset, oldscr); | |
| 28976 | 1605186 | putscrdoors(framebuf, 0-tx, 0-ty+playing_field_offset, newscr); | |
| 28977 | 1605186 | herostep(); | |
| 28978 |
1/2✓ Branch 0 taken 1605186 times.
✗ Branch 1 not taken.
|
1605186 | if(isForceFaceUp) dir = up; |
| 28979 | |||
| 28980 |
5/6✓ Branch 0 taken 1604422 times.
✓ Branch 1 taken 764 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1603658 times.
✓ Branch 4 taken 1604422 times.
✓ Branch 5 taken 1604422 times.
|
1605186 | if((z > 0 || fakez > 0) && (!get_qr(qr_SHADOWSFLICKER) || frame&1)) |
| 28981 | { | ||
| 28982 | 3208080 | drawshadow(framebuf, get_qr(qr_TRANSSHADOWS) != 0); | |
| 28983 | 3208080 | } | |
| 28984 | |||
| 28985 |
4/4✓ Branch 0 taken 615767 times.
✓ Branch 1 taken 989419 times.
✓ Branch 2 taken 295458 times.
✓ Branch 3 taken 320309 times.
|
1605186 | if(!isdungeon() || get_qr(qr_FREEFORM)) |
| 28986 | { | ||
| 28987 |
2/2✓ Branch 0 taken 36974 times.
✓ Branch 1 taken 1284877 times.
|
1321851 | for (int i = 0; i < decorations.Count(); i++) |
| 28988 | { | ||
| 28989 | 36974 | auto sprite = (decoration*)decorations.spr(i); | |
| 28990 |
2/2✓ Branch 0 taken 36544 times.
✓ Branch 1 taken 430 times.
|
36974 | if (!sprite->is_drawn_with_offset()) |
| 28991 | { | ||
| 28992 | // NOTE: if decoration sprites are ever exposed to zscript, this modification | ||
| 28993 | // needs to tack on to existing values for x/yofs. | ||
| 28994 | 430 | sprite->xofs = -tx2; | |
| 28995 | 430 | sprite->yofs = -ty2+playing_field_offset; | |
| 28996 | 430 | } | |
| 28997 | 36974 | } | |
| 28998 | |||
| 28999 | 1284877 | draw_under(framebuf); //draw the ladder or raft | |
| 29000 | 1284877 | decorations.draw2(framebuf, true); | |
| 29001 | 1284877 | draw(framebuf); //Hero | |
| 29002 | 1284877 | decorations.draw(framebuf, true); | |
| 29003 | 1284877 | } | |
| 29004 | |||
| 29005 |
2/2✓ Branch 0 taken 5079 times.
✓ Branch 1 taken 1600107 times.
|
1605186 | if(!(XOR(oldscr->flags7&fLAYER3BG, DMaps[currdmap].flags&dmfLAYER3BG))) do_layer(framebuf, 0, 3, oldscr, tx2, ty2, 3); |
| 29006 | |||
| 29007 | 1605186 | do_layer(framebuf, 0, 4, oldscr, tx2, ty2, 3); //layer 4 | |
| 29008 | 1605186 | do_layer(framebuf, -1, 0, oldscr, tx2, ty2, 3); //overhead combos | |
| 29009 |
2/2✓ Branch 0 taken 1561832 times.
✓ Branch 1 taken 43354 times.
|
1605186 | if(get_qr(qr_OVERHEAD_COMBOS_L1_L2)) |
| 29010 | { | ||
| 29011 | 43354 | do_layer(framebuf, -1, 1, oldscr, tx2, ty2, 3); //overhead combos | |
| 29012 | 43354 | do_layer(framebuf, -1, 2, oldscr, tx2, ty2, 3); //overhead combos | |
| 29013 | 43354 | } | |
| 29014 | 1605186 | do_layer(framebuf, 0, 5, oldscr, tx2, ty2, 3); //layer 5 | |
| 29015 | 1605186 | do_layer(framebuf, -4, 0, oldscr, tx2, ty2, 3, true); //overhead FFCs | |
| 29016 | 1605186 | do_layer(framebuf, 0, 6, oldscr, tx2, ty2, 3); //layer 6 | |
| 29017 | |||
| 29018 |
2/2✓ Branch 0 taken 5013 times.
✓ Branch 1 taken 1600173 times.
|
1605186 | if(!(XOR(newscr->flags7&fLAYER3BG, DMaps[currdmap].flags&dmfLAYER3BG))) do_layer(framebuf, 0, 3, newscr, tx, ty, 2, false, !(XOR(oldscr->flags7&fLAYER3BG, DMaps[currdmap].flags&dmfLAYER3BG))); |
| 29019 | |||
| 29020 | 1605186 | do_layer(framebuf, 0, 4, newscr, tx, ty, 2, false, true); //layer 4 | |
| 29021 | 1605186 | do_layer(framebuf, -1, 0, newscr, tx, ty, 2); //overhead combos | |
| 29022 |
2/2✓ Branch 0 taken 1561832 times.
✓ Branch 1 taken 43354 times.
|
1605186 | if(get_qr(qr_OVERHEAD_COMBOS_L1_L2)) |
| 29023 | { | ||
| 29024 | 43354 | do_layer(framebuf, -1, 1, newscr, tx, ty, 2); //overhead combos | |
| 29025 | 43354 | do_layer(framebuf, -1, 2, newscr, tx, ty, 2); //overhead combos | |
| 29026 | 43354 | } | |
| 29027 | 1605186 | do_layer(framebuf, 0, 5, newscr, tx, ty, 2, false, true); //layer 5 | |
| 29028 | 1605186 | do_layer(framebuf, -4, 0, newscr, tx, ty, 2, true); //overhead FFCs | |
| 29029 | 1605186 | do_layer(framebuf, 0, 6, newscr, tx, ty, 2, false, true); //layer 6 | |
| 29030 | |||
| 29031 | |||
| 29032 |
1/2✓ Branch 0 taken 1605186 times.
✗ Branch 1 not taken.
|
1605186 | if(msg_bg_display_buf->clip == 0) |
| 29033 | { | ||
| 29034 | ✗ | blit_msgstr_bg(framebuf, tx2, ty2, 0, playing_field_offset, 256, 168); | |
| 29035 | ✗ | } | |
| 29036 |
1/2✓ Branch 0 taken 1605186 times.
✗ Branch 1 not taken.
|
1605186 | if(msg_portrait_display_buf->clip == 0) |
| 29037 | { | ||
| 29038 | ✗ | blit_msgstr_prt(framebuf, tx2, ty2, 0, playing_field_offset, 256, 168); | |
| 29039 | ✗ | } | |
| 29040 |
1/2✓ Branch 0 taken 1605186 times.
✗ Branch 1 not taken.
|
1605186 | if(msg_txt_display_buf->clip == 0) |
| 29041 | { | ||
| 29042 | ✗ | blit_msgstr_fg(framebuf, tx2, ty2, 0, playing_field_offset, 256, 168); | |
| 29043 | ✗ | } | |
| 29044 | |||
| 29045 |
6/6✓ Branch 0 taken 49648 times.
✓ Branch 1 taken 1555538 times.
✓ Branch 2 taken 40805 times.
✓ Branch 3 taken 8843 times.
✓ Branch 4 taken 239 times.
✓ Branch 5 taken 40566 times.
|
1605186 | if(get_qr(qr_NEW_DARKROOM) && (room_is_dark||room_was_dark)) |
| 29046 | { | ||
| 29047 | 9082 | clear_darkroom_bitmaps(); | |
| 29048 | 9082 | calc_darkroom_combos(true); | |
| 29049 | 9082 | calc_darkroom_hero(FFCore.ScrollingData[SCROLLDATA_NX], FFCore.ScrollingData[SCROLLDATA_NY],FFCore.ScrollingData[SCROLLDATA_OX], FFCore.ScrollingData[SCROLLDATA_OY]); | |
| 29050 | 9082 | } | |
| 29051 | |||
| 29052 |
4/4✓ Branch 0 taken 49648 times.
✓ Branch 1 taken 1555538 times.
✓ Branch 2 taken 13153 times.
✓ Branch 3 taken 36495 times.
|
1605186 | if(get_qr(qr_NEW_DARKROOM) && get_qr(qr_NEWDARK_L6)) |
| 29053 | { | ||
| 29054 | 36495 | set_clip_rect(framebuf, 0, playing_field_offset, 256, 168+playing_field_offset); | |
| 29055 | 36495 | int32_t dx1 = FFCore.ScrollingData[SCROLLDATA_NX], dy1 = FFCore.ScrollingData[SCROLLDATA_NY]+playing_field_offset; | |
| 29056 | 36495 | int32_t dx2 = FFCore.ScrollingData[SCROLLDATA_OX], dy2 = FFCore.ScrollingData[SCROLLDATA_OY]+playing_field_offset; | |
| 29057 |
2/2✓ Branch 0 taken 28127 times.
✓ Branch 1 taken 8368 times.
|
36495 | if(room_is_dark) |
| 29058 | { | ||
| 29059 |
1/2✓ Branch 0 taken 8368 times.
✗ Branch 1 not taken.
|
8368 | if(newscr->flags9 & fDARK_DITHER) //dither the entire bitmap |
| 29060 | { | ||
| 29061 | ✗ | ditherblit(darkscr_bmp_curscr,darkscr_bmp_curscr,0,game->get_dither_type(),game->get_dither_arg()); | |
| 29062 | ✗ | ditherblit(darkscr_bmp_curscr_trans,darkscr_bmp_curscr_trans,0,game->get_dither_type(),game->get_dither_arg()); | |
| 29063 | ✗ | } | |
| 29064 | |||
| 29065 | 8368 | color_map = &trans_table2; | |
| 29066 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8368 times.
|
8368 | if(newscr->flags9 & fDARK_TRANS) //draw the dark as transparent |
| 29067 | ✗ | draw_trans_sprite(framebuf, darkscr_bmp_curscr, dx1, dy1); | |
| 29068 | else | ||
| 29069 | 8368 | masked_blit(darkscr_bmp_curscr, framebuf, 0, 0, dx1, dy1, 256, 176); | |
| 29070 | 8368 | draw_trans_sprite(framebuf, darkscr_bmp_curscr_trans, dx1, dy1); | |
| 29071 | 8368 | color_map = &trans_table; | |
| 29072 | 8368 | } | |
| 29073 |
2/2✓ Branch 0 taken 28199 times.
✓ Branch 1 taken 8296 times.
|
36495 | if(room_was_dark) |
| 29074 | { | ||
| 29075 |
1/2✓ Branch 0 taken 8296 times.
✗ Branch 1 not taken.
|
8296 | if(oldscr->flags9 & fDARK_DITHER) //dither the entire bitmap |
| 29076 | { | ||
| 29077 | ✗ | ditherblit(darkscr_bmp_scrollscr,darkscr_bmp_scrollscr,0,game->get_dither_type(),game->get_dither_arg()); | |
| 29078 | ✗ | ditherblit(darkscr_bmp_scrollscr_trans,darkscr_bmp_scrollscr_trans,0,game->get_dither_type(),game->get_dither_arg()); | |
| 29079 | ✗ | } | |
| 29080 | |||
| 29081 | 8296 | color_map = &trans_table2; | |
| 29082 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8296 times.
|
8296 | if(oldscr->flags9 & fDARK_TRANS) //draw the dark as transparent |
| 29083 | ✗ | draw_trans_sprite(framebuf, darkscr_bmp_scrollscr, dx2, dy2); | |
| 29084 | else | ||
| 29085 | 8296 | masked_blit(darkscr_bmp_scrollscr, framebuf, 0, 0, dx2, dy2, 256, 176); | |
| 29086 | 8296 | draw_trans_sprite(framebuf, darkscr_bmp_scrollscr_trans, dx2, dy2); | |
| 29087 | 8296 | color_map = &trans_table; | |
| 29088 | 8296 | } | |
| 29089 | 36495 | set_clip_rect(framebuf, 0, 0, framebuf->w, framebuf->h); | |
| 29090 | 36495 | } | |
| 29091 | 1605186 | put_passive_subscr(framebuf, 0, passive_subscreen_offset, game->should_show_time(), sspUP); | |
| 29092 |
2/2✓ Branch 0 taken 1032803 times.
✓ Branch 1 taken 572383 times.
|
1605186 | if(get_qr(qr_SUBSCREENOVERSPRITES)) |
| 29093 | 572383 | do_primitives(framebuf, 7, newscr, 0, playing_field_offset); | |
| 29094 | |||
| 29095 |
4/4✓ Branch 0 taken 49648 times.
✓ Branch 1 taken 1555538 times.
✓ Branch 2 taken 36495 times.
✓ Branch 3 taken 13153 times.
|
1605186 | if(get_qr(qr_NEW_DARKROOM) && !get_qr(qr_NEWDARK_L6)) |
| 29096 | { | ||
| 29097 | 13153 | set_clip_rect(framebuf, 0, playing_field_offset, 256, 168+playing_field_offset); | |
| 29098 | 13153 | int32_t dx1 = FFCore.ScrollingData[SCROLLDATA_NX], dy1 = FFCore.ScrollingData[SCROLLDATA_NY]+playing_field_offset; | |
| 29099 | 13153 | int32_t dx2 = FFCore.ScrollingData[SCROLLDATA_OX], dy2 = FFCore.ScrollingData[SCROLLDATA_OY]+playing_field_offset; | |
| 29100 |
2/2✓ Branch 0 taken 12678 times.
✓ Branch 1 taken 475 times.
|
13153 | if(room_is_dark) |
| 29101 | { | ||
| 29102 |
1/2✓ Branch 0 taken 475 times.
✗ Branch 1 not taken.
|
475 | if(newscr->flags9 & fDARK_DITHER) //dither the entire bitmap |
| 29103 | { | ||
| 29104 | ✗ | ditherblit(darkscr_bmp_curscr,darkscr_bmp_curscr,0,game->get_dither_type(),game->get_dither_arg()); | |
| 29105 | ✗ | ditherblit(darkscr_bmp_curscr_trans,darkscr_bmp_curscr_trans,0,game->get_dither_type(),game->get_dither_arg()); | |
| 29106 | ✗ | } | |
| 29107 | |||
| 29108 | 475 | color_map = &trans_table2; | |
| 29109 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 475 times.
|
475 | if(newscr->flags9 & fDARK_TRANS) //draw the dark as transparent |
| 29110 | ✗ | draw_trans_sprite(framebuf, darkscr_bmp_curscr, dx1, dy1); | |
| 29111 | else | ||
| 29112 | 475 | masked_blit(darkscr_bmp_curscr, framebuf, 0, 0, dx1, dy1, 256, 176); | |
| 29113 | 475 | draw_trans_sprite(framebuf, darkscr_bmp_curscr_trans, dx1, dy1); | |
| 29114 | 475 | color_map = &trans_table; | |
| 29115 | 475 | } | |
| 29116 |
2/2✓ Branch 0 taken 12712 times.
✓ Branch 1 taken 441 times.
|
13153 | if(room_was_dark) |
| 29117 | { | ||
| 29118 |
1/2✓ Branch 0 taken 441 times.
✗ Branch 1 not taken.
|
441 | if(oldscr->flags9 & fDARK_DITHER) //dither the entire bitmap |
| 29119 | { | ||
| 29120 | ✗ | ditherblit(darkscr_bmp_scrollscr,darkscr_bmp_scrollscr,0,game->get_dither_type(),game->get_dither_arg()); | |
| 29121 | ✗ | ditherblit(darkscr_bmp_scrollscr_trans,darkscr_bmp_scrollscr_trans,0,game->get_dither_type(),game->get_dither_arg()); | |
| 29122 | ✗ | } | |
| 29123 | |||
| 29124 | 441 | color_map = &trans_table2; | |
| 29125 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 441 times.
|
441 | if(oldscr->flags9 & fDARK_TRANS) //draw the dark as transparent |
| 29126 | ✗ | draw_trans_sprite(framebuf, darkscr_bmp_scrollscr, dx2, dy2); | |
| 29127 | else | ||
| 29128 | 441 | masked_blit(darkscr_bmp_scrollscr, framebuf, 0, 0, dx2, dy2, 256, 176); | |
| 29129 | 441 | draw_trans_sprite(framebuf, darkscr_bmp_scrollscr_trans, dx2, dy2); | |
| 29130 | 441 | color_map = &trans_table; | |
| 29131 | 441 | } | |
| 29132 | 13153 | set_clip_rect(framebuf, 0, 0, framebuf->w, framebuf->h); | |
| 29133 | 13153 | } | |
| 29134 | 1605186 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_DRAW); | |
| 29135 | |||
| 29136 | //end drawing | ||
| 29137 | 1605186 | FFCore.runGenericPassiveEngine(SCR_TIMING_END_FRAME); | |
| 29138 | 1605186 | advanceframe(true/*,true,false*/); | |
| 29139 | |||
| 29140 | //Don't clear the last frame, unless 'fixed' | ||
| 29141 |
4/4✓ Branch 0 taken 27531 times.
✓ Branch 1 taken 1577655 times.
✓ Branch 2 taken 1699 times.
✓ Branch 3 taken 25832 times.
|
1605186 | if(cx > 0 || get_qr(qr_FIXSCRIPTSDURINGSCROLLING)) |
| 29142 | 1579354 | script_drawing_commands.Clear(); | |
| 29143 | 1605186 | FFCore.runGenericPassiveEngine(SCR_TIMING_START_FRAME); | |
| 29144 | 1605186 | actiontype lastaction = action; | |
| 29145 | 1605186 | action=scrolling; FFCore.setHeroAction(scrolling); | |
| 29146 | 1605186 | FFCore.runF6Engine(); | |
| 29147 | 1605186 | action=lastaction; FFCore.setHeroAction(lastaction); | |
| 29148 | 1605186 | } //end main scrolling loop | |
| 29149 | 27531 | currdmap = olddmap; | |
| 29150 | |||
| 29151 | 27531 | clear_bitmap(msg_txt_display_buf); | |
| 29152 | 27531 | set_clip_state(msg_txt_display_buf, 1); | |
| 29153 | 27531 | clear_bitmap(msg_bg_display_buf); | |
| 29154 | 27531 | set_clip_state(msg_bg_display_buf, 1); | |
| 29155 | 27531 | clear_bitmap(msg_portrait_display_buf); | |
| 29156 | 27531 | set_clip_state(msg_portrait_display_buf, 1); | |
| 29157 | |||
| 29158 | //Move hero to the other side of the screen if scrolling's not turned on | ||
| 29159 |
1/2✓ Branch 0 taken 27531 times.
✗ Branch 1 not taken.
|
27531 | if(get_qr(qr_NOSCROLL)) |
| 29160 | { | ||
| 29161 | ✗ | switch(scrolldir) | |
| 29162 | { | ||
| 29163 | case up: | ||
| 29164 | ✗ | y = 160; | |
| 29165 | ✗ | break; | |
| 29166 | |||
| 29167 | case down: | ||
| 29168 | ✗ | y = 0; | |
| 29169 | ✗ | break; | |
| 29170 | |||
| 29171 | case left: | ||
| 29172 | ✗ | x = 240; | |
| 29173 | ✗ | break; | |
| 29174 | |||
| 29175 | case right: | ||
| 29176 | ✗ | x = 0; | |
| 29177 | ✗ | break; | |
| 29178 | } | ||
| 29179 | ✗ | } | |
| 29180 | |||
| 29181 |
3/4✓ Branch 0 taken 27517 times.
✓ Branch 1 taken 14 times.
✓ Branch 2 taken 27531 times.
✗ Branch 3 not taken.
|
27531 | if((z > 0 || fakez > 0) && isSideViewHero()) |
| 29182 | { | ||
| 29183 | ✗ | y -= z; | |
| 29184 | ✗ | y -= fakez; | |
| 29185 | ✗ | z = 0; | |
| 29186 | ✗ | fakez = 0; | |
| 29187 | ✗ | } | |
| 29188 | |||
| 29189 | 27531 | combotile_add_x = 0; | |
| 29190 | 27531 | combotile_add_y = 0; | |
| 29191 | |||
| 29192 | 27531 | set_respawn_point(false); | |
| 29193 | 27531 | trySideviewLadder(); | |
| 29194 | 27531 | warpx = -1; | |
| 29195 | 27531 | warpy = -1; | |
| 29196 | |||
| 29197 | 27531 | screenscrolling = false; | |
| 29198 | 27531 | FFCore.ScrollingData[SCROLLDATA_DIR] = -1; | |
| 29199 | 27531 | FFCore.ScrollingData[SCROLLDATA_NX] = 0; | |
| 29200 | 27531 | FFCore.ScrollingData[SCROLLDATA_NY] = 0; | |
| 29201 | 27531 | FFCore.ScrollingData[SCROLLDATA_OX] = 0; | |
| 29202 | 27531 | FFCore.ScrollingData[SCROLLDATA_OY] = 0; | |
| 29203 | |||
| 29204 |
2/2✓ Branch 0 taken 958 times.
✓ Branch 1 taken 26573 times.
|
27531 | if(destdmap != -1) |
| 29205 | { | ||
| 29206 | 958 | bool changedlevel = false; | |
| 29207 | 958 | bool changeddmap = false; | |
| 29208 |
2/2✓ Branch 0 taken 139 times.
✓ Branch 1 taken 819 times.
|
958 | if(olddmap != destdmap) |
| 29209 | { | ||
| 29210 | 819 | timeExitAllGenscript(GENSCR_ST_CHANGE_DMAP); | |
| 29211 | 819 | changeddmap = true; | |
| 29212 | 819 | } | |
| 29213 |
2/2✓ Branch 0 taken 814 times.
✓ Branch 1 taken 144 times.
|
958 | if(DMaps[olddmap].level != DMaps[destdmap].level) |
| 29214 | { | ||
| 29215 | 144 | timeExitAllGenscript(GENSCR_ST_CHANGE_LEVEL); | |
| 29216 | 144 | changedlevel = true; | |
| 29217 | 144 | } | |
| 29218 | 958 | dlevel = DMaps[destdmap].level; | |
| 29219 | 958 | currdmap = destdmap; | |
| 29220 |
2/2✓ Branch 0 taken 139 times.
✓ Branch 1 taken 819 times.
|
958 | if(changeddmap) |
| 29221 | { | ||
| 29222 | 819 | throwGenScriptEvent(GENSCR_EVENT_CHANGE_DMAP); | |
| 29223 | 819 | } | |
| 29224 |
2/2✓ Branch 0 taken 814 times.
✓ Branch 1 taken 144 times.
|
958 | if(changedlevel) |
| 29225 | { | ||
| 29226 | 144 | throwGenScriptEvent(GENSCR_EVENT_CHANGE_LEVEL); | |
| 29227 | 144 | } | |
| 29228 | 958 | } | |
| 29229 | |||
| 29230 | //if Hero is going from non-water to water, and we set his animation to "hopping" above, we must now | ||
| 29231 | //change it to swimming - since we have manually moved Hero onto the first tile, the hopping code | ||
| 29232 | //will get confused and try to hop Hero onto the next (possibly nonexistant) water tile in his current | ||
| 29233 | //direction. -DD | ||
| 29234 | |||
| 29235 |
2/2✓ Branch 0 taken 27183 times.
✓ Branch 1 taken 348 times.
|
27531 | if(nowinwater) |
| 29236 | { | ||
| 29237 | 348 | SetSwim(); | |
| 29238 | 348 | hopclk = 0xFF; | |
| 29239 | 348 | } | |
| 29240 | |||
| 29241 | // NES behaviour: Fade to light after scrolling | ||
| 29242 | 27531 | lighting(false, false); // No, we don't need to set naturaldark... | |
| 29243 | |||
| 29244 | 27531 | init_dmap(); | |
| 29245 | 27531 | putscr(scrollbuf,0,0,newscr); | |
| 29246 | 27531 | putscrdoors(scrollbuf,0,0,newscr); | |
| 29247 | |||
| 29248 | // Check for raft flags | ||
| 29249 |
4/4✓ Branch 0 taken 1158 times.
✓ Branch 1 taken 26373 times.
✓ Branch 2 taken 57 times.
✓ Branch 3 taken 25536 times.
|
53124 | if((get_qr(qr_BROKEN_RAFT_SCROLL) || lastaction == rafting) |
| 29250 |
4/4✓ Branch 0 taken 25919 times.
✓ Branch 1 taken 1612 times.
✓ Branch 2 taken 25593 times.
✓ Branch 3 taken 326 times.
|
27531 | && action!=rafting && hopclk==0 && !toogam) |
| 29251 | { | ||
| 29252 |
3/4✓ Branch 0 taken 25531 times.
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 25531 times.
|
25536 | if(MAPFLAG(x,y)==mfRAFT||MAPCOMBOFLAG(x,y)==mfRAFT) |
| 29253 | { | ||
| 29254 | 5 | sfx(tmpscr->secretsfx); | |
| 29255 | 5 | action=rafting; FFCore.setHeroAction(rafting); | |
| 29256 | 5 | raftclk=0; | |
| 29257 | 5 | } | |
| 29258 | |||
| 29259 | // Half a tile off? | ||
| 29260 |
6/8✓ Branch 0 taken 19376 times.
✓ Branch 1 taken 6155 times.
✓ Branch 2 taken 6910 times.
✓ Branch 3 taken 12466 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 13065 times.
✓ Branch 6 taken 25531 times.
✗ Branch 7 not taken.
|
38596 | else if((dir==left || dir==right) && (MAPFLAG(x,y+8)==mfRAFT||MAPCOMBOFLAG(x,y+8)==mfRAFT)) |
| 29261 | { | ||
| 29262 | ✗ | sfx(tmpscr->secretsfx); | |
| 29263 | ✗ | action=rafting; FFCore.setHeroAction(rafting); | |
| 29264 | ✗ | raftclk=0; | |
| 29265 | ✗ | } | |
| 29266 | 25536 | } | |
| 29267 | |||
| 29268 | 27531 | opendoors=0; | |
| 29269 | 27531 | markBmap(-1); | |
| 29270 | |||
| 29271 |
2/2✓ Branch 0 taken 18827 times.
✓ Branch 1 taken 8704 times.
|
27531 | if(isdungeon()) |
| 29272 | { | ||
| 29273 |
4/4✓ Branch 0 taken 5100 times.
✓ Branch 1 taken 1694 times.
✓ Branch 2 taken 1904 times.
✓ Branch 3 taken 6 times.
|
8704 | switch(tmpscr->door[scrolldir^1]) |
| 29274 | { | ||
| 29275 | case dNONE: | ||
| 29276 | 6 | dir = scrolldir; | |
| 29277 | 6 | break; | |
| 29278 | case dOPEN: | ||
| 29279 | case dUNLOCKED: | ||
| 29280 | case dOPENBOSS: | ||
| 29281 | 5100 | dir = scrolldir; | |
| 29282 | |||
| 29283 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5100 times.
|
5100 | if(action!=rafting) |
| 29284 | 5100 | stepforward(diagonalMovement?11:12, false); | |
| 29285 | |||
| 29286 | 5100 | break; | |
| 29287 | |||
| 29288 | case dSHUTTER: | ||
| 29289 | case d1WAYSHUTTER: | ||
| 29290 | 1694 | dir = scrolldir; | |
| 29291 | |||
| 29292 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1694 times.
|
1694 | if(action!=rafting) |
| 29293 | 1694 | stepforward(diagonalMovement?21:24, false); | |
| 29294 | |||
| 29295 | 1694 | putdoor(scrollbuf,0,scrolldir^1,tmpscr->door[scrolldir^1]); | |
| 29296 | 1694 | opendoors=-4; | |
| 29297 | 1694 | sfx(WAV_DOOR); | |
| 29298 | 1694 | break; | |
| 29299 | |||
| 29300 | default: | ||
| 29301 | 1904 | dir = scrolldir; | |
| 29302 | |||
| 29303 |
2/2✓ Branch 0 taken 47 times.
✓ Branch 1 taken 1857 times.
|
1904 | if(action!=rafting) |
| 29304 | 1857 | stepforward(diagonalMovement?21:24, false); | |
| 29305 | 1904 | } | |
| 29306 | 8704 | } | |
| 29307 | |||
| 29308 |
1/2✓ Branch 0 taken 27531 times.
✗ Branch 1 not taken.
|
27531 | if(isForceFaceUp) dir = up; |
| 29309 | |||
| 29310 |
1/2✓ Branch 0 taken 27531 times.
✗ Branch 1 not taken.
|
27531 | if(action == scrolling) |
| 29311 | { | ||
| 29312 | ✗ | action=none; FFCore.setHeroAction(none); | |
| 29313 | ✗ | } | |
| 29314 | |||
| 29315 |
3/4✓ Branch 0 taken 27499 times.
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 27499 times.
|
27531 | if(action != attacking && action != sideswimattacking) |
| 29316 | { | ||
| 29317 | 27499 | charging = 0; | |
| 29318 | 27499 | tapping = false; | |
| 29319 | 27499 | } | |
| 29320 | |||
| 29321 | 27531 | map_bkgsfx(true); | |
| 29322 | |||
| 29323 |
2/2✓ Branch 0 taken 27497 times.
✓ Branch 1 taken 34 times.
|
27531 | if(newscr->flags2&fSECRET) |
| 29324 | { | ||
| 29325 | 34 | sfx(newscr->secretsfx); | |
| 29326 | 34 | } | |
| 29327 | |||
| 29328 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27531 times.
|
27531 | if (updatemusic) |
| 29329 | { | ||
| 29330 | 27531 | playLevelMusic(); | |
| 29331 |
1/2✓ Branch 0 taken 27531 times.
✗ Branch 1 not taken.
|
27531 | if (musicrevert) |
| 29332 | ✗ | FFCore.music_update_cond = MUSIC_UPDATE_SCREEN; | |
| 29333 | 27531 | } | |
| 29334 | |||
| 29335 | // It happens that all decorations that are not drawn with an offset | ||
| 29336 | // are temporary sprites (like combo sprites) that should never carry over. | ||
| 29337 |
2/2✓ Branch 0 taken 684 times.
✓ Branch 1 taken 27531 times.
|
28215 | for (int i = decorations.Count()-1; i >=0; i--) |
| 29338 | { | ||
| 29339 | 684 | auto sprite = (decoration*)decorations.spr(i); | |
| 29340 |
2/2✓ Branch 0 taken 677 times.
✓ Branch 1 taken 7 times.
|
684 | if (!sprite->is_drawn_with_offset()) |
| 29341 | 7 | decorations.remove(sprite); // TODO: improve deletions by adding remove_by_index | |
| 29342 | 684 | } | |
| 29343 | |||
| 29344 | 27531 | newscr_clk = frame; | |
| 29345 | 27531 | activated_timed_warp=false; | |
| 29346 | 27531 | loadside = scrolldir^1; | |
| 29347 | 27531 | FFCore.clear_combo_scripts(); | |
| 29348 | 27531 | eventlog_mapflags(); | |
| 29349 | 27531 | decorations.animate(); //continue to animate tall grass during scrolling | |
| 29350 |
2/2✓ Branch 0 taken 25832 times.
✓ Branch 1 taken 1699 times.
|
27531 | if(get_qr(qr_FIXSCRIPTSDURINGSCROLLING)) |
| 29351 | { | ||
| 29352 |
4/4✓ Branch 0 taken 46 times.
✓ Branch 1 taken 1653 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 40 times.
|
1699 | if(olddmap == newdmap || (replay_version_check(0, 15))) |
| 29353 | { | ||
| 29354 | 1659 | ZScriptVersion::RunScrollingScript(scrolldir, cx, sx, sy, end_frames, false); //Prewaitdraw | |
| 29355 | 1659 | } | |
| 29356 | 1699 | } | |
| 29357 |
2/2✓ Branch 0 taken 26090 times.
✓ Branch 1 taken 1441 times.
|
27531 | if(!get_qr(qr_SCROLLWARP_NO_RESET_FRAME)) |
| 29358 | 1441 | GameFlags |= GAMEFLAG_RESET_GAME_LOOP; | |
| 29359 | 27534 | } | |
| 29360 | |||
| 29361 | |||
| 29362 | |||
| 29363 | // How much to reduce Hero's damage, taking into account various rings. | ||
| 29364 | 15167 | int32_t HeroClass::ringpower(int32_t dmg, bool noPeril, bool noRing) | |
| 29365 | { | ||
| 29366 |
1/2✓ Branch 0 taken 15167 times.
✗ Branch 1 not taken.
|
15167 | if(dmg < 0) return dmg; //Don't reduce healing |
| 29367 |
2/2✓ Branch 0 taken 14443 times.
✓ Branch 1 taken 724 times.
|
15167 | if ( get_qr(qr_BROKEN_RING_POWER) ) |
| 29368 | { | ||
| 29369 | 14443 | int32_t divisor = 1; | |
| 29370 | 14443 | float percentage = 1; | |
| 29371 | 14443 | int32_t itemid = current_item_id(itype_ring); | |
| 29372 | 14443 | bool usering = false; | |
| 29373 | |||
| 29374 |
4/4✓ Branch 0 taken 10813 times.
✓ Branch 1 taken 3630 times.
✓ Branch 2 taken 324 times.
✓ Branch 3 taken 10489 times.
|
14443 | if(itemid>-1 && !noRing) // current_item_id checks magic cost for rings |
| 29375 | { | ||
| 29376 | 10489 | usering = true; | |
| 29377 | 10489 | paymagiccost(itemid); | |
| 29378 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10489 times.
|
10489 | if(itemsbuf[itemid].flags & item_flag2)//"Divisor is Percentage Multiplier" flag |
| 29379 | { | ||
| 29380 | ✗ | percentage *= itemsbuf[itemid].power/100.0; | |
| 29381 | ✗ | } | |
| 29382 | else | ||
| 29383 | { | ||
| 29384 | 10489 | divisor *= itemsbuf[itemid].power; | |
| 29385 | } | ||
| 29386 | 10489 | } | |
| 29387 | |||
| 29388 | /* Now for the Peril Ring */ | ||
| 29389 | 14443 | itemid = current_item_id(itype_perilring); | |
| 29390 | |||
| 29391 |
8/10✓ Branch 0 taken 2844 times.
✓ Branch 1 taken 11599 times.
✓ Branch 2 taken 2698 times.
✓ Branch 3 taken 146 times.
✓ Branch 4 taken 402 times.
✓ Branch 5 taken 2296 times.
✓ Branch 6 taken 402 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 402 times.
|
14443 | if(itemid>-1 && !noPeril && game->get_life()<=itemsbuf[itemid].misc1*game->get_hp_per_heart() && checkmagiccost(itemid) && checkbunny(itemid)) |
| 29392 | { | ||
| 29393 | 402 | usering = true; | |
| 29394 | 402 | paymagiccost(itemid); | |
| 29395 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 402 times.
|
402 | if(itemsbuf[itemid].flags & item_flag2)//"Divisor is Percentage Multiplier" flag |
| 29396 | { | ||
| 29397 | ✗ | percentage *= itemsbuf[itemid].power/100.0; | |
| 29398 | ✗ | } | |
| 29399 | else | ||
| 29400 | { | ||
| 29401 | 402 | divisor *= itemsbuf[itemid].power; | |
| 29402 | } | ||
| 29403 | 402 | } | |
| 29404 | |||
| 29405 | // Ring divisor of 0 = no damage. -L | ||
| 29406 |
4/6✓ Branch 0 taken 10507 times.
✓ Branch 1 taken 3936 times.
✓ Branch 2 taken 10507 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 10507 times.
|
14443 | if(usering && (divisor==0 || percentage==0)) //Change dto allow negative power rings. -Z |
| 29407 | ✗ | return 0; | |
| 29408 | |||
| 29409 |
1/2✓ Branch 0 taken 14443 times.
✗ Branch 1 not taken.
|
14443 | if( percentage < 0 ) percentage = (percentage * -1) + 1; //Negative percentage = that percent MORE damage -V |
| 29410 | |||
| 29411 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14443 times.
|
14443 | if ( divisor < 0 ) return dmg * percentage * (divisor*-1); |
| 29412 |
1/2✓ Branch 0 taken 14443 times.
✗ Branch 1 not taken.
|
14443 | return dmg*percentage/( divisor != 0 ? divisor : 1 ); //zc_max(divisor, 1); // well, better safe... |
| 29413 | |||
| 29414 | } | ||
| 29415 | else | ||
| 29416 | { | ||
| 29417 | 724 | double divisor = 1; | |
| 29418 | 724 | double percentage = 1; | |
| 29419 | 724 | int32_t itemid = current_item_id(itype_ring); | |
| 29420 | 724 | bool usering = false; | |
| 29421 | |||
| 29422 |
3/4✓ Branch 0 taken 3 times.
✓ Branch 1 taken 721 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
|
724 | if(itemid>-1 && !noRing) // current_item_id checks magic cost for rings |
| 29423 | { | ||
| 29424 | 3 | usering = true; | |
| 29425 | 3 | paymagiccost(itemid); | |
| 29426 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
|
3 | if(itemsbuf[itemid].flags & item_flag2)//"Divisor is Percentage Multiplier" flag |
| 29427 | { | ||
| 29428 | 1 | double perc = itemsbuf[itemid].power/100.0; | |
| 29429 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if(perc < 0) perc = -perc + 1; //Negative percentage = that percent MORE damage -V |
| 29430 | 1 | percentage *= perc; | |
| 29431 | 1 | } | |
| 29432 | else | ||
| 29433 | { | ||
| 29434 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if(itemsbuf[itemid].power < 0) |
| 29435 | ✗ | divisor /= -(itemsbuf[itemid].power); | |
| 29436 | 2 | else divisor *= itemsbuf[itemid].power; | |
| 29437 | } | ||
| 29438 | 3 | } | |
| 29439 | |||
| 29440 | /* Now for the Peril Ring */ | ||
| 29441 | 724 | itemid = current_item_id(itype_perilring); | |
| 29442 | |||
| 29443 |
4/10✓ Branch 0 taken 2 times.
✓ Branch 1 taken 722 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
724 | if(itemid>-1 && !noPeril && game->get_life()<=itemsbuf[itemid].misc1*game->get_hp_per_heart() && checkmagiccost(itemid) && checkbunny(itemid)) |
| 29444 | { | ||
| 29445 | ✗ | usering = true; | |
| 29446 | ✗ | paymagiccost(itemid); | |
| 29447 | ✗ | if(itemsbuf[itemid].flags & item_flag2)//"Divisor is Percentage Multiplier" flag | |
| 29448 | { | ||
| 29449 | ✗ | double perc = itemsbuf[itemid].power/100.0; | |
| 29450 | ✗ | if(perc < 0) perc = -perc + 1; //Negative percentage = that percent MORE damage -V | |
| 29451 | ✗ | percentage *= perc; | |
| 29452 | ✗ | } | |
| 29453 | else | ||
| 29454 | { | ||
| 29455 | ✗ | if(itemsbuf[itemid].power < 0) | |
| 29456 | ✗ | divisor /= -(itemsbuf[itemid].power); | |
| 29457 | ✗ | else divisor *= itemsbuf[itemid].power; | |
| 29458 | } | ||
| 29459 | ✗ | } | |
| 29460 | |||
| 29461 | // Ring divisor of 0 = no damage. -L | ||
| 29462 |
4/6✓ Branch 0 taken 3 times.
✓ Branch 1 taken 721 times.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 3 times.
|
724 | if(usering && (divisor==0 || percentage==0)) //Change dto allow negative power rings. -Z |
| 29463 | ✗ | return 0; | |
| 29464 | |||
| 29465 | //if ( divisor < 0 ) return dmg * percentage * (divisor*-1); //handle this further up now | ||
| 29466 |
1/2✓ Branch 0 taken 724 times.
✗ Branch 1 not taken.
|
724 | return dmg*percentage/( divisor != 0 ? divisor : 1 ); //zc_max(divisor, 1); // well, better safe... |
| 29467 | } | ||
| 29468 | 15167 | } | |
| 29469 | |||
| 29470 | // Should swinging the hammer make the 'pound' sound? | ||
| 29471 | // Or is Hero just hitting air? | ||
| 29472 | 6470 | bool HeroClass::sideviewhammerpound() | |
| 29473 | { | ||
| 29474 | 6470 | int32_t wx=0,wy=0; | |
| 29475 | |||
| 29476 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 1022 times.
✓ Branch 2 taken 1520 times.
✓ Branch 3 taken 2131 times.
✓ Branch 4 taken 1797 times.
|
6470 | switch(dir) |
| 29477 | { | ||
| 29478 | case up: | ||
| 29479 | 1022 | wx=-1; | |
| 29480 | 1022 | wy=-15; | |
| 29481 | |||
| 29482 |
1/2✓ Branch 0 taken 1022 times.
✗ Branch 1 not taken.
|
1022 | if(isSideViewHero()) wy+=8; |
| 29483 | |||
| 29484 | 1022 | break; | |
| 29485 | |||
| 29486 | case down: | ||
| 29487 | 1520 | wx=8; | |
| 29488 | 1520 | wy=28; | |
| 29489 | |||
| 29490 |
1/2✓ Branch 0 taken 1520 times.
✗ Branch 1 not taken.
|
1520 | if(isSideViewHero()) wy-=8; |
| 29491 | |||
| 29492 | 1520 | break; | |
| 29493 | |||
| 29494 | case left: | ||
| 29495 | 2131 | wx=-8; | |
| 29496 | 2131 | wy=14; | |
| 29497 | |||
| 29498 |
2/2✓ Branch 0 taken 2125 times.
✓ Branch 1 taken 6 times.
|
2131 | if(isSideViewHero()) wy+=8; |
| 29499 | |||
| 29500 | 2131 | break; | |
| 29501 | |||
| 29502 | case right: | ||
| 29503 | 1797 | wx=21; | |
| 29504 | 1797 | wy=14; | |
| 29505 | |||
| 29506 |
1/2✓ Branch 0 taken 1797 times.
✗ Branch 1 not taken.
|
1797 | if(isSideViewHero()) wy+=8; |
| 29507 | |||
| 29508 | 1797 | break; | |
| 29509 | } | ||
| 29510 | |||
| 29511 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 6464 times.
|
6470 | if(!isSideViewHero()) |
| 29512 | { | ||
| 29513 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 6455 times.
|
6464 | return (COMBOTYPE(x+wx,y+wy)!=cSHALLOWWATER && !iswaterex(MAPCOMBO(x+wx,y+wy), currmap, currscr, -1, x+wx,y+wy)); |
| 29514 | } | ||
| 29515 | |||
| 29516 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
|
6 | if(_walkflag(x+wx,y+wy,0,SWITCHBLOCK_STATE)) return true; |
| 29517 | |||
| 29518 | ✗ | if(dir==left || dir==right) | |
| 29519 | { | ||
| 29520 | ✗ | wx+=16; | |
| 29521 | |||
| 29522 | ✗ | if(_walkflag(x+wx,y+wy,0,SWITCHBLOCK_STATE)) return true; | |
| 29523 | ✗ | } | |
| 29524 | |||
| 29525 | ✗ | return false; | |
| 29526 | 6470 | } | |
| 29527 | |||
| 29528 | // The following are only used for Hero damage. Damage is in quarter hearts. | ||
| 29529 | 9139 | int32_t enemy_dp(int32_t index) | |
| 29530 | { | ||
| 29531 | 9139 | return (((enemy*)guys.spr(index))->dp)*(game->get_ene_dmgmult()); | |
| 29532 | } | ||
| 29533 | |||
| 29534 | 5422 | int32_t ewpn_dp(int32_t index) | |
| 29535 | { | ||
| 29536 | 5422 | return (((weapon*)Ewpns.spr(index))->power)*(game->get_ene_dmgmult()); | |
| 29537 | } | ||
| 29538 | |||
| 29539 | 43 | int32_t lwpn_dp(int32_t index) | |
| 29540 | { | ||
| 29541 | 43 | return (((weapon*)Lwpns.spr(index))->power)*(game->get_ene_dmgmult()); | |
| 29542 | } | ||
| 29543 | |||
| 29544 | 135985215 | bool checkbunny(int32_t itemid) | |
| 29545 | { | ||
| 29546 |
3/4✓ Branch 0 taken 135899131 times.
✓ Branch 1 taken 86084 times.
✓ Branch 2 taken 86084 times.
✗ Branch 3 not taken.
|
135985215 | return !Hero.BunnyClock() || (itemid > 0 && itemsbuf[itemid].flags&item_bunny_enabled); |
| 29547 | } | ||
| 29548 | |||
| 29549 | 16722744 | bool usesSwordJinx(int32_t itemid) | |
| 29550 | { | ||
| 29551 | 16722744 | itemdata const& it = itemsbuf[itemid]; | |
| 29552 | 16722744 | bool ret = (it.family==itype_sword); | |
| 29553 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16722744 times.
|
16722744 | if(it.flags & item_flip_jinx) return !ret; |
| 29554 | 16722744 | return ret; | |
| 29555 | 16722744 | } | |
| 29556 | 40289638 | bool checkitem_jinx(int32_t itemid) | |
| 29557 | { | ||
| 29558 | 40289638 | itemdata const& it = itemsbuf[itemid]; | |
| 29559 |
2/2✓ Branch 0 taken 4150 times.
✓ Branch 1 taken 40285488 times.
|
40289638 | if(it.flags & item_jinx_immune) return true; |
| 29560 |
2/2✓ Branch 0 taken 31137174 times.
✓ Branch 1 taken 9148314 times.
|
40285488 | if (it.family == itype_shield){ |
| 29561 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 31137174 times.
|
31137174 | if(HeroShieldClk() != 0) return false; |
| 29562 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 31137174 times.
|
31137174 | if(it.flags & !item_flag9) //Active Shields should also check sword/item jinx flags |
| 29563 | { | ||
| 29564 | ✗ | if (usesSwordJinx(itemid)) return HeroSwordClk() == 0; | |
| 29565 | ✗ | return HeroItemClk() == 0; | |
| 29566 | } | ||
| 29567 | 31137174 | return true; | |
| 29568 | |||
| 29569 | } | ||
| 29570 |
2/2✓ Branch 0 taken 8341262 times.
✓ Branch 1 taken 807052 times.
|
9148314 | if(usesSwordJinx(itemid)) return HeroSwordClk() == 0; |
| 29571 | 807052 | return HeroItemClk() == 0; | |
| 29572 | 40289638 | } | |
| 29573 | |||
| 29574 | 2 | void stopCaneOfByrna() | |
| 29575 | { | ||
| 29576 |
2/2✓ Branch 0 taken 40 times.
✓ Branch 1 taken 2 times.
|
42 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 29577 | { | ||
| 29578 | 40 | weapon *w = ((weapon*)Lwpns.spr(i)); | |
| 29579 |
2/2✓ Branch 0 taken 38 times.
✓ Branch 1 taken 2 times.
|
40 | if(w->id==wCByrna) |
| 29580 | 2 | w->dead=1; | |
| 29581 | 40 | } | |
| 29582 | 2 | } | |
| 29583 | |||
| 29584 | /* Crashes if used by ffscript.cpp, in case LINKITEMD | ||
| 29585 | void stopCaneOfByrna() | ||
| 29586 | { | ||
| 29587 | byte prnt_cane = -1; | ||
| 29588 | weapon *ew = (weapon*)(Lwpns.spr(Lwpns.idFirst(wCByrna))); | ||
| 29589 | prnt_cane = ew->parentitem; | ||
| 29590 | for(int32_t i=0; i<Lwpns.Count(); i++) | ||
| 29591 | { | ||
| 29592 | weapon *w = ((weapon*)Lwpns.spr(i)); | ||
| 29593 | |||
| 29594 | if(w->id==wCByrna) | ||
| 29595 | { | ||
| 29596 | w->dead=1; | ||
| 29597 | } | ||
| 29598 | } | ||
| 29599 | if ( prnt_cane > -1 ) | ||
| 29600 | { | ||
| 29601 | stop_sfx(itemsbuf[prnt_cane].usesound); | ||
| 29602 | } | ||
| 29603 | } | ||
| 29604 | */ | ||
| 29605 | //Check if there are no beams, kill sfx, and reset last_cane_of_byrna_item_id | ||
| 29606 | 14150934 | void HeroClass::cleanupByrna() | |
| 29607 | { | ||
| 29608 |
2/2✓ Branch 0 taken 14150857 times.
✓ Branch 1 taken 77 times.
|
14150934 | if ( last_cane_of_byrna_item_id > -1 ) |
| 29609 | { | ||
| 29610 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 75 times.
|
77 | if ( !(Lwpns.idCount(wCByrna)) ) |
| 29611 | { | ||
| 29612 | 2 | stop_sfx(itemsbuf[last_cane_of_byrna_item_id].usesound); | |
| 29613 | 2 | last_cane_of_byrna_item_id = -1; | |
| 29614 | 2 | } | |
| 29615 | 77 | } | |
| 29616 | 14150934 | } | |
| 29617 | |||
| 29618 | // Used to find out if an item family is attached to one of the buttons currently pressed. | ||
| 29619 | 4414437 | bool isWpnPressed(int32_t itype) | |
| 29620 | { | ||
| 29621 |
4/4✓ Branch 0 taken 527509 times.
✓ Branch 1 taken 3886928 times.
✓ Branch 2 taken 463054 times.
✓ Branch 3 taken 64455 times.
|
4414437 | if((itype==getItemFamily(itemsbuf,Bwpn)) && DrunkcBbtn()) return true; |
| 29622 |
4/4✓ Branch 0 taken 1586352 times.
✓ Branch 1 taken 2763630 times.
✓ Branch 2 taken 653346 times.
✓ Branch 3 taken 933006 times.
|
4349982 | if((itype==getItemFamily(itemsbuf,Awpn)) && DrunkcAbtn()) return true; |
| 29623 |
4/4✓ Branch 0 taken 1430 times.
✓ Branch 1 taken 3415546 times.
✓ Branch 2 taken 566 times.
✓ Branch 3 taken 864 times.
|
3416976 | if((itype==getItemFamily(itemsbuf,Xwpn)) && DrunkcEx1btn()) return true; |
| 29624 |
4/4✓ Branch 0 taken 62 times.
✓ Branch 1 taken 3416050 times.
✓ Branch 2 taken 35 times.
✓ Branch 3 taken 27 times.
|
3416112 | if((itype==getItemFamily(itemsbuf,Ywpn)) && DrunkcEx2btn()) return true; |
| 29625 | 3416077 | return false; | |
| 29626 | 4414437 | } | |
| 29627 | |||
| 29628 | 13584021 | int32_t getWpnPressed(int32_t itype) | |
| 29629 | { | ||
| 29630 |
4/4✓ Branch 0 taken 402438 times.
✓ Branch 1 taken 13181583 times.
✓ Branch 2 taken 393732 times.
✓ Branch 3 taken 8706 times.
|
13584021 | if((itype==getItemFamily(itemsbuf,Bwpn)) && DrunkcBbtn()) return Bwpn&0xFFF; |
| 29631 |
3/4✓ Branch 0 taken 28064 times.
✓ Branch 1 taken 13547251 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 28064 times.
|
13575315 | if((itype==getItemFamily(itemsbuf,Awpn)) && DrunkcAbtn()) return Awpn&0xFFF; |
| 29632 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 13547251 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
13547251 | if((itype==getItemFamily(itemsbuf,Xwpn)) && DrunkcEx1btn()) return Xwpn&0xFFF; |
| 29633 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 13547251 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
13547251 | if((itype==getItemFamily(itemsbuf,Ywpn)) && DrunkcEx2btn()) return Ywpn&0xFFF; |
| 29634 | |||
| 29635 | 13547251 | return -1; | |
| 29636 | 13584021 | } | |
| 29637 | |||
| 29638 | 14153429 | int32_t getRocsPressed() | |
| 29639 | { | ||
| 29640 | 14153429 | int32_t jumpid = current_item_id(itype_rocs,true,true); | |
| 29641 | |||
| 29642 |
2/2✓ Branch 0 taken 348254 times.
✓ Branch 1 taken 13805175 times.
|
14153429 | if(unsigned(jumpid) >= MAXITEMS) jumpid = -1; |
| 29643 | |||
| 29644 |
2/2✓ Branch 0 taken 13805175 times.
✓ Branch 1 taken 348254 times.
|
14153429 | if (jumpid != -1) |
| 29645 | { | ||
| 29646 | 348254 | itemdata const& itm = itemsbuf[jumpid]; | |
| 29647 | |||
| 29648 | 348254 | byte intbtn = byte(itm.misc2&0xFF); | |
| 29649 |
1/2✓ Branch 0 taken 348254 times.
✗ Branch 1 not taken.
|
348254 | if(getIntBtnInput(intbtn, false, true, false, false, true)) |
| 29650 | ✗ | return jumpid; //not pressed | |
| 29651 | 348254 | } | |
| 29652 | |||
| 29653 |
4/4✓ Branch 0 taken 121155 times.
✓ Branch 1 taken 14032274 times.
✓ Branch 2 taken 115578 times.
✓ Branch 3 taken 5577 times.
|
14153429 | if((itype_rocs==getItemFamily(itemsbuf,Bwpn)) && DrunkcBbtn()) |
| 29654 | 5577 | return Bwpn; | |
| 29655 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 14147852 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
14147852 | if((itype_rocs==getItemFamily(itemsbuf,Awpn)) && DrunkcAbtn()) |
| 29656 | ✗ | return Awpn; | |
| 29657 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 14147852 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
14147852 | if((itype_rocs==getItemFamily(itemsbuf,Xwpn)) && DrunkcEx1btn()) |
| 29658 | ✗ | return Xwpn; | |
| 29659 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 14147852 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
14147852 | if((itype_rocs==getItemFamily(itemsbuf,Ywpn)) && DrunkcEx2btn()) |
| 29660 | ✗ | return Ywpn; | |
| 29661 | |||
| 29662 | 14147852 | return -1; | |
| 29663 | 14153429 | } | |
| 29664 | |||
| 29665 | ✗ | bool isItmPressed(int32_t itmid) | |
| 29666 | { | ||
| 29667 | ✗ | if(itmid==(NEG_OR_MASK(Bwpn,0xFFF)) && DrunkcBbtn()) return true; | |
| 29668 | ✗ | if(itmid==(NEG_OR_MASK(Awpn,0xFFF)) && DrunkcAbtn()) return true; | |
| 29669 | ✗ | if(itmid==(NEG_OR_MASK(Xwpn,0xFFF)) && DrunkcEx1btn()) return true; | |
| 29670 | ✗ | if(itmid==(NEG_OR_MASK(Ywpn,0xFFF)) && DrunkcEx2btn()) return true; | |
| 29671 | ✗ | return false; | |
| 29672 | ✗ | } | |
| 29673 | |||
| 29674 | //helper function | ||
| 29675 | 23779 | static void selectNextBTNWpn(int32_t type, word& wpos, int32_t& BTNwpn, | |
| 29676 | int32_t& directItemBTN, word f1 = 255, word f2 = 255, word f3 = 255) | ||
| 29677 | { | ||
| 29678 |
1/2✓ Branch 0 taken 23779 times.
✗ Branch 1 not taken.
|
23779 | if(!new_subscreen_active) |
| 29679 | ✗ | return; | |
| 29680 | 23779 | byte pgn = wpos&0xFF, pos = wpos>>8; | |
| 29681 | 23779 | bool empty = pgn==255; | |
| 29682 |
3/4✓ Branch 0 taken 9898 times.
✓ Branch 1 taken 13881 times.
✓ Branch 2 taken 9898 times.
✗ Branch 3 not taken.
|
23779 | if(empty && get_qr(qr_NO_BUTTON_VERIFY)) return; //intentional nothingness |
| 29683 |
2/2✓ Branch 0 taken 9898 times.
✓ Branch 1 taken 13881 times.
|
23779 | SubscrPage* pg = new_subscreen_active->get_page(pgn==255?new_subscreen_active->curpage:pgn); |
| 29684 |
1/2✓ Branch 0 taken 23779 times.
✗ Branch 1 not taken.
|
23779 | if(!pg) |
| 29685 | ✗ | return; | |
| 29686 |
4/6✓ Branch 0 taken 22490 times.
✓ Branch 1 taken 1289 times.
✓ Branch 2 taken 1289 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1289 times.
|
23779 | auto fp1 = ((f1&0xFF)==255) ? 255 : ((empty || (f1&0xFF)==(wpos&0xFF)) ? f1 : 255); |
| 29687 |
4/6✓ Branch 0 taken 23775 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
|
23779 | auto fp2 = ((f2&0xFF)==255) ? 255 : ((empty || (f2&0xFF)==(wpos&0xFF)) ? f2 : 255); |
| 29688 |
4/6✓ Branch 0 taken 23775 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
|
23779 | auto fp3 = ((f3&0xFF)==255) ? 255 : ((empty || (f3&0xFF)==(wpos&0xFF)) ? f3 : 255); |
| 29689 | 23779 | auto ret = pg->movepos_legacy(type, wpos, fp1, fp2, fp3); | |
| 29690 |
2/2✓ Branch 0 taken 9898 times.
✓ Branch 1 taken 13881 times.
|
23779 | if((ret&0xFF) == 0xFF) |
| 29691 | 9898 | BTNwpn = -1; | |
| 29692 | 13881 | else BTNwpn = pg->get_item_pos(ret>>8); | |
| 29693 |
2/2✓ Branch 0 taken 13881 times.
✓ Branch 1 taken 9898 times.
|
23779 | directItemBTN = NEG_OR_MASK(BTNwpn,0xFFF); |
| 29694 | 23779 | wpos = ret; | |
| 29695 | 23779 | } | |
| 29696 | 5585 | void selectNextAWpn(int32_t type) | |
| 29697 | { | ||
| 29698 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5585 times.
|
5585 | if(!get_qr(qr_SELECTAWPN)) |
| 29699 | ✗ | return; | |
| 29700 |
2/4✓ Branch 0 taken 5585 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5585 times.
|
5585 | selectNextBTNWpn(type, game->awpn, Awpn, directItemA, COND_BWPN, COND_XWPN, COND_YWPN); |
| 29701 | 5585 | } | |
| 29702 | |||
| 29703 | 18194 | void selectNextBWpn(int32_t type) | |
| 29704 | { | ||
| 29705 |
1/2✓ Branch 0 taken 18194 times.
✗ Branch 1 not taken.
|
18194 | if(!new_subscreen_active) |
| 29706 | ✗ | return; | |
| 29707 |
6/6✓ Branch 0 taken 12890 times.
✓ Branch 1 taken 5304 times.
✓ Branch 2 taken 18190 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 18190 times.
|
18194 | selectNextBTNWpn(type, game->bwpn, Bwpn, directItemB, COND_AWPN, COND_XWPN, COND_YWPN); |
| 29708 | 18194 | } | |
| 29709 | |||
| 29710 | ✗ | void selectNextXWpn(int32_t type) | |
| 29711 | { | ||
| 29712 | ✗ | if(!get_qr(qr_SET_XBUTTON_ITEMS)) return; | |
| 29713 | ✗ | if(!new_subscreen_active) | |
| 29714 | ✗ | return; | |
| 29715 | ✗ | selectNextBTNWpn(type, game->xwpn, Xwpn, directItemX, COND_BWPN, COND_AWPN, COND_YWPN); | |
| 29716 | ✗ | } | |
| 29717 | |||
| 29718 | ✗ | void selectNextYWpn(int32_t type) | |
| 29719 | { | ||
| 29720 | ✗ | if(!get_qr(qr_SET_YBUTTON_ITEMS)) return; | |
| 29721 | ✗ | if(!new_subscreen_active) | |
| 29722 | ✗ | return; | |
| 29723 | ✗ | selectNextBTNWpn(type, game->ywpn, Ywpn, directItemY, COND_BWPN, COND_XWPN, COND_AWPN); | |
| 29724 | ✗ | } | |
| 29725 | |||
| 29726 | //helper function | ||
| 29727 | 31046495 | static void verifyWpn(word& wpos, int32_t& BTNwpn, int32_t& directItemBTN, word f1 = 255, word f2 = 255, word f3 = 255) | |
| 29728 | { | ||
| 29729 |
2/2✓ Branch 0 taken 31039137 times.
✓ Branch 1 taken 7358 times.
|
31046495 | if(!new_subscreen_active) |
| 29730 | 7358 | return; | |
| 29731 | 31039137 | byte pgn = wpos&0xFF, pos = wpos>>8; | |
| 29732 | 31039137 | bool empty = pgn==255; | |
| 29733 |
4/4✓ Branch 0 taken 2455997 times.
✓ Branch 1 taken 28583140 times.
✓ Branch 2 taken 919907 times.
✓ Branch 3 taken 1536090 times.
|
31039137 | if(empty && get_qr(qr_NO_BUTTON_VERIFY)) return; //intentional nothingness |
| 29734 |
2/2✓ Branch 0 taken 919907 times.
✓ Branch 1 taken 28583140 times.
|
29503047 | SubscrPage* pg = new_subscreen_active->get_page(pgn==255?new_subscreen_active->curpage:pgn); |
| 29735 |
1/2✓ Branch 0 taken 29503047 times.
✗ Branch 1 not taken.
|
29503047 | if(!pg) |
| 29736 | ✗ | return; | |
| 29737 |
5/6✓ Branch 0 taken 22368570 times.
✓ Branch 1 taken 7134477 times.
✓ Branch 2 taken 7076711 times.
✓ Branch 3 taken 57766 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 7076711 times.
|
29503047 | auto fp1 = ((f1&0xFF)==255) ? 255 : ((empty || (f1&0xFF)==(wpos&0xFF)) ? f1 : 255); |
| 29738 |
5/6✓ Branch 0 taken 24080718 times.
✓ Branch 1 taken 5422329 times.
✓ Branch 2 taken 5422289 times.
✓ Branch 3 taken 40 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5422289 times.
|
29503047 | auto fp2 = ((f2&0xFF)==255) ? 255 : ((empty || (f2&0xFF)==(wpos&0xFF)) ? f2 : 255); |
| 29739 |
5/6✓ Branch 0 taken 24884019 times.
✓ Branch 1 taken 4619028 times.
✓ Branch 2 taken 4618990 times.
✓ Branch 3 taken 38 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 4618990 times.
|
29503047 | auto fp3 = ((f3&0xFF)==255) ? 255 : ((empty || (f3&0xFF)==(wpos&0xFF)) ? f3 : 255); |
| 29740 | 29503047 | wpos = pg->movepos_legacy(SEL_VERIFY_RIGHT, wpos, fp1, fp2, fp3); | |
| 29741 |
2/2✓ Branch 0 taken 919838 times.
✓ Branch 1 taken 28583209 times.
|
29503047 | if((wpos&0xFF) == 0xFF) |
| 29742 | 919838 | BTNwpn = -1; | |
| 29743 | 28583209 | else BTNwpn = pg->get_item_pos(wpos>>8); | |
| 29744 |
2/2✓ Branch 0 taken 28320324 times.
✓ Branch 1 taken 1182723 times.
|
29503047 | directItemBTN = NEG_OR_MASK(BTNwpn,0xFFF); |
| 29745 | 31046495 | } | |
| 29746 | |||
| 29747 | 23880955 | void verifyAWpn() | |
| 29748 | { | ||
| 29749 |
2/2✓ Branch 0 taken 1019 times.
✓ Branch 1 taken 23879936 times.
|
23880955 | if (game->forced_awpn != -1) |
| 29750 | 1019 | return; | |
| 29751 |
2/2✓ Branch 0 taken 1419315 times.
✓ Branch 1 taken 22460621 times.
|
23879936 | if(!get_qr(qr_SELECTAWPN)) |
| 29752 | { | ||
| 29753 | 22460621 | Awpn = selectSword(); | |
| 29754 | 22460621 | game->awpn = 255; | |
| 29755 | 22460621 | } | |
| 29756 | else | ||
| 29757 | { | ||
| 29758 |
4/4✓ Branch 0 taken 873805 times.
✓ Branch 1 taken 545510 times.
✓ Branch 2 taken 545510 times.
✓ Branch 3 taken 873805 times.
|
1419315 | verifyWpn(game->awpn, Awpn, directItemA, COND_BWPN, COND_XWPN, COND_YWPN); |
| 29759 | } | ||
| 29760 | 23880955 | } | |
| 29761 | |||
| 29762 | 23874655 | void verifyBWpn() | |
| 29763 | { | ||
| 29764 |
2/2✓ Branch 0 taken 1013 times.
✓ Branch 1 taken 23873642 times.
|
23874655 | if (game->forced_bwpn != -1) |
| 29765 | 1013 | return; | |
| 29766 |
6/6✓ Branch 0 taken 1418494 times.
✓ Branch 1 taken 22455148 times.
✓ Branch 2 taken 2876769 times.
✓ Branch 3 taken 20996873 times.
✓ Branch 4 taken 2876769 times.
✓ Branch 5 taken 20996873 times.
|
23873642 | verifyWpn(game->bwpn, Bwpn, directItemB, COND_AWPN, COND_XWPN, COND_YWPN); |
| 29767 | 23874655 | } | |
| 29768 | |||
| 29769 | 23874655 | void verifyXWpn() | |
| 29770 | { | ||
| 29771 |
2/2✓ Branch 0 taken 1013 times.
✓ Branch 1 taken 23873642 times.
|
23874655 | if (game->forced_xwpn != -1) |
| 29772 | 1013 | return; | |
| 29773 |
2/2✓ Branch 0 taken 2876769 times.
✓ Branch 1 taken 20996873 times.
|
23873642 | if(!get_qr(qr_SET_XBUTTON_ITEMS)) |
| 29774 | 20996873 | return; | |
| 29775 |
3/4✓ Branch 0 taken 2331951 times.
✓ Branch 1 taken 544818 times.
✓ Branch 2 taken 2876769 times.
✗ Branch 3 not taken.
|
2876769 | verifyWpn(game->xwpn, Xwpn, directItemX, COND_BWPN, COND_AWPN, COND_YWPN); |
| 29776 | 23874655 | } | |
| 29777 | |||
| 29778 | 23874655 | void verifyYWpn() | |
| 29779 | { | ||
| 29780 |
2/2✓ Branch 0 taken 1013 times.
✓ Branch 1 taken 23873642 times.
|
23874655 | if (game->forced_ywpn != -1) |
| 29781 | 1013 | return; | |
| 29782 |
2/2✓ Branch 0 taken 2876769 times.
✓ Branch 1 taken 20996873 times.
|
23873642 | if(!get_qr(qr_SET_YBUTTON_ITEMS)) |
| 29783 | 20996873 | return; | |
| 29784 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 2876769 times.
✓ Branch 2 taken 544818 times.
✓ Branch 3 taken 2331951 times.
|
2876769 | verifyWpn(game->ywpn, Ywpn, directItemY, COND_BWPN, COND_XWPN, COND_AWPN); |
| 29785 | 23874655 | } | |
| 29786 | |||
| 29787 | 23874655 | void verifyBothWeapons() | |
| 29788 | { | ||
| 29789 | 23874655 | verifyAWpn(); | |
| 29790 | 23874655 | verifyBWpn(); | |
| 29791 | 23874655 | verifyXWpn(); | |
| 29792 | 23874655 | verifyYWpn(); | |
| 29793 | 23874655 | } | |
| 29794 | |||
| 29795 | // Select the sword for the A button if the 'select A button weapon' quest rule isn't set. | ||
| 29796 | 22460975 | int32_t selectSword() | |
| 29797 | { | ||
| 29798 | 22460975 | return current_item_id(itype_sword); | |
| 29799 | } | ||
| 29800 | |||
| 29801 | // Adding code here for allowing hardcoding a button to a specific itemclass. | ||
| 29802 | ✗ | int32_t selectItemclass(int32_t itemclass) | |
| 29803 | { | ||
| 29804 | ✗ | int32_t ret = current_item_id(itemclass); | |
| 29805 | |||
| 29806 | ✗ | if(ret == -1) | |
| 29807 | ✗ | ret = 0; | |
| 29808 | |||
| 29809 | ✗ | return ret; | |
| 29810 | } | ||
| 29811 | |||
| 29812 | // Used for the 'Pickup Hearts' item pickup condition. | ||
| 29813 | 302 | bool canget(int32_t id) | |
| 29814 | { | ||
| 29815 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 302 times.
|
302 | return id>=0 && (game->get_maxlife()>=(itemsbuf[id].pickup_hearts*game->get_hp_per_heart())); |
| 29816 | } | ||
| 29817 | |||
| 29818 | 63 | void dospecialmoney(int32_t index) | |
| 29819 | { | ||
| 29820 | 63 | int32_t tmp=currscr>=128?1:0; | |
| 29821 | 63 | int32_t priceindex = ((item*)items.spr(index))->PriceIndex; | |
| 29822 | |||
| 29823 |
4/7✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
✓ Branch 2 taken 20 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 15 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 12 times.
|
63 | switch(tmpscr[tmp].room) |
| 29824 | { | ||
| 29825 | case rINFO: // pay for info | ||
| 29826 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | if(prices[priceindex]!=100000 ) // 100000 is a placeholder price for free items |
| 29827 | { | ||
| 29828 | |||
| 29829 | |||
| 29830 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | if(!current_item_power(itype_wallet)) |
| 29831 | { | ||
| 29832 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | if (game->get_spendable_rupies() < abs(prices[priceindex])) |
| 29833 | ✗ | return; | |
| 29834 | 16 | int32_t tmpprice = -abs(prices[priceindex]); | |
| 29835 | 16 | int32_t total = game->get_drupy()-tmpprice; | |
| 29836 | 16 | total = vbound(total, 0, game->get_maxcounter(1)); //Never overflow! Overflow here causes subscreen bugs! -Z | |
| 29837 | 16 | game->set_drupy(game->get_drupy()-total); | |
| 29838 | //game->change_drupy(-abs(prices[priceindex])); | ||
| 29839 | 16 | } | |
| 29840 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if ( current_item_power(itype_wallet)>0 ) |
| 29841 | { | ||
| 29842 | ✗ | game->change_drupy(0); | |
| 29843 | ✗ | } | |
| 29844 | 16 | } | |
| 29845 | 16 | rectfill(msg_bg_display_buf, 0, 0, msg_bg_display_buf->w, 80, 0); | |
| 29846 | 16 | rectfill(msg_txt_display_buf, 0, 0, msg_txt_display_buf->w, 80, 0); | |
| 29847 | 16 | donewmsg(QMisc.info[tmpscr[tmp].catchall].str[priceindex]); | |
| 29848 | 16 | clear_bitmap(pricesdisplaybuf); | |
| 29849 | 16 | set_clip_state(pricesdisplaybuf, 1); | |
| 29850 | 16 | items.del(0); | |
| 29851 | |||
| 29852 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 16 times.
|
64 | for(int32_t i=0; i<items.Count(); i++) |
| 29853 | 48 | ((item*)items.spr(i))->pickup=ipDUMMY; | |
| 29854 | |||
| 29855 | // Prevent the prices from being displayed anymore | ||
| 29856 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 16 times.
|
64 | for(int32_t i=0; i<3; i++) |
| 29857 | { | ||
| 29858 | 48 | prices[i] = 0; | |
| 29859 | 48 | } | |
| 29860 | |||
| 29861 | 16 | break; | |
| 29862 | |||
| 29863 | case rMONEY: // secret money | ||
| 29864 | { | ||
| 29865 | 20 | ((item*)items.spr(0))->pickup = ipDUMMY; | |
| 29866 | |||
| 29867 | 20 | prices[0] = tmpscr[tmp].catchall; | |
| 29868 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
|
20 | if (!current_item_power(itype_wallet)) |
| 29869 | 20 | game->change_drupy(prices[0]); | |
| 29870 | //game->set_drupy(game->get_drupy()+price); may be needed everywhere | ||
| 29871 | |||
| 29872 | 20 | putprices(false); | |
| 29873 |
2/2✓ Branch 0 taken 19 times.
✓ Branch 1 taken 1 times.
|
20 | setmapflag((currscr < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM); |
| 29874 | 20 | break; | |
| 29875 | } | ||
| 29876 | |||
| 29877 | case rGAMBLE: // gamble | ||
| 29878 | { | ||
| 29879 | ✗ | if(game->get_spendable_rupies()<10 && !current_item_power(itype_wallet)) return; //Why 10? | |
| 29880 | |||
| 29881 | ✗ | unsigned si=(zc_oldrand()%24)*3; | |
| 29882 | |||
| 29883 | ✗ | for(int32_t i=0; i<3; i++) | |
| 29884 | ✗ | prices[i]=gambledat[si++]; | |
| 29885 | |||
| 29886 | ✗ | game->set_drupy(game->get_drupy()+prices[priceindex]); | |
| 29887 | ✗ | putprices(true); | |
| 29888 | |||
| 29889 | ✗ | for(int32_t i=1; i<4; i++) | |
| 29890 | ✗ | ((item*)items.spr(i))->pickup=ipDUMMY; | |
| 29891 | } | ||
| 29892 | ✗ | break; | |
| 29893 | |||
| 29894 | case rBOMBS: | ||
| 29895 | { | ||
| 29896 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
15 | if(game->get_spendable_rupies()<tmpscr[tmp].catchall && !current_item_power(itype_wallet)) |
| 29897 | ✗ | return; | |
| 29898 | |||
| 29899 | 15 | int32_t price = -tmpscr[tmp].catchall; | |
| 29900 | 15 | int32_t wmedal = current_item_id(itype_wealthmedal); | |
| 29901 |
1/2✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
|
15 | if(wmedal >= 0) |
| 29902 | { | ||
| 29903 | ✗ | if(itemsbuf[wmedal].flags & item_flag1) | |
| 29904 | ✗ | price*=(itemsbuf[wmedal].misc1/100.0); | |
| 29905 | else | ||
| 29906 | ✗ | price+=itemsbuf[wmedal].misc1; | |
| 29907 | ✗ | } | |
| 29908 | |||
| 29909 | 15 | int32_t total = game->get_drupy()-price; | |
| 29910 | 15 | total = vbound(total, 0, game->get_maxcounter(1)); //Never overflow! Overflow here causes subscreen bugs! -Z | |
| 29911 | 15 | game->set_drupy(game->get_drupy()-total); | |
| 29912 | //game->set_drupy(game->get_drupy()+price); | ||
| 29913 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15 times.
|
15 | setmapflag((currscr < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM); |
| 29914 | 15 | game->change_maxbombs(4); | |
| 29915 | 15 | game->set_bombs(game->get_maxbombs()); | |
| 29916 | { | ||
| 29917 | 15 | int32_t div = zinit.bomb_ratio; | |
| 29918 | |||
| 29919 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15 times.
|
15 | if(div > 0) |
| 29920 | 15 | game->change_maxcounter(4/div, 6); | |
| 29921 | } | ||
| 29922 | |||
| 29923 | //also give Hero an actual Bomb item | ||
| 29924 |
2/2✓ Branch 0 taken 3840 times.
✓ Branch 1 taken 15 times.
|
3855 | for(int32_t i=0; i<MAXITEMS; i++) |
| 29925 | { | ||
| 29926 |
4/4✓ Branch 0 taken 17 times.
✓ Branch 1 taken 3823 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 15 times.
|
3840 | if(itemsbuf[i].family == itype_bomb && itemsbuf[i].fam_type == 1) |
| 29927 | 15 | getitem(i, true, true); | |
| 29928 | 3840 | } | |
| 29929 | |||
| 29930 | 15 | ((item*)items.spr(index))->pickup=ipDUMMY+ipFADE; | |
| 29931 | 15 | fadeclk=66; | |
| 29932 | 15 | dismissmsg(); | |
| 29933 | 15 | clear_bitmap(pricesdisplaybuf); | |
| 29934 | 15 | set_clip_state(pricesdisplaybuf, 1); | |
| 29935 | 15 | verifyBothWeapons(); | |
| 29936 | 15 | break; | |
| 29937 | } | ||
| 29938 | |||
| 29939 | case rARROWS: | ||
| 29940 | { | ||
| 29941 | ✗ | if(game->get_spendable_rupies()<tmpscr[tmp].catchall && !current_item_power(itype_wallet)) | |
| 29942 | ✗ | return; | |
| 29943 | |||
| 29944 | ✗ | int32_t price = -tmpscr[tmp].catchall; | |
| 29945 | ✗ | int32_t wmedal = current_item_id(itype_wealthmedal); | |
| 29946 | ✗ | if(wmedal >= 0) | |
| 29947 | { | ||
| 29948 | ✗ | if(itemsbuf[wmedal].flags & item_flag1) | |
| 29949 | ✗ | price*=(itemsbuf[wmedal].misc1/100.0); | |
| 29950 | else | ||
| 29951 | ✗ | price+=itemsbuf[wmedal].misc1; | |
| 29952 | ✗ | } | |
| 29953 | |||
| 29954 | ✗ | int32_t total = game->get_drupy()-price; | |
| 29955 | ✗ | total = vbound(total, 0, game->get_maxcounter(1)); //Never overflow! Overflow here causes subscreen bugs! -Z | |
| 29956 | ✗ | game->set_drupy(game->get_drupy()-total); | |
| 29957 | |||
| 29958 | //game->set_drupy(game->get_drupy()+price); | ||
| 29959 | ✗ | setmapflag((currscr < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM); | |
| 29960 | ✗ | game->change_maxarrows(10); | |
| 29961 | ✗ | game->set_arrows(game->get_maxarrows()); | |
| 29962 | ✗ | ((item*)items.spr(index))->pickup=ipDUMMY+ipFADE; | |
| 29963 | ✗ | fadeclk=66; | |
| 29964 | ✗ | dismissmsg(); | |
| 29965 | ✗ | clear_bitmap(pricesdisplaybuf); | |
| 29966 | ✗ | set_clip_state(pricesdisplaybuf, 1); | |
| 29967 | ✗ | verifyBothWeapons(); | |
| 29968 | ✗ | break; | |
| 29969 | } | ||
| 29970 | |||
| 29971 | case rSWINDLE: | ||
| 29972 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
12 | if(items.spr(index)->id==iRupy) |
| 29973 | { | ||
| 29974 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
12 | if(game->get_spendable_rupies()<tmpscr[tmp].catchall && !current_item_power(itype_wallet)) |
| 29975 | ✗ | return; | |
| 29976 | 12 | int32_t tmpprice = -tmpscr[tmp].catchall; | |
| 29977 | 12 | int32_t total = game->get_drupy()-tmpprice; | |
| 29978 | 12 | total = vbound(total, 0, game->get_maxcounter(1)); //Never overflow! Overflow here causes subscreen bugs! -Z | |
| 29979 | 12 | game->set_drupy(game->get_drupy()-total); | |
| 29980 | 12 | } | |
| 29981 | else | ||
| 29982 | { | ||
| 29983 | ✗ | if(game->get_maxlife()<=game->get_hp_per_heart()) | |
| 29984 | ✗ | return; | |
| 29985 | |||
| 29986 | ✗ | game->set_life(zc_max(game->get_life()-game->get_hp_per_heart(),0)); | |
| 29987 | ✗ | game->set_maxlife(zc_max(game->get_maxlife()-game->get_hp_per_heart(),(game->get_hp_per_heart()))); | |
| 29988 | } | ||
| 29989 | |||
| 29990 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
12 | setmapflag((currscr < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM); |
| 29991 | 12 | ((item*)items.spr(0))->pickup=ipDUMMY+ipFADE; | |
| 29992 | 12 | ((item*)items.spr(1))->pickup=ipDUMMY+ipFADE; | |
| 29993 | 12 | fadeclk=66; | |
| 29994 | 12 | dismissmsg(); | |
| 29995 | 12 | clear_bitmap(pricesdisplaybuf); | |
| 29996 | 12 | set_clip_state(pricesdisplaybuf, 1); | |
| 29997 | 12 | break; | |
| 29998 | } | ||
| 29999 | 63 | } | |
| 30000 | |||
| 30001 | 21849 | void getitem(int32_t id, bool nosound, bool doRunPassive) | |
| 30002 | { | ||
| 30003 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21849 times.
|
21849 | if(unsigned(id) >= MAXITEMS) |
| 30004 | ✗ | return; | |
| 30005 | |||
| 30006 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21849 times.
|
21849 | if (replay_is_active()) |
| 30007 |
1/2✓ Branch 0 taken 21849 times.
✗ Branch 1 not taken.
|
21849 | replay_step_comment(fmt::format("getitem {}", item_string[id])); |
| 30008 | |||
| 30009 |
2/2✓ Branch 0 taken 21372 times.
✓ Branch 1 taken 477 times.
|
21849 | if(get_qr(qr_SCC_ITEM_COMBINES_ITEMS)) |
| 30010 | { | ||
| 30011 | 477 | int32_t nextitem = -1; | |
| 30012 | 477 | do | |
| 30013 | { | ||
| 30014 | 477 | nextitem = -1; | |
| 30015 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 477 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
477 | if((itemsbuf[id].flags & item_combine) && game->get_item(id)) |
| 30016 | // Item upgrade routine. | ||
| 30017 | { | ||
| 30018 | |||
| 30019 | ✗ | for(int32_t i=0; i<MAXITEMS; i++) | |
| 30020 | { | ||
| 30021 | // Find the item which is as close to this item's fam_type as possible. | ||
| 30022 | ✗ | if(itemsbuf[i].family==itemsbuf[id].family && itemsbuf[i].fam_type>itemsbuf[id].fam_type | |
| 30023 | ✗ | && (nextitem>-1 ? itemsbuf[i].fam_type<=itemsbuf[nextitem].fam_type : true)) | |
| 30024 | { | ||
| 30025 | ✗ | nextitem = i; | |
| 30026 | ✗ | } | |
| 30027 | ✗ | } | |
| 30028 | |||
| 30029 | ✗ | if(nextitem>-1) | |
| 30030 | { | ||
| 30031 | ✗ | id = nextitem; | |
| 30032 | ✗ | if(!get_qr(qr_ITEMCOMBINE_CONTINUOUS)) | |
| 30033 | ✗ | break; //no looping | |
| 30034 | ✗ | } | |
| 30035 | ✗ | } | |
| 30036 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 477 times.
|
477 | } while(nextitem > -1); |
| 30037 | 477 | } | |
| 30038 | |||
| 30039 | 21849 | itemdata const& idat = itemsbuf[id&0xFF]; | |
| 30040 | |||
| 30041 | 43698 | bool equipment = idat.flags & | |
| 30042 | 21849 | ((idat.family == itype_triforcepiece) ? item_flag8 : item_gamedata); | |
| 30043 | |||
| 30044 |
2/2✓ Branch 0 taken 19818 times.
✓ Branch 1 taken 2031 times.
|
21849 | if(equipment) |
| 30045 | { | ||
| 30046 | // Fix boomerang sounds. | ||
| 30047 | 2031 | int32_t itemid = current_item_id(idat.family); | |
| 30048 | |||
| 30049 |
4/6✓ Branch 0 taken 1111 times.
✓ Branch 1 taken 920 times.
✓ Branch 2 taken 1092 times.
✓ Branch 3 taken 19 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
2031 | if(itemid>=0 && (idat.family == itype_brang || idat.family == itype_divineprotection |
| 30050 |
5/6✓ Branch 0 taken 1092 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1090 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 1089 times.
✓ Branch 5 taken 1 times.
|
1092 | || idat.family == itype_hookshot || idat.family == itype_switchhook || idat.family == itype_cbyrna) |
| 30051 | 1111 | && sfx_allocated(itemsbuf[itemid].usesound) | |
| 30052 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1111 times.
|
1111 | && idat.usesound != itemsbuf[itemid].usesound) |
| 30053 | { | ||
| 30054 | ✗ | stop_sfx(itemsbuf[itemid].usesound); | |
| 30055 | ✗ | cont_sfx(idat.usesound); | |
| 30056 | ✗ | } | |
| 30057 | |||
| 30058 | 2031 | int32_t curitm = current_item_id(idat.family); | |
| 30059 |
0/2✗ Branch 0 not taken.
✗ Branch 1 not taken.
|
2031 | if(!get_qr(qr_KEEPOLD_APPLIES_RETROACTIVELY) |
| 30060 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2031 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2031 | || curitm < 0 || (itemsbuf[curitm].fam_type <= idat.fam_type) |
| 30061 | ✗ | || (itemsbuf[curitm].flags & item_keep_old)) | |
| 30062 | { | ||
| 30063 | 2031 | game->set_item(id,true); | |
| 30064 | 2031 | passiveitem_script(id, doRunPassive); | |
| 30065 | 2031 | } | |
| 30066 | |||
| 30067 |
2/2✓ Branch 0 taken 742 times.
✓ Branch 1 taken 1289 times.
|
2031 | if(!(idat.flags & item_keep_old)) |
| 30068 | { | ||
| 30069 |
4/4✓ Branch 0 taken 1125 times.
✓ Branch 1 taken 164 times.
✓ Branch 2 taken 35 times.
✓ Branch 3 taken 1090 times.
|
1289 | if(!get_qr(qr_BROKEN_KEEPOLD_FLAG) || current_item(idat.family)<idat.fam_type) |
| 30070 | { | ||
| 30071 | 199 | removeLowerLevelItemsOfFamily(game,itemsbuf,idat.family, idat.fam_type); | |
| 30072 | 199 | } | |
| 30073 | 1289 | } | |
| 30074 | |||
| 30075 | // NES consistency: replace all flying boomerangs with the current boomerang. | ||
| 30076 |
2/2✓ Branch 0 taken 1977 times.
✓ Branch 1 taken 54 times.
|
2031 | if(idat.family==itype_brang) |
| 30077 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 54 times.
|
55 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 30078 | { | ||
| 30079 | 1 | weapon *w = ((weapon*)Lwpns.spr(i)); | |
| 30080 | |||
| 30081 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if(w->id==wBrang) |
| 30082 | { | ||
| 30083 | ✗ | w->LOADGFX(idat.wpn); | |
| 30084 | ✗ | } | |
| 30085 | 55 | } | |
| 30086 | 2031 | } | |
| 30087 | |||
| 30088 |
2/2✓ Branch 0 taken 2943 times.
✓ Branch 1 taken 18906 times.
|
21849 | if(idat.count!=-1) |
| 30089 | { | ||
| 30090 |
2/2✓ Branch 0 taken 18465 times.
✓ Branch 1 taken 441 times.
|
18906 | if(idat.setmax) |
| 30091 | { | ||
| 30092 | // Bomb bags are a special case; they may be set not to increase super bombs | ||
| 30093 |
5/6✓ Branch 0 taken 19 times.
✓ Branch 1 taken 422 times.
✓ Branch 2 taken 19 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 16 times.
✓ Branch 5 taken 3 times.
|
441 | if(idat.family==itype_bombbag && idat.count==2 && (idat.flags&16)==0) |
| 30094 | { | ||
| 30095 | 3 | int32_t max = game->get_maxbombs(); | |
| 30096 | |||
| 30097 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | if(max<idat.max) max=idat.max; |
| 30098 | |||
| 30099 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | game->set_maxbombs(zc_min(game->get_maxbombs()+idat.setmax,max), false); |
| 30100 | 3 | } | |
| 30101 | else | ||
| 30102 | { | ||
| 30103 | 438 | int32_t max = game->get_maxcounter(idat.count); | |
| 30104 | |||
| 30105 |
2/2✓ Branch 0 taken 85 times.
✓ Branch 1 taken 353 times.
|
438 | if(max<idat.max) max=idat.max; |
| 30106 | |||
| 30107 |
2/2✓ Branch 0 taken 282 times.
✓ Branch 1 taken 156 times.
|
438 | game->set_maxcounter(zc_min(game->get_maxcounter(idat.count)+idat.setmax,max), idat.count); |
| 30108 | } | ||
| 30109 | 441 | } | |
| 30110 | |||
| 30111 | // Amount is an uint16_t, but the range is -9999 to 16383 | ||
| 30112 | // -1 is actually 16385 ... -9999 is 26383, and 0x8000 means use the drain counter | ||
| 30113 |
2/2✓ Branch 0 taken 297 times.
✓ Branch 1 taken 18609 times.
|
18906 | if(idat.amount&0x3FFF) |
| 30114 | { | ||
| 30115 |
2/2✓ Branch 0 taken 10742 times.
✓ Branch 1 taken 7867 times.
|
18609 | if(idat.amount&0x8000) |
| 30116 | 21484 | game->set_dcounter( | |
| 30117 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 10741 times.
|
10742 | game->get_dcounter(idat.count)+((idat.amount&0x4000)?-(idat.amount&0x3FFF):idat.amount&0x3FFF), idat.count); |
| 30118 | else | ||
| 30119 | { | ||
| 30120 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 7867 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
7867 | if(idat.amount>=16385 && game->get_counter(0)<=idat.amount-16384) |
| 30121 | ✗ | game->set_counter(0, idat.count); | |
| 30122 | else | ||
| 30123 | // This is too confusing to try and change... | ||
| 30124 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 7867 times.
✓ Branch 2 taken 3678 times.
✓ Branch 3 taken 4189 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 3678 times.
|
7867 | game->set_counter(zc_min(game->get_counter(idat.count)+((idat.amount&0x4000)?-(idat.amount&0x3FFF):idat.amount&0x3FFF),game->get_maxcounter(idat.count)), idat.count); |
| 30125 | } | ||
| 30126 | 18609 | } | |
| 30127 | 18906 | } | |
| 30128 | |||
| 30129 |
4/4✓ Branch 0 taken 21814 times.
✓ Branch 1 taken 35 times.
✓ Branch 2 taken 567 times.
✓ Branch 3 taken 21247 times.
|
21849 | if(idat.playsound&&!nosound) |
| 30130 | { | ||
| 30131 | 21247 | sfx(idat.playsound); | |
| 30132 | 21247 | } | |
| 30133 | |||
| 30134 | //add lower-level items | ||
| 30135 |
2/2✓ Branch 0 taken 21793 times.
✓ Branch 1 taken 56 times.
|
21849 | if(idat.flags&item_gain_old) |
| 30136 | { | ||
| 30137 |
2/2✓ Branch 0 taken 43 times.
✓ Branch 1 taken 56 times.
|
99 | for(int32_t i=idat.fam_type-1; i>0; i--) |
| 30138 | { | ||
| 30139 | 43 | int32_t potid = getItemID(itemsbuf, idat.family, i); | |
| 30140 | |||
| 30141 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 43 times.
|
43 | if(potid != -1) |
| 30142 | { | ||
| 30143 | 43 | game->set_item(potid, true); | |
| 30144 | 43 | } | |
| 30145 | 43 | } | |
| 30146 | 56 | } | |
| 30147 | |||
| 30148 |
12/14✓ Branch 0 taken 45 times.
✓ Branch 1 taken 20069 times.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 475 times.
✓ Branch 6 taken 126 times.
✓ Branch 7 taken 5 times.
✓ Branch 8 taken 100 times.
✓ Branch 9 taken 89 times.
✓ Branch 10 taken 72 times.
✓ Branch 11 taken 722 times.
✓ Branch 12 taken 119 times.
✓ Branch 13 taken 24 times.
|
21849 | switch(idat.family) |
| 30149 | { | ||
| 30150 | case itype_itmbundle: | ||
| 30151 | { | ||
| 30152 | 18 | int ids[10] = {idat.misc1, idat.misc2, idat.misc3, idat.misc4, idat.misc5, | |
| 30153 | 15 | idat.misc6, idat.misc7, idat.misc8, idat.misc9, idat.misc10}; | |
| 30154 | 3 | bool pscript = (idat.flags & item_flag1); | |
| 30155 |
2/2✓ Branch 0 taken 30 times.
✓ Branch 1 taken 3 times.
|
33 | for(auto q = 0; q < 10; ++q) |
| 30156 | { | ||
| 30157 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 30 times.
|
30 | if(unsigned(ids[q]) >= MAXITEMS) continue; |
| 30158 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 10 times.
|
30 | if(pscript) |
| 30159 | 10 | collectitem_script(ids[q]); | |
| 30160 | 30 | getitem(ids[q], true, true); | |
| 30161 | 30 | } | |
| 30162 | } | ||
| 30163 | 3 | break; | |
| 30164 | |||
| 30165 | case itype_progressive_itm: | ||
| 30166 | { | ||
| 30167 | ✗ | int32_t newid = get_progressive_item(idat); | |
| 30168 | ✗ | if(newid > -1) | |
| 30169 | ✗ | getitem(newid, nosound, true); | |
| 30170 | } | ||
| 30171 | ✗ | break; | |
| 30172 | |||
| 30173 | case itype_bottlefill: | ||
| 30174 | { | ||
| 30175 | ✗ | if(idat.misc1) | |
| 30176 | { | ||
| 30177 | ✗ | game->fillBottle(idat.misc1); | |
| 30178 | ✗ | } | |
| 30179 | } | ||
| 30180 | ✗ | break; | |
| 30181 | |||
| 30182 | case itype_clock: | ||
| 30183 | { | ||
| 30184 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 475 times.
|
475 | if(idat.flags & item_flag1) //Active use, not passive |
| 30185 | ✗ | break; | |
| 30186 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 475 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
475 | if((idat.flags & item_flag2) && clockclk) //"Can't activate while clock active" |
| 30187 | ✗ | break; | |
| 30188 | 475 | setClock(watch=true); | |
| 30189 | |||
| 30190 |
2/2✓ Branch 0 taken 243200 times.
✓ Branch 1 taken 475 times.
|
243675 | for(int32_t i=0; i<eMAXGUYS; i++) |
| 30191 | 243200 | clock_zoras[i]=0; | |
| 30192 | |||
| 30193 | 475 | clockclk=itemsbuf[id&0xFF].misc1; | |
| 30194 | 475 | sfx(idat.usesound); | |
| 30195 | } | ||
| 30196 | 475 | break; | |
| 30197 | |||
| 30198 | case itype_lkey: | ||
| 30199 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 126 times.
|
126 | if(game->lvlkeys[dlevel]<255) game->lvlkeys[dlevel]++; |
| 30200 | 126 | break; | |
| 30201 | |||
| 30202 | case itype_ring: | ||
| 30203 | case itype_magicring: | ||
| 30204 |
6/6✓ Branch 0 taken 22 times.
✓ Branch 1 taken 23 times.
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 14 times.
✓ Branch 4 taken 6 times.
✓ Branch 5 taken 2 times.
|
45 | if((get_qr(qr_OVERWORLDTUNIC) != 0) || (currscr<128 || dlevel)) |
| 30205 | { | ||
| 30206 | 43 | ringcolor(false); | |
| 30207 | 43 | } | |
| 30208 | 45 | break; | |
| 30209 | |||
| 30210 | case itype_whispring: | ||
| 30211 | { | ||
| 30212 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
5 | if(idat.flags & item_flag1) |
| 30213 | { | ||
| 30214 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if(HeroSwordClk()==-1) setSwordClk(150); // Let's not bother applying the divisor. |
| 30215 | |||
| 30216 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if(HeroItemClk()==-1) setItemClk(150); // Let's not bother applying the divisor. |
| 30217 | |||
| 30218 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if(HeroItemClk()== 1) setShieldClk(150); // Let's not bother applying the divisor. |
| 30219 | 5 | } | |
| 30220 | |||
| 30221 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 2 times.
|
5 | if(idat.power==0) |
| 30222 | { | ||
| 30223 | 2 | setSwordClk(0); | |
| 30224 | 2 | setItemClk(0); | |
| 30225 | 2 | setShieldClk(0); | |
| 30226 | 2 | } | |
| 30227 | |||
| 30228 | 5 | break; | |
| 30229 | } | ||
| 30230 | |||
| 30231 | |||
| 30232 | case itype_map: | ||
| 30233 | 100 | game->lvlitems[dlevel]|=liMAP; | |
| 30234 | 100 | break; | |
| 30235 | |||
| 30236 | case itype_compass: | ||
| 30237 | 89 | game->lvlitems[dlevel]|=liCOMPASS; | |
| 30238 | 89 | break; | |
| 30239 | |||
| 30240 | case itype_bosskey: | ||
| 30241 | 72 | game->lvlitems[dlevel]|=liBOSSKEY; | |
| 30242 | 72 | break; | |
| 30243 | |||
| 30244 | case itype_fairy: | ||
| 30245 | |||
| 30246 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 722 times.
✓ Branch 2 taken 205 times.
✓ Branch 3 taken 517 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 205 times.
|
722 | game->set_life(zc_min(game->get_life()+(idat.flags&item_flag1 ?(int32_t)(game->get_maxlife()*(idat.misc1/100.0)):((idat.misc1*game->get_hp_per_heart()))),game->get_maxlife())); |
| 30247 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 722 times.
✓ Branch 2 taken 115 times.
✓ Branch 3 taken 607 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 115 times.
|
722 | game->set_magic(zc_min(game->get_magic()+(idat.flags&item_flag2 ?(int32_t)(game->get_maxmagic()*(idat.misc2/100.0)):((idat.misc2*game->get_mp_per_block()))),game->get_maxmagic())); |
| 30248 | 722 | break; | |
| 30249 | |||
| 30250 | case itype_heartpiece: | ||
| 30251 | 119 | game->change_HCpieces(1); | |
| 30252 | |||
| 30253 |
2/2✓ Branch 0 taken 93 times.
✓ Branch 1 taken 26 times.
|
119 | if(game->get_HCpieces()<game->get_hcp_per_hc()) |
| 30254 | 93 | break; | |
| 30255 | |||
| 30256 | 26 | game->set_HCpieces(0); | |
| 30257 | |||
| 30258 | 26 | getitem(heart_container_id()); | |
| 30259 | 26 | break; | |
| 30260 | |||
| 30261 | case itype_killem: | ||
| 30262 | { | ||
| 30263 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | if(idat.flags & item_flag1) //Active use, not passive |
| 30264 | ✗ | break; | |
| 30265 | 24 | kill_em_all(); | |
| 30266 | 24 | sfx(idat.usesound); | |
| 30267 | } | ||
| 30268 | 24 | break; | |
| 30269 | } | ||
| 30270 | |||
| 30271 | 21849 | flushItemCache(); | |
| 30272 | 21849 | update_subscreens(); | |
| 30273 | 21849 | refresh_subscr_items(); | |
| 30274 | 21849 | verifyBothWeapons(); | |
| 30275 | 21849 | } | |
| 30276 | |||
| 30277 | 9 | void takeitem(int32_t id) | |
| 30278 | { | ||
| 30279 | 9 | game->set_item(id, false); | |
| 30280 | 9 | itemdata const& idat = itemsbuf[id]; | |
| 30281 | |||
| 30282 | /* Lower the counters! */ | ||
| 30283 |
1/2✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
|
9 | if(idat.count!=-1) |
| 30284 | { | ||
| 30285 | ✗ | if(idat.setmax) | |
| 30286 | { | ||
| 30287 | ✗ | game->set_maxcounter(game->get_maxcounter(idat.count)-idat.setmax, idat.count); | |
| 30288 | ✗ | } | |
| 30289 | |||
| 30290 | ✗ | if(idat.amount&0x3FFF) | |
| 30291 | { | ||
| 30292 | ✗ | if(idat.amount&0x8000) | |
| 30293 | ✗ | game->set_dcounter(game->get_dcounter(idat.count)-((idat.amount&0x4000)?-(idat.amount&0x3FFF):idat.amount&0x3FFF), idat.count); | |
| 30294 | ✗ | else game->set_counter(game->get_counter(idat.count)-((idat.amount&0x4000)?-(idat.amount&0x3FFF):idat.amount&0x3FFF), idat.count); | |
| 30295 | ✗ | } | |
| 30296 | ✗ | } | |
| 30297 | |||
| 30298 |
1/10✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
9 | switch(itemsbuf[id&0xFF].family) |
| 30299 | { | ||
| 30300 | // NES consistency: replace all flying boomerangs with the current boomerang. | ||
| 30301 | case itype_brang: | ||
| 30302 | ✗ | if(current_item(itype_brang)) for(int32_t i=0; i<Lwpns.Count(); i++) | |
| 30303 | { | ||
| 30304 | ✗ | weapon *w = ((weapon*)Lwpns.spr(i)); | |
| 30305 | |||
| 30306 | ✗ | if(w->id==wBrang) | |
| 30307 | { | ||
| 30308 | ✗ | w->LOADGFX(itemsbuf[current_item_id(itype_brang)].wpn); | |
| 30309 | ✗ | } | |
| 30310 | ✗ | } | |
| 30311 | |||
| 30312 | ✗ | break; | |
| 30313 | |||
| 30314 | case itype_itmbundle: | ||
| 30315 | { | ||
| 30316 | ✗ | int ids[10] = {idat.misc1, idat.misc2, idat.misc3, idat.misc4, idat.misc5, | |
| 30317 | ✗ | idat.misc6, idat.misc7, idat.misc8, idat.misc9, idat.misc10}; | |
| 30318 | ✗ | for(auto q = 0; q < 10; ++q) | |
| 30319 | { | ||
| 30320 | ✗ | if(unsigned(ids[q]) >= MAXITEMS) continue; | |
| 30321 | ✗ | takeitem(ids[q]); | |
| 30322 | ✗ | } | |
| 30323 | } | ||
| 30324 | ✗ | break; | |
| 30325 | |||
| 30326 | case itype_progressive_itm: | ||
| 30327 | { | ||
| 30328 | ✗ | int32_t newid = get_progressive_item(idat, true); | |
| 30329 | ✗ | if(newid > -1) | |
| 30330 | ✗ | takeitem(newid); | |
| 30331 | } | ||
| 30332 | ✗ | break; | |
| 30333 | |||
| 30334 | case itype_heartpiece: | ||
| 30335 | ✗ | if(game->get_maxlife()>game->get_hp_per_heart()) | |
| 30336 | { | ||
| 30337 | ✗ | if(game->get_HCpieces()==0) | |
| 30338 | { | ||
| 30339 | ✗ | game->set_HCpieces(game->get_hcp_per_hc()); | |
| 30340 | ✗ | takeitem(iHeartC); | |
| 30341 | ✗ | } | |
| 30342 | |||
| 30343 | ✗ | game->change_HCpieces(-1); | |
| 30344 | ✗ | } | |
| 30345 | ✗ | break; | |
| 30346 | |||
| 30347 | case itype_map: | ||
| 30348 | ✗ | game->lvlitems[dlevel]&=~liMAP; | |
| 30349 | ✗ | break; | |
| 30350 | |||
| 30351 | case itype_compass: | ||
| 30352 | ✗ | game->lvlitems[dlevel]&=~liCOMPASS; | |
| 30353 | ✗ | break; | |
| 30354 | |||
| 30355 | case itype_bosskey: | ||
| 30356 | ✗ | game->lvlitems[dlevel]&=~liBOSSKEY; | |
| 30357 | ✗ | break; | |
| 30358 | |||
| 30359 | case itype_lkey: | ||
| 30360 | ✗ | if(game->lvlkeys[dlevel]) game->lvlkeys[dlevel]--; | |
| 30361 | ✗ | break; | |
| 30362 | |||
| 30363 | case itype_ring: | ||
| 30364 | ✗ | if((get_qr(qr_OVERWORLDTUNIC) != 0) || (currscr<128 || dlevel)) | |
| 30365 | { | ||
| 30366 | ✗ | ringcolor(false); | |
| 30367 | ✗ | } | |
| 30368 | ✗ | break; | |
| 30369 | } | ||
| 30370 | 9 | } | |
| 30371 | |||
| 30372 | 14124 | void post_item_collect() | |
| 30373 | { | ||
| 30374 | 14124 | std::vector<int32_t> &ev = FFCore.eventData; | |
| 30375 | 14124 | ev.clear(); | |
| 30376 | |||
| 30377 | 14124 | throwGenScriptEvent(GENSCR_EVENT_POST_COLLECT_ITEM); | |
| 30378 | 14124 | } | |
| 30379 | |||
| 30380 | 14341 | void HeroClass::handle_triforce(int32_t id) | |
| 30381 | { | ||
| 30382 |
1/2✓ Branch 0 taken 14341 times.
✗ Branch 1 not taken.
|
14341 | if(unsigned(id) >= MAXITEMS) |
| 30383 | ✗ | return; | |
| 30384 | 14341 | itemdata const& itm = itemsbuf[id]; | |
| 30385 |
3/3✓ Branch 0 taken 14223 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 115 times.
|
14341 | switch(itm.family) |
| 30386 | { | ||
| 30387 | case itype_itmbundle: | ||
| 30388 | { | ||
| 30389 | 18 | int ids[10] = {itm.misc1, itm.misc2, itm.misc3, itm.misc4, itm.misc5, | |
| 30390 | 15 | itm.misc6, itm.misc7, itm.misc8, itm.misc9, itm.misc10}; | |
| 30391 |
2/2✓ Branch 0 taken 30 times.
✓ Branch 1 taken 3 times.
|
33 | for(auto q = 0; q < 10; ++q) |
| 30392 | { | ||
| 30393 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 30 times.
|
30 | if(unsigned(ids[q]) >= MAXITEMS) continue; |
| 30394 | 30 | handle_triforce(ids[q]); | |
| 30395 | 30 | } | |
| 30396 | } | ||
| 30397 | 3 | break; | |
| 30398 | case itype_triforcepiece: | ||
| 30399 | { | ||
| 30400 |
2/2✓ Branch 0 taken 15 times.
✓ Branch 1 taken 100 times.
|
115 | if(itm.misc2>0) |
| 30401 | 100 | getTriforce(id); //small | |
| 30402 | 15 | else getBigTri(id); //big | |
| 30403 | } | ||
| 30404 | 115 | break; | |
| 30405 | } | ||
| 30406 | 14341 | } | |
| 30407 | |||
| 30408 | // Attempt to pick up an item. (-1 = check items touching Hero.) | ||
| 30409 | 14131112 | void HeroClass::checkitems(int32_t index) | |
| 30410 | { | ||
| 30411 | 14131112 | int32_t tmp=currscr>=128?1:0; | |
| 30412 | |||
| 30413 |
2/2✓ Branch 0 taken 1828 times.
✓ Branch 1 taken 14129284 times.
|
14131112 | if(index==-1) |
| 30414 | { | ||
| 30415 |
2/2✓ Branch 0 taken 2985301 times.
✓ Branch 1 taken 14129284 times.
|
17114585 | for(auto ind = items.Count()-1; ind >= 0; --ind) |
| 30416 | { | ||
| 30417 | 2985301 | item* itm = (item*)items.spr(ind); | |
| 30418 |
2/2✓ Branch 0 taken 2985252 times.
✓ Branch 1 taken 49 times.
|
2985301 | if(itm->get_forcegrab()) |
| 30419 | { | ||
| 30420 | 49 | checkitems(ind); | |
| 30421 | 49 | } | |
| 30422 | 2985301 | } | |
| 30423 |
2/2✓ Branch 0 taken 4394148 times.
✓ Branch 1 taken 9735136 times.
|
14129284 | if(diagonalMovement) |
| 30424 | { | ||
| 30425 | 4394148 | index=items.hit(x,y+(bigHitbox?0:8)-fakez,z,6,6,1); | |
| 30426 | 4394148 | } | |
| 30427 | 9735136 | else index=items.hit(x,y+(bigHitbox?0:8)-fakez,z,1,1,1); | |
| 30428 | 14129284 | } | |
| 30429 | |||
| 30430 |
2/2✓ Branch 0 taken 119652 times.
✓ Branch 1 taken 14011460 times.
|
14131112 | if(index==-1) |
| 30431 | 14011460 | return; | |
| 30432 | |||
| 30433 | // if (tmpscr[tmp].room==rSHOP && boughtsomething==true) | ||
| 30434 | // return; | ||
| 30435 | 119652 | item* ptr = (item*)items.spr(index); | |
| 30436 | 119652 | int32_t pickup = ptr->pickup; | |
| 30437 | 119652 | int8_t exstate = ptr->pickupexstate; | |
| 30438 | 119652 | int32_t PriceIndex = ptr->PriceIndex; | |
| 30439 | 119652 | int32_t id2 = ptr->id; | |
| 30440 | 119652 | int32_t holdid = ptr->id; | |
| 30441 | 119652 | int32_t pstr = ptr->pstring; | |
| 30442 | 119652 | int32_t pstr_flags = ptr->pickup_string_flags; | |
| 30443 | 119652 | int32_t linked_parent = ptr->linked_parent; | |
| 30444 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 119652 times.
|
119652 | if(ptr->fallclk > 0) return; //Don't pick up a falling item |
| 30445 | |||
| 30446 |
1/2✓ Branch 0 taken 119652 times.
✗ Branch 1 not taken.
|
119652 | if(itemsbuf[id2].family == itype_progressive_itm) |
| 30447 | { | ||
| 30448 | ✗ | int32_t newid = get_progressive_item(itemsbuf[id2]); | |
| 30449 | ✗ | if(newid > -1) | |
| 30450 | { | ||
| 30451 | ✗ | id2 = newid; | |
| 30452 | ✗ | holdid = newid; | |
| 30453 | ✗ | pstr = itemsbuf[newid].pstring; | |
| 30454 | ✗ | pstr_flags = itemsbuf[newid].pickup_string_flags; | |
| 30455 | ✗ | } | |
| 30456 | ✗ | } | |
| 30457 | |||
| 30458 |
2/2✓ Branch 0 taken 118628 times.
✓ Branch 1 taken 1024 times.
|
119652 | bool bottledummy = (pickup&ipCHECK) && tmpscr[tmp].room == rBOTTLESHOP; |
| 30459 | |||
| 30460 |
2/2✓ Branch 0 taken 25 times.
✓ Branch 1 taken 119627 times.
|
119652 | if(bottledummy) //Dummy bullshit! |
| 30461 | { | ||
| 30462 |
1/2✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
|
25 | if(!game->canFillBottle()) |
| 30463 | ✗ | return; | |
| 30464 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 1 times.
|
25 | if(prices[PriceIndex]!=100000) // 100000 is a placeholder price for free items |
| 30465 | { | ||
| 30466 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if(!current_item_power(itype_wallet)) |
| 30467 | { | ||
| 30468 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if( game->get_spendable_rupies()<abs(prices[PriceIndex]) ) return; |
| 30469 | 1 | int32_t tmpprice = -abs(prices[PriceIndex]); | |
| 30470 | //game->change_drupy(-abs(prices[priceindex])); | ||
| 30471 | 1 | int32_t total = game->get_drupy()-tmpprice; | |
| 30472 | 1 | total = vbound(total, 0, game->get_maxcounter(1)); //Never overflow! Overflow here causes subscreen bugs! -Z | |
| 30473 | 1 | game->set_drupy(game->get_drupy()-total); | |
| 30474 | 1 | } | |
| 30475 | else //infinite wallet | ||
| 30476 | { | ||
| 30477 | ✗ | game->change_drupy(0); | |
| 30478 | } | ||
| 30479 | 1 | } | |
| 30480 | 25 | boughtsomething=true; | |
| 30481 | //make the other shop items untouchable after | ||
| 30482 | //you buy something | ||
| 30483 | |||
| 30484 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 25 times.
|
29 | for(int32_t i=0; i<items.Count(); i++) |
| 30485 | { | ||
| 30486 |
4/4✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 2 times.
|
4 | if(((item*)items.spr(i))->PriceIndex >-1 && i!=index) |
| 30487 | 2 | ((item*)items.spr(i))->pickup=ipDUMMY+ipFADE; | |
| 30488 | 4 | } | |
| 30489 | |||
| 30490 | 25 | int32_t slot = game->fillBottle(QMisc.bottle_shop_types[tmpscr[tmp].catchall].fill[PriceIndex]); | |
| 30491 | 25 | id2 = find_bottle_for_slot(slot); | |
| 30492 | 25 | ptr->id = id2; | |
| 30493 | 25 | holdid = id2; | |
| 30494 | 25 | pstr = 0; | |
| 30495 | 25 | pickup |= ipHOLDUP; | |
| 30496 | 25 | } | |
| 30497 | else | ||
| 30498 | { | ||
| 30499 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 119627 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
119627 | if(itemsbuf[id2].family == itype_bottlefill && !game->canFillBottle()) |
| 30500 | ✗ | return; //No picking these up unless you have a bottle to fill! | |
| 30501 | |||
| 30502 |
5/6✓ Branch 0 taken 114420 times.
✓ Branch 1 taken 5207 times.
✓ Branch 2 taken 103063 times.
✓ Branch 3 taken 11357 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 103063 times.
|
119627 | if(((pickup&ipTIMER) && (ptr->clk2 < 32))&& !(pickup & ipCANGRAB)) |
| 30503 |
2/2✓ Branch 0 taken 102858 times.
✓ Branch 1 taken 205 times.
|
103063 | if(ptr->id!=iFairyMoving) |
| 30504 | // wait for it to stop flashing, doesn't check for other items yet | ||
| 30505 | 102858 | return; | |
| 30506 | |||
| 30507 |
2/2✓ Branch 0 taken 16714 times.
✓ Branch 1 taken 55 times.
|
16769 | if(pickup&ipENEMY) // item was being carried by enemy |
| 30508 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 55 times.
|
110 | if(more_carried_items()<=1) // 1 includes this own item. |
| 30509 | 55 | hasitem &= ~2; | |
| 30510 | |||
| 30511 |
2/2✓ Branch 0 taken 1703 times.
✓ Branch 1 taken 15066 times.
|
16769 | if(pickup&ipDUMMY) // dummy item (usually a rupee) |
| 30512 | { | ||
| 30513 |
2/2✓ Branch 0 taken 1640 times.
✓ Branch 1 taken 63 times.
|
1703 | if(pickup&ipMONEY) |
| 30514 | 63 | dospecialmoney(index); | |
| 30515 | |||
| 30516 | 1703 | return; | |
| 30517 | } | ||
| 30518 | |||
| 30519 |
3/4✓ Branch 0 taken 95 times.
✓ Branch 1 taken 14971 times.
✓ Branch 2 taken 95 times.
✗ Branch 3 not taken.
|
15066 | if(get_qr(qr_HEARTSREQUIREDFIX) && !canget(id2)) |
| 30520 | ✗ | return; | |
| 30521 | |||
| 30522 | 15066 | int32_t nextitem = -1; | |
| 30523 | 15066 | do | |
| 30524 | { | ||
| 30525 | 15066 | nextitem = -1; | |
| 30526 |
4/4✓ Branch 0 taken 25 times.
✓ Branch 1 taken 15041 times.
✓ Branch 2 taken 11 times.
✓ Branch 3 taken 14 times.
|
15066 | if((itemsbuf[id2].flags & item_combine) && game->get_item(id2)) |
| 30527 | // Item upgrade routine. | ||
| 30528 | { | ||
| 30529 | |||
| 30530 |
2/2✓ Branch 0 taken 3584 times.
✓ Branch 1 taken 14 times.
|
3598 | for(int32_t i=0; i<MAXITEMS; i++) |
| 30531 | { | ||
| 30532 | // Find the item which is as close to this item's fam_type as possible. | ||
| 30533 |
4/4✓ Branch 0 taken 31 times.
✓ Branch 1 taken 3553 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 14 times.
|
3584 | if(itemsbuf[i].family==itemsbuf[id2].family && itemsbuf[i].fam_type>itemsbuf[id2].fam_type |
| 30534 |
3/4✓ Branch 0 taken 14 times.
✓ Branch 1 taken 17 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
|
31 | && (nextitem>-1 ? itemsbuf[i].fam_type<=itemsbuf[nextitem].fam_type : true)) |
| 30535 | { | ||
| 30536 | 14 | nextitem = i; | |
| 30537 | 14 | } | |
| 30538 | 3584 | } | |
| 30539 | |||
| 30540 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
14 | if(nextitem>-1) |
| 30541 | { | ||
| 30542 | 14 | id2 = nextitem; | |
| 30543 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | if(get_qr(qr_ITEMCOMBINE_NEW_PSTR)) |
| 30544 | { | ||
| 30545 | ✗ | pstr = itemsbuf[id2].pstring; | |
| 30546 | ✗ | pstr_flags = itemsbuf[id2].pickup_string_flags; | |
| 30547 | ✗ | } | |
| 30548 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
14 | if(!get_qr(qr_ITEMCOMBINE_CONTINUOUS)) |
| 30549 | 14 | break; //no looping | |
| 30550 | ✗ | } | |
| 30551 | ✗ | } | |
| 30552 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15052 times.
|
15052 | } while(nextitem > -1); |
| 30553 | |||
| 30554 |
2/2✓ Branch 0 taken 14043 times.
✓ Branch 1 taken 1023 times.
|
15066 | if(pickup&ipCHECK) // check restrictions |
| 30555 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 709 times.
✓ Branch 2 taken 207 times.
✓ Branch 3 taken 107 times.
|
1023 | switch(tmpscr[tmp].room) |
| 30556 | { | ||
| 30557 | case rSP_ITEM: // special item | ||
| 30558 |
2/2✓ Branch 0 taken 144 times.
✓ Branch 1 taken 63 times.
|
207 | if(!canget(id2)) // These ones always need the Hearts Required check |
| 30559 | 63 | return; | |
| 30560 | |||
| 30561 | 144 | break; | |
| 30562 | |||
| 30563 | case rP_SHOP: // potion shop | ||
| 30564 |
2/2✓ Branch 0 taken 93 times.
✓ Branch 1 taken 14 times.
|
107 | if(msg_active) |
| 30565 | 93 | return; | |
| 30566 | [[fallthrough]]; | ||
| 30567 | case rSHOP: // shop | ||
| 30568 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 723 times.
|
723 | if(prices[PriceIndex]!=100000) // 100000 is a placeholder price for free items |
| 30569 | { | ||
| 30570 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 723 times.
|
723 | if(!current_item_power(itype_wallet)) |
| 30571 | { | ||
| 30572 |
2/2✓ Branch 0 taken 600 times.
✓ Branch 1 taken 123 times.
|
723 | if( game->get_spendable_rupies()<abs(prices[PriceIndex]) ) return; |
| 30573 | 123 | int32_t tmpprice = -abs(prices[PriceIndex]); | |
| 30574 | //game->change_drupy(-abs(prices[priceindex])); | ||
| 30575 | 123 | int32_t total = game->get_drupy()-tmpprice; | |
| 30576 | 123 | total = vbound(total, 0, game->get_maxcounter(1)); //Never overflow! Overflow here causes subscreen bugs! -Z | |
| 30577 | 123 | game->set_drupy(game->get_drupy()-total); | |
| 30578 | 123 | } | |
| 30579 | else //infinite wallet | ||
| 30580 | { | ||
| 30581 | ✗ | game->change_drupy(0); | |
| 30582 | } | ||
| 30583 | 123 | } | |
| 30584 | 123 | boughtsomething=true; | |
| 30585 | //make the other shop items untouchable after | ||
| 30586 | //you buy something | ||
| 30587 | 123 | int32_t count = 0; | |
| 30588 | |||
| 30589 |
2/2✓ Branch 0 taken 369 times.
✓ Branch 1 taken 123 times.
|
492 | for(int32_t i=0; i<3; i++) |
| 30590 | { | ||
| 30591 |
2/2✓ Branch 0 taken 45 times.
✓ Branch 1 taken 324 times.
|
369 | if(QMisc.shop[tmpscr[tmp].catchall].hasitem[i] != 0) |
| 30592 | { | ||
| 30593 | 324 | ++count; | |
| 30594 | 324 | } | |
| 30595 | 369 | } | |
| 30596 | |||
| 30597 |
2/2✓ Branch 0 taken 450 times.
✓ Branch 1 taken 123 times.
|
573 | for(int32_t i=0; i<items.Count(); i++) |
| 30598 | { | ||
| 30599 |
4/4✓ Branch 0 taken 324 times.
✓ Branch 1 taken 126 times.
✓ Branch 2 taken 123 times.
✓ Branch 3 taken 201 times.
|
450 | if(((item*)items.spr(i))->PriceIndex >-1 && i!=index) |
| 30600 | 201 | ((item*)items.spr(i))->pickup=ipDUMMY+ipFADE; | |
| 30601 | 450 | } | |
| 30602 | |||
| 30603 | 123 | break; | |
| 30604 | 267 | } | |
| 30605 | |||
| 30606 | //EVENT | ||
| 30607 | { | ||
| 30608 | 14310 | std::vector<int32_t> &ev = FFCore.eventData; | |
| 30609 | 14310 | ev.clear(); | |
| 30610 | 14310 | ev.push_back(id2*10000); | |
| 30611 | 14310 | ev.push_back(pickup*10000); | |
| 30612 | 14310 | ev.push_back(pstr*10000); | |
| 30613 | 14310 | ev.push_back(pstr_flags*10000); | |
| 30614 | 14310 | ev.push_back(0); | |
| 30615 | 14310 | ev.push_back(ptr->getUID()); | |
| 30616 | 14310 | ev.push_back(GENEVT_ICTYPE_COLLECT*10000); | |
| 30617 | 14310 | ev.push_back(0); | |
| 30618 | |||
| 30619 | 14310 | throwGenScriptEvent(GENSCR_EVENT_COLLECT_ITEM); | |
| 30620 | 14310 | bool nullify = ev[4] != 0; | |
| 30621 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14310 times.
|
14310 | if(nullify) return; |
| 30622 | 14310 | id2 = ev[0]/10000; | |
| 30623 | 14310 | pickup = (pickup&(ipCHECK|ipDUMMY)) | (ev[1]/10000); | |
| 30624 | 14310 | pstr = ev[2] / 10000; | |
| 30625 | 14310 | pstr_flags = ev[3] / 10000; | |
| 30626 | } | ||
| 30627 | |||
| 30628 |
2/2✓ Branch 0 taken 1525 times.
✓ Branch 1 taken 12785 times.
|
14310 | if(pickup&ipONETIME) // set mITEM for one-time-only items |
| 30629 | { | ||
| 30630 | 1525 | setmapflag(mITEM); | |
| 30631 | |||
| 30632 | //Okay so having old source files is a godsend. You wanna know why? | ||
| 30633 | //Because the issue here was never to so with the wrong flag being set; no it's always been setting the right flag. | ||
| 30634 | //The problem here is that guy rooms were always checking for getmapflag, which used to have an internal check for the default. | ||
| 30635 | //The default would be mITEM if currscr was under 128 (AKA not in a cave), and mSPECIALITEM if in a cave. | ||
| 30636 | //However, now the check just always defaults to mSPECIALITEM, which causes this bug. | ||
| 30637 | //This means that this section of code is no longer a bunch of eggshells, cause none of these overcomplicated compats actually solved shit lmao - Dimi | ||
| 30638 | |||
| 30639 | /* | ||
| 30640 | // WARNING - Item pickups are very volatile due to crazy compatability hacks, eg., supporting | ||
| 30641 | // broken behavior from early ZC versions. If you change things here please comment on its purpose. | ||
| 30642 | |||
| 30643 | // some old quests need picking up a screen item to also disable the BELOW flag (for hunger rooms, etc) | ||
| 30644 | // What is etc?! We need to check for every valid state here. ~Gleeok | ||
| 30645 | if(get_qr(qr_ITEMPICKUPSETSBELOW)) | ||
| 30646 | { | ||
| 30647 | // Most older quests need one-time-pickups to not remove special items, etc. | ||
| 30648 | if(tmpscr->room==rGRUMBLE) | ||
| 30649 | { | ||
| 30650 | setmapflag(mSPECIALITEM); | ||
| 30651 | } | ||
| 30652 | } | ||
| 30653 | */ | ||
| 30654 | 1525 | } | |
| 30655 |
2/2✓ Branch 0 taken 12023 times.
✓ Branch 1 taken 762 times.
|
12785 | else if(pickup&ipONETIME2) // set mSPECIALITEM flag for other one-time-only items |
| 30656 |
2/2✓ Branch 0 taken 261 times.
✓ Branch 1 taken 501 times.
|
762 | setmapflag((currscr < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM); |
| 30657 | |||
| 30658 |
3/4✓ Branch 0 taken 1 times.
✓ Branch 1 taken 14309 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
|
14310 | if(exstate > -1 && exstate < 32) |
| 30659 | { | ||
| 30660 | 1 | setxmapflag(1<<exstate); | |
| 30661 | 1 | } | |
| 30662 | |||
| 30663 |
2/2✓ Branch 0 taken 14309 times.
✓ Branch 1 taken 1 times.
|
14310 | if(pickup&ipSECRETS) // Trigger secrets if this item has the secret pickup |
| 30664 | { | ||
| 30665 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if(tmpscr->flags9&fITEMSECRETPERM) setmapflag(mSECRET); |
| 30666 | 1 | hidden_entrance(0, true, false, -5); | |
| 30667 | 1 | } | |
| 30668 | |||
| 30669 | 14310 | collectitem_script(id2); | |
| 30670 | 14310 | getitem(id2, ptr->noSound, true); | |
| 30671 | } | ||
| 30672 | |||
| 30673 |
2/2✓ Branch 0 taken 1526 times.
✓ Branch 1 taken 12809 times.
|
14335 | if(pickup&ipHOLDUP) |
| 30674 | { | ||
| 30675 | 1526 | attackclk=0; | |
| 30676 | 1526 | reset_swordcharge(); | |
| 30677 | |||
| 30678 |
3/4✓ Branch 0 taken 1485 times.
✓ Branch 1 taken 41 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1485 times.
|
1526 | if(action!=swimming && !IsSideSwim()) |
| 30679 | 1485 | reset_hookshot(); | |
| 30680 | |||
| 30681 |
2/2✓ Branch 0 taken 1181 times.
✓ Branch 1 taken 279 times.
|
1526 | if(msg_onscreen) |
| 30682 | { | ||
| 30683 | 279 | dismissmsg(); | |
| 30684 | 279 | } | |
| 30685 | |||
| 30686 | 1460 | clear_bitmap(pricesdisplaybuf); | |
| 30687 | |||
| 30688 |
7/8✓ Branch 0 taken 144 times.
✓ Branch 1 taken 1316 times.
✓ Branch 2 taken 76 times.
✓ Branch 3 taken 68 times.
✓ Branch 4 taken 76 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 69 times.
✓ Branch 7 taken 117 times.
|
1494 | if(get_qr(qr_OLDPICKUP) || ((tmpscr[tmp].room==rSP_ITEM || tmpscr[tmp].room==rRP_HC || tmpscr[tmp].room==rTAKEONE) && (pickup&ipONETIME2)) || |
| 30689 |
4/4✓ Branch 0 taken 34 times.
✓ Branch 1 taken 83 times.
✓ Branch 2 taken 33 times.
✓ Branch 3 taken 1 times.
|
117 | (get_qr(qr_SHOP_ITEMS_VANISH) && (tmpscr[tmp].room==rBOTTLESHOP || tmpscr[tmp].room==rSHOP) && (pickup&ipCHECK))) |
| 30690 | { | ||
| 30691 | 1419 | fadeclk=66; | |
| 30692 | 1419 | } | |
| 30693 | |||
| 30694 |
5/6✓ Branch 0 taken 22 times.
✓ Branch 1 taken 1480 times.
✓ Branch 2 taken 22 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 10 times.
✓ Branch 5 taken 12 times.
|
1502 | if(id2!=iBombs || action==swimming || get_qr(qr_BOMBHOLDFIX)) |
| 30695 | { | ||
| 30696 | // don't hold up bombs unless swimming or the bomb hold fix quest rule is on | ||
| 30697 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 1473 times.
|
1490 | if(action==swimming) |
| 30698 | { | ||
| 30699 | 17 | action=waterhold1; FFCore.setHeroAction(waterhold1); | |
| 30700 | 17 | } | |
| 30701 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1473 times.
|
1473 | else if(IsSideSwim()) |
| 30702 | { | ||
| 30703 | ✗ | action=sidewaterhold1; FFCore.setHeroAction(sidewaterhold1); | |
| 30704 | ✗ | } | |
| 30705 | else | ||
| 30706 | { | ||
| 30707 | 1473 | action=landhold1; FFCore.setHeroAction(landhold1); | |
| 30708 | } | ||
| 30709 | |||
| 30710 |
2/2✓ Branch 0 taken 1142 times.
✓ Branch 1 taken 348 times.
|
1490 | if(ptr->twohand) |
| 30711 | { | ||
| 30712 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 342 times.
|
348 | if(action==waterhold1) |
| 30713 | { | ||
| 30714 | 6 | action=waterhold2; FFCore.setHeroAction(waterhold2); | |
| 30715 | 6 | } | |
| 30716 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 342 times.
|
342 | else if(action==sidewaterhold1) |
| 30717 | { | ||
| 30718 | ✗ | action=sidewaterhold2; FFCore.setHeroAction(sidewaterhold2); | |
| 30719 | ✗ | } | |
| 30720 | else | ||
| 30721 | { | ||
| 30722 | 342 | action=landhold2; FFCore.setHeroAction(landhold2); | |
| 30723 | } | ||
| 30724 | 348 | } | |
| 30725 | |||
| 30726 | 1490 | holdclk=130; | |
| 30727 | |||
| 30728 | //restart music | ||
| 30729 |
2/2✓ Branch 0 taken 1381 times.
✓ Branch 1 taken 109 times.
|
1490 | if(get_qr(qr_HOLDNOSTOPMUSIC) == 0) |
| 30730 | 109 | music_stop(); | |
| 30731 | |||
| 30732 | 1490 | holditem=holdid; // NES consistency: when combining blue potions, hold up the blue potion. | |
| 30733 | 1490 | freeze_guys=true; | |
| 30734 | //show the info string | ||
| 30735 | |||
| 30736 | |||
| 30737 | //if (pstr > 0 ) //&& itemsbuf[index].pstring < msg_count && ( ( itemsbuf[index].pickup_string_flags&itemdataPSTRING_ALWAYS || itemsbuf[index].pickup_string_flags&itemdataPSTRING_IP_HOLDUP ) ) ) | ||
| 30738 | |||
| 30739 | 1490 | int32_t shop_pstr = 0; | |
| 30740 |
2/2✓ Branch 0 taken 142 times.
✓ Branch 1 taken 1348 times.
|
1490 | if (PriceIndex > -1) |
| 30741 | { | ||
| 30742 |
3/3✓ Branch 0 taken 32 times.
✓ Branch 1 taken 109 times.
✓ Branch 2 taken 1 times.
|
142 | switch(tmpscr[tmp].room) |
| 30743 | { | ||
| 30744 | case rSHOP: | ||
| 30745 | 109 | shop_pstr = QMisc.shop[tmpscr[tmp].catchall].str[PriceIndex]; | |
| 30746 | 109 | break; | |
| 30747 | case rBOTTLESHOP: | ||
| 30748 | 1 | shop_pstr = QMisc.bottle_shop_types[tmpscr[tmp].catchall].str[PriceIndex]; | |
| 30749 | 1 | break; | |
| 30750 | } | ||
| 30751 | 142 | } | |
| 30752 |
5/6✓ Branch 0 taken 19 times.
✓ Branch 1 taken 1471 times.
✓ Branch 2 taken 19 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 1470 times.
|
1490 | if ( (pstr > 0 && pstr < msg_count) || (shop_pstr > 0 && shop_pstr < msg_count) ) |
| 30753 | { | ||
| 30754 |
9/12✓ Branch 0 taken 19 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 19 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 18 times.
✓ Branch 5 taken 1 times.
✓ Branch 6 taken 18 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 14 times.
✓ Branch 9 taken 4 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 14 times.
|
20 | if ( (pstr > 0 && pstr < msg_count) && ( ( ( pstr_flags&itemdataPSTRING_ALWAYS || pstr_flags&itemdataPSTRING_NOMARK || pstr_flags&itemdataPSTRING_IP_HOLDUP || (!(FFCore.GetItemMessagePlayed(id2))) ) ) ) ) |
| 30755 | { | ||
| 30756 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19 times.
|
19 | if ( (!(pstr_flags&itemdataPSTRING_NOMARK)) ) FFCore.SetItemMessagePlayed(id2); |
| 30757 | 19 | } | |
| 30758 | 1 | else pstr = 0; | |
| 30759 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 19 times.
|
20 | if(shop_pstr) |
| 30760 | { | ||
| 30761 | 1 | donewmsg(shop_pstr); | |
| 30762 | 1 | enqueued_str = pstr; | |
| 30763 | 1 | } | |
| 30764 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19 times.
|
19 | else if(pstr) |
| 30765 | { | ||
| 30766 | 19 | donewmsg(pstr); | |
| 30767 | 19 | } | |
| 30768 | 20 | } | |
| 30769 | |||
| 30770 | 1490 | } | |
| 30771 | |||
| 30772 |
4/4✓ Branch 0 taken 104 times.
✓ Branch 1 taken 1398 times.
✓ Branch 2 taken 100 times.
✓ Branch 3 taken 4 times.
|
1502 | if(itemsbuf[id2].family!=itype_triforcepiece || !(itemsbuf[id2].flags & item_gamedata)) |
| 30773 | { | ||
| 30774 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1402 times.
|
1402 | if (!ptr->noHoldSound) sfx(tmpscr[0].holdupsfx); |
| 30775 | 1402 | } | |
| 30776 | |||
| 30777 | 1502 | ptr->set_forcegrab(false); | |
| 30778 | 1502 | items.del(index); | |
| 30779 | |||
| 30780 |
2/2✓ Branch 0 taken 216 times.
✓ Branch 1 taken 1502 times.
|
1718 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 30781 | { | ||
| 30782 | 216 | weapon *w = (weapon*)Lwpns.spr(i); | |
| 30783 | |||
| 30784 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 216 times.
|
216 | if(w->dragging==index) |
| 30785 | { | ||
| 30786 | ✗ | w->dragging=-1; | |
| 30787 | ✗ | } | |
| 30788 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | else if(w->dragging>index) |
| 30789 | { | ||
| 30790 | ✗ | w->dragging-=1; | |
| 30791 | ✗ | } | |
| 30792 | 216 | } | |
| 30793 | |||
| 30794 | // clear up shop stuff | ||
| 30795 |
4/4✓ Branch 0 taken 813 times.
✓ Branch 1 taken 689 times.
✓ Branch 2 taken 690 times.
✓ Branch 3 taken 123 times.
|
1502 | if((isdungeon()==0)&&(index!=0)) |
| 30796 | { | ||
| 30797 |
2/2✓ Branch 0 taken 40 times.
✓ Branch 1 taken 83 times.
|
123 | if(boughtsomething) |
| 30798 | { | ||
| 30799 | 83 | fadeclk=66; | |
| 30800 | |||
| 30801 |
3/4✓ Branch 0 taken 80 times.
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 80 times.
|
83 | if(((item*)items.spr(0))->id == iRupy && ((item*)items.spr(0))->pickup & ipDUMMY) |
| 30802 | { | ||
| 30803 | 80 | items.del(0); | |
| 30804 | |||
| 30805 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 80 times.
|
80 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 30806 | { | ||
| 30807 | ✗ | weapon *w = (weapon*)Lwpns.spr(i); | |
| 30808 | |||
| 30809 | ✗ | if(w->dragging==0) | |
| 30810 | { | ||
| 30811 | ✗ | w->dragging=-1; | |
| 30812 | ✗ | } | |
| 30813 | ✗ | else if(w->dragging>0) | |
| 30814 | { | ||
| 30815 | ✗ | w->dragging-=1; | |
| 30816 | ✗ | } | |
| 30817 | ✗ | } | |
| 30818 | 80 | } | |
| 30819 | 83 | } | |
| 30820 | |||
| 30821 |
1/2✓ Branch 0 taken 123 times.
✗ Branch 1 not taken.
|
123 | if(msg_onscreen) |
| 30822 | { | ||
| 30823 | ✗ | dismissmsg(); | |
| 30824 | ✗ | } | |
| 30825 | |||
| 30826 | 123 | clear_bitmap(pricesdisplaybuf); | |
| 30827 | 123 | set_clip_state(pricesdisplaybuf, 1); | |
| 30828 | 123 | } | |
| 30829 | |||
| 30830 | // items.del(index); | ||
| 30831 | 1502 | } | |
| 30832 | else | ||
| 30833 | { | ||
| 30834 | 12809 | ptr->set_forcegrab(false); | |
| 30835 | 12809 | items.del(index); | |
| 30836 | |||
| 30837 |
2/2✓ Branch 0 taken 9164 times.
✓ Branch 1 taken 12809 times.
|
21973 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 30838 | { | ||
| 30839 | 9164 | weapon *w = (weapon*)Lwpns.spr(i); | |
| 30840 | |||
| 30841 |
2/2✓ Branch 0 taken 490 times.
✓ Branch 1 taken 8674 times.
|
9164 | if(w->dragging==index) |
| 30842 | { | ||
| 30843 | 490 | w->dragging=-1; | |
| 30844 | 490 | } | |
| 30845 |
2/2✓ Branch 0 taken 8670 times.
✓ Branch 1 taken 4 times.
|
8674 | else if(w->dragging>index) |
| 30846 | { | ||
| 30847 | 4 | w->dragging-=1; | |
| 30848 | 4 | } | |
| 30849 | 9164 | } | |
| 30850 | |||
| 30851 |
2/2✓ Branch 0 taken 12796 times.
✓ Branch 1 taken 13 times.
|
12809 | if(msg_onscreen) |
| 30852 | { | ||
| 30853 | 13 | dismissmsg(); | |
| 30854 | 13 | } | |
| 30855 | |||
| 30856 | //general item pickup message | ||
| 30857 | //show the info string | ||
| 30858 | //non-held | ||
| 30859 | //if ( pstr > 0 ) //&& itemsbuf[index].pstring < msg_count && ( ( itemsbuf[index].pickup_string_flags&itemdataPSTRING_ALWAYS || (!(FFCore.GetItemMessagePlayed(index))) ) ) ) | ||
| 30860 |
3/6✓ Branch 0 taken 136 times.
✓ Branch 1 taken 12673 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 136 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
12809 | int32_t shop_pstr = ( tmpscr[tmp].room == rSHOP && PriceIndex>=0 && QMisc.shop[tmpscr[tmp].catchall].str[PriceIndex] > 0 ) ? QMisc.shop[tmpscr[tmp].catchall].str[PriceIndex] : 0; |
| 30861 |
4/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 12807 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 12807 times.
|
12809 | if ( (pstr > 0 && pstr < msg_count) || (shop_pstr > 0 && shop_pstr < msg_count) ) |
| 30862 | { | ||
| 30863 |
7/12✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 1 times.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 1 times.
|
2 | if ( (pstr > 0 && pstr < msg_count) && ( (!(pstr_flags&itemdataPSTRING_IP_HOLDUP)) && ( pstr_flags&itemdataPSTRING_NOMARK || pstr_flags&itemdataPSTRING_ALWAYS || (!(FFCore.GetItemMessagePlayed(id2))) ) ) ) |
| 30864 | { | ||
| 30865 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if ( (!(pstr_flags&itemdataPSTRING_NOMARK)) ) FFCore.SetItemMessagePlayed(id2); |
| 30866 | 1 | } | |
| 30867 | 1 | else pstr = 0; | |
| 30868 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if(shop_pstr) |
| 30869 | { | ||
| 30870 | ✗ | donewmsg(shop_pstr); | |
| 30871 | ✗ | enqueued_str = pstr; | |
| 30872 | ✗ | } | |
| 30873 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
|
2 | else if(pstr) |
| 30874 | { | ||
| 30875 | 1 | donewmsg(pstr); | |
| 30876 | 1 | } | |
| 30877 | 2 | } | |
| 30878 | |||
| 30879 | |||
| 30880 | 12809 | clear_bitmap(pricesdisplaybuf); | |
| 30881 | 12809 | set_clip_state(pricesdisplaybuf, 1); | |
| 30882 | } | ||
| 30883 | |||
| 30884 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 11 times.
|
14326 | if(itemsbuf[id2].family==itype_triforcepiece |
| 30885 |
4/4✓ Branch 0 taken 115 times.
✓ Branch 1 taken 14196 times.
✓ Branch 2 taken 15 times.
✓ Branch 3 taken 100 times.
|
14311 | && itemsbuf[id2].misc2 <= 0 && linked_parent == eeGANON) |
| 30886 | { | ||
| 30887 | 11 | game->lvlitems[dlevel]|=liBOSS; | |
| 30888 | 11 | } | |
| 30889 | 14311 | handle_triforce(id2); | |
| 30890 |
2/2✓ Branch 0 taken 1415 times.
✓ Branch 1 taken 12896 times.
|
14311 | if(!holdclk) |
| 30891 | 12896 | post_item_collect(); | |
| 30892 | 14131088 | } | |
| 30893 | |||
| 30894 | 294 | void HeroClass::StartRefill(int32_t refillWhat) | |
| 30895 | { | ||
| 30896 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 276 times.
|
294 | if(FFCore.quest_format[vZelda] < 0x255) |
| 30897 | { | ||
| 30898 | //Yes, this isn't a QR check. This was implemented before the QRs got bumped up. | ||
| 30899 | //I attempted to change this check to a quest rule, but here's the issue: this affects | ||
| 30900 | //triforces and potions as well, not just fairy flags. This means that having a compat rule | ||
| 30901 | //would result in a rule that is checked by default for every tileset or quest made before | ||
| 30902 | //2.55, one in a place most people won't check. That means that if they were to go to use | ||
| 30903 | //the new potion or triforce flags for jinx curing behavior, they'd find that it doesn't work, | ||
| 30904 | //all because of an obscure compat rule being checked. Most peoples instincts are sadly not | ||
| 30905 | //"go through the compat rules and turn them all off", so this remains a version check instead | ||
| 30906 | //of a qr check. Don't make my mistake and waste time trying to change this in vain. -Deedee | ||
| 30907 | 276 | Start250Refill(refillWhat); | |
| 30908 | 276 | return; | |
| 30909 | } | ||
| 30910 | |||
| 30911 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
|
18 | if(!refilling) |
| 30912 | { | ||
| 30913 | 18 | refillclk=21; | |
| 30914 | 18 | stop_sfx(QMisc.miscsfx[sfxLOWHEART]); | |
| 30915 | 18 | sfx(WAV_REFILL,128,true); | |
| 30916 | 18 | refilling=refillWhat; | |
| 30917 | |||
| 30918 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 9 times.
|
18 | if(refill_why>=0) // Item index |
| 30919 | { | ||
| 30920 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
|
9 | if(itemsbuf[refill_why].family==itype_potion) |
| 30921 | { | ||
| 30922 | ✗ | if(itemsbuf[refill_why].flags & item_flag3){swordclk=0;verifyAWpn();} | |
| 30923 | ✗ | if(itemsbuf[refill_why].flags & item_flag4)itemclk=0; | |
| 30924 | ✗ | if(itemsbuf[refill_why].flags & item_flag5)shieldjinxclk=0; | |
| 30925 | ✗ | } | |
| 30926 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
|
9 | else if(itemsbuf[refill_why].family==itype_triforcepiece) |
| 30927 | { | ||
| 30928 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
|
9 | if(itemsbuf[refill_why].flags & item_flag3){swordclk=0;verifyAWpn();} |
| 30929 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
|
9 | if(itemsbuf[refill_why].flags & item_flag4)itemclk=0; |
| 30930 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
|
9 | if(itemsbuf[refill_why].flags & item_flag5)shieldjinxclk=0; |
| 30931 | 9 | } | |
| 30932 | 9 | } | |
| 30933 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
|
9 | else if(refill_why==REFILL_FAIRY) |
| 30934 | { | ||
| 30935 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
|
9 | if(!get_qr(qr_NONBUBBLEFAIRIES)){swordclk=0;verifyAWpn();} |
| 30936 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 7 times.
|
9 | if(get_qr(qr_ITEMBUBBLE))itemclk=0; |
| 30937 |
1/2✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
|
9 | if(get_qr(qr_SHIELDBUBBLE))shieldjinxclk=0; |
| 30938 | 9 | } | |
| 30939 | 18 | } | |
| 30940 | 294 | } | |
| 30941 | |||
| 30942 | 276 | void HeroClass::Start250Refill(int32_t refillWhat) | |
| 30943 | { | ||
| 30944 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 276 times.
|
276 | if(!refilling) |
| 30945 | { | ||
| 30946 | 276 | refillclk=21; | |
| 30947 | 276 | stop_sfx(QMisc.miscsfx[sfxLOWHEART]); | |
| 30948 | 276 | sfx(WAV_REFILL,128,true); | |
| 30949 | 276 | refilling=refillWhat; | |
| 30950 | |||
| 30951 | // For ~2 years <2.55 quests were broken, never restoring anything on fairies. | ||
| 30952 | // https://discord.com/channels/876899628556091432/1275805052006563861 | ||
| 30953 |
2/4✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 276 times.
|
276 | if (replay_is_active() && replay_version_check(0, 35)) |
| 30954 | { | ||
| 30955 |
2/4✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 276 times.
✗ Branch 3 not taken.
|
276 | std::string qst = replay_get_meta_str("qst"); |
| 30956 |
9/12✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 229 times.
✓ Branch 3 taken 47 times.
✓ Branch 4 taken 229 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 201 times.
✓ Branch 7 taken 28 times.
✓ Branch 8 taken 201 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 23 times.
✓ Branch 11 taken 178 times.
|
276 | if (qst == "first_quest_layered.qst" || qst == "nes_remastered.qst" || qst == "demosp253.qst") |
| 30957 | 98 | return; | |
| 30958 |
2/3✗ Branch 0 not taken.
✓ Branch 1 taken 98 times.
✓ Branch 2 taken 178 times.
|
276 | } |
| 30959 | |||
| 30960 |
2/2✓ Branch 0 taken 86 times.
✓ Branch 1 taken 92 times.
|
178 | if(refill_why>=0) // Item index |
| 30961 | { | ||
| 30962 |
4/4✓ Branch 0 taken 15 times.
✓ Branch 1 taken 71 times.
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 7 times.
|
86 | if((itemsbuf[refill_why].family==itype_potion)&&(!get_qr(qr_NONBUBBLEMEDICINE))) |
| 30963 | { | ||
| 30964 | 7 | swordclk=0; | |
| 30965 | 7 | verifyAWpn(); | |
| 30966 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | if(get_qr(qr_ITEMBUBBLE)) itemclk=0; |
| 30967 | 7 | } | |
| 30968 | |||
| 30969 |
4/4✓ Branch 0 taken 71 times.
✓ Branch 1 taken 15 times.
✓ Branch 2 taken 14 times.
✓ Branch 3 taken 57 times.
|
86 | if((itemsbuf[refill_why].family==itype_triforcepiece)&&(!get_qr(qr_NONBUBBLETRIFORCE))) |
| 30970 | { | ||
| 30971 | 57 | swordclk=0; | |
| 30972 | 57 | verifyAWpn(); | |
| 30973 |
2/2✓ Branch 0 taken 56 times.
✓ Branch 1 taken 1 times.
|
57 | if(get_qr(qr_ITEMBUBBLE)) itemclk=0; |
| 30974 | 57 | } | |
| 30975 | 86 | } | |
| 30976 |
3/4✓ Branch 0 taken 92 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
✓ Branch 3 taken 54 times.
|
92 | else if((refill_why==REFILL_FAIRY)&&(!get_qr(qr_NONBUBBLEFAIRIES))) |
| 30977 | { | ||
| 30978 | 54 | swordclk=0; | |
| 30979 | 54 | verifyAWpn(); | |
| 30980 |
1/2✓ Branch 0 taken 54 times.
✗ Branch 1 not taken.
|
54 | if(get_qr(qr_ITEMBUBBLE)) itemclk=0; |
| 30981 | 54 | } | |
| 30982 | 178 | } | |
| 30983 | 276 | } | |
| 30984 | |||
| 30985 | 375620 | bool HeroClass::refill() | |
| 30986 | { | ||
| 30987 |
4/4✓ Branch 0 taken 22058 times.
✓ Branch 1 taken 353562 times.
✓ Branch 2 taken 636 times.
✓ Branch 3 taken 21422 times.
|
375620 | if(refilling==REFILL_NONE || refilling==REFILL_FAIRYDONE) |
| 30988 | { | ||
| 30989 | 354198 | return false; | |
| 30990 | } | ||
| 30991 | |||
| 30992 | 21422 | ++refillclk; | |
| 30993 | 21422 | int32_t speed = get_qr(qr_FASTFILL) ? 6 : 22; | |
| 30994 | 21422 | int32_t refill_heart_stop=game->get_maxlife(); | |
| 30995 | 21422 | int32_t refill_magic_stop=game->get_maxmagic(); | |
| 30996 | |||
| 30997 |
4/4✓ Branch 0 taken 10865 times.
✓ Branch 1 taken 10557 times.
✓ Branch 2 taken 4542 times.
✓ Branch 3 taken 6323 times.
|
21422 | if(refill_why>=0 && itemsbuf[refill_why].family==itype_potion) |
| 30998 | { | ||
| 30999 |
2/6✓ Branch 0 taken 6323 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6323 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
6323 | refill_heart_stop=zc_min(potion_life+(itemsbuf[refill_why].flags & item_flag1 ?int32_t(game->get_maxlife()*(itemsbuf[refill_why].misc1 /100.0)):((itemsbuf[refill_why].misc1 *game->get_hp_per_heart()))),game->get_maxlife()); |
| 31000 |
2/6✓ Branch 0 taken 6323 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6323 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
6323 | refill_magic_stop=zc_min(potion_magic+(itemsbuf[refill_why].flags & item_flag2 ?int32_t(game->get_maxmagic()*(itemsbuf[refill_why].misc2 /100.0)):((itemsbuf[refill_why].misc2 *game->get_mp_per_block()))),game->get_maxmagic()); |
| 31001 | 6323 | } | |
| 31002 | |||
| 31003 |
2/2✓ Branch 0 taken 18948 times.
✓ Branch 1 taken 2474 times.
|
21422 | if(refillclk%speed == 0) |
| 31004 | { | ||
| 31005 | // game->life&=0xFFC; | ||
| 31006 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 1194 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 1277 times.
|
2474 | switch(refill_what) |
| 31007 | { | ||
| 31008 | case REFILL_LIFE: | ||
| 31009 |
2/2✓ Branch 0 taken 55 times.
✓ Branch 1 taken 1139 times.
|
1194 | game->set_life(zc_min(refill_heart_stop, (game->get_life()+game->get_hp_per_heart()/2))); |
| 31010 | |||
| 31011 |
2/2✓ Branch 0 taken 156 times.
✓ Branch 1 taken 1038 times.
|
1194 | if(game->get_life()>=refill_heart_stop) |
| 31012 | { | ||
| 31013 | 156 | game->set_life(refill_heart_stop); | |
| 31014 | //kill_sfx(); //this 1. needs to be pause resme, and 2. needs an item flag. | ||
| 31015 |
2/2✓ Branch 0 taken 39936 times.
✓ Branch 1 taken 156 times.
|
40092 | for ( int32_t q = 0; q < WAV_COUNT; q++ ) |
| 31016 | { | ||
| 31017 |
2/2✓ Branch 0 taken 156 times.
✓ Branch 1 taken 39780 times.
|
39936 | if ( q == (int32_t)tmpscr->oceansfx ) continue; |
| 31018 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 39779 times.
|
39780 | if ( q == (int32_t)tmpscr->bosssfx ) continue; |
| 31019 | 39779 | stop_sfx(q); | |
| 31020 | 39779 | } | |
| 31021 | 156 | sfx(QMisc.miscsfx[sfxREFILL]); | |
| 31022 | 156 | refilling=REFILL_NONE; | |
| 31023 | 156 | return false; | |
| 31024 | } | ||
| 31025 | |||
| 31026 | 1038 | break; | |
| 31027 | |||
| 31028 | case REFILL_MAGIC: | ||
| 31029 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | game->set_magic(zc_min(refill_magic_stop, (game->get_magic()+game->get_mp_per_block()/4))); |
| 31030 | |||
| 31031 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
|
3 | if(game->get_magic()>=refill_magic_stop) |
| 31032 | { | ||
| 31033 | 1 | game->set_magic(refill_magic_stop); | |
| 31034 | //kill_sfx(); //this 1. needs to be pause resme, and 2. needs an item flag. | ||
| 31035 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 1 times.
|
257 | for ( int32_t q = 0; q < WAV_COUNT; q++ ) |
| 31036 | { | ||
| 31037 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 255 times.
|
256 | if ( q == (int32_t)tmpscr->oceansfx ) continue; |
| 31038 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 255 times.
|
255 | if ( q == (int32_t)tmpscr->bosssfx ) continue; |
| 31039 | 255 | stop_sfx(q); | |
| 31040 | 255 | } | |
| 31041 | 1 | sfx(QMisc.miscsfx[sfxREFILL]); | |
| 31042 | 1 | refilling=REFILL_NONE; | |
| 31043 | 1 | return false; | |
| 31044 | } | ||
| 31045 | |||
| 31046 | 2 | break; | |
| 31047 | |||
| 31048 | case REFILL_ALL: | ||
| 31049 |
2/2✓ Branch 0 taken 96 times.
✓ Branch 1 taken 1181 times.
|
1277 | game->set_life(zc_min(refill_heart_stop, (game->get_life()+game->get_hp_per_heart()/2))); |
| 31050 |
2/2✓ Branch 0 taken 1187 times.
✓ Branch 1 taken 90 times.
|
1277 | game->set_magic(zc_min(refill_magic_stop, (game->get_magic()+game->get_mp_per_block()/4))); |
| 31051 | |||
| 31052 |
4/4✓ Branch 0 taken 158 times.
✓ Branch 1 taken 1119 times.
✓ Branch 2 taken 137 times.
✓ Branch 3 taken 21 times.
|
1277 | if((game->get_life()>=refill_heart_stop)&&(game->get_magic()>=refill_magic_stop)) |
| 31053 | { | ||
| 31054 | 137 | game->set_life(refill_heart_stop); | |
| 31055 | 137 | game->set_magic(refill_magic_stop); | |
| 31056 | //kill_sfx(); //this 1. needs to be pause resme, and 2. needs an item flag. | ||
| 31057 |
2/2✓ Branch 0 taken 35072 times.
✓ Branch 1 taken 137 times.
|
35209 | for ( int32_t q = 0; q < WAV_COUNT; q++ ) |
| 31058 | { | ||
| 31059 |
2/2✓ Branch 0 taken 137 times.
✓ Branch 1 taken 34935 times.
|
35072 | if ( q == (int32_t)tmpscr->oceansfx ) continue; |
| 31060 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 34915 times.
|
34935 | if ( q == (int32_t)tmpscr->bosssfx ) continue; |
| 31061 | 34915 | stop_sfx(q); | |
| 31062 | 34915 | } | |
| 31063 | 137 | sfx(QMisc.miscsfx[sfxREFILL]); | |
| 31064 | 137 | refilling=REFILL_NONE; | |
| 31065 | 137 | return false; | |
| 31066 | } | ||
| 31067 | |||
| 31068 | 1140 | break; | |
| 31069 | } | ||
| 31070 | 2180 | } | |
| 31071 | |||
| 31072 | 21128 | return true; | |
| 31073 | 375620 | } | |
| 31074 | |||
| 31075 | 100 | void HeroClass::getTriforce(int32_t id2) | |
| 31076 | { | ||
| 31077 | |||
| 31078 | PALETTE flash_pal; | ||
| 31079 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 100 times.
|
100 | int32_t refill_frame = ( (itemsbuf[id2].misc5 > 0) ? itemsbuf[id2].misc5 : 88 ); |
| 31080 | |||
| 31081 |
2/2✓ Branch 0 taken 25600 times.
✓ Branch 1 taken 100 times.
|
25700 | for(int32_t i=0; i<256; i++) |
| 31082 | { | ||
| 31083 |
2/2✓ Branch 0 taken 15616 times.
✓ Branch 1 taken 9984 times.
|
25600 | flash_pal[i] = get_qr(qr_FADE) ? _RGB(255,255,0) : _RGB(255,255,255); |
| 31084 | 25600 | } | |
| 31085 | |||
| 31086 | |||
| 31087 | |||
| 31088 | //get rid off all sprites but Hero | ||
| 31089 | 100 | guys.clear(); | |
| 31090 | 100 | items.clear(); | |
| 31091 | 100 | Ewpns.clear(); | |
| 31092 | 100 | Lwpns.clear(); | |
| 31093 | 100 | chainlinks.clear(); | |
| 31094 | |||
| 31095 | 100 | kill_subscr_items(); | |
| 31096 | |||
| 31097 | //decorations.clear(); | ||
| 31098 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 36 times.
|
100 | if(!COOLSCROLL) |
| 31099 | { | ||
| 31100 | 36 | show_subscreen_items=false; | |
| 31101 | 36 | } | |
| 31102 | |||
| 31103 | 100 | sfx(itemsbuf[id2].playsound); | |
| 31104 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 100 times.
|
100 | if ( !(itemsbuf[id2].flags & item_flag11) ) music_stop(); |
| 31105 | |||
| 31106 | //If item flag six is enabled, and a sound is set to attributes[2], play that sound. | ||
| 31107 |
1/2✓ Branch 0 taken 100 times.
✗ Branch 1 not taken.
|
100 | if ( (itemsbuf[id2].flags & item_flag14) ) |
| 31108 | { | ||
| 31109 | ✗ | uint8_t playwav = itemsbuf[id2].misc3; | |
| 31110 | ✗ | sfx(playwav); | |
| 31111 | |||
| 31112 | ✗ | } | |
| 31113 | |||
| 31114 | //itemsbuf[id2].flags & item_flag9 : Don't dismiss Messages | ||
| 31115 | //itemsbuf[id2].flags & item_flag10 : Cutscene interrupts action script.. | ||
| 31116 | //itemsbuf[id2].flags & item_flag11 : Don't change music. | ||
| 31117 | //itemsbuf[id2].flags & item_flag12 : Run Collect Script Script On Collection | ||
| 31118 | //itemsbuf[id2].flags & item_flag13 : Run Action Script On Collection | ||
| 31119 | //itemsbuf[id2].flags & item_flag14 : Play second sound (WAV) from Attributes[2] (misc2) | ||
| 31120 | //itemsbuf[id2].flags & item_flag15 : No MIDI | ||
| 31121 | |||
| 31122 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 100 times.
|
100 | if(!(itemsbuf[id2].flags & item_flag15)) //No MIDI flag |
| 31123 | { | ||
| 31124 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 100 times.
|
100 | if(itemsbuf[id2].misc1) |
| 31125 | ✗ | jukebox(itemsbuf[id2].misc1+ZC_MIDI_COUNT-1); | |
| 31126 | else | ||
| 31127 | 100 | try_zcmusic("zelda.nsf",qstpath,moduledata.tf_track,ZC_MIDI_TRIFORCE,get_emusic_volume()); | |
| 31128 | 100 | } | |
| 31129 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 100 times.
|
100 | if(itemsbuf[id2].flags & item_gamedata) |
| 31130 | { | ||
| 31131 | 100 | game->lvlitems[dlevel]|=liTRIFORCE; | |
| 31132 | 100 | } | |
| 31133 | |||
| 31134 | 100 | int32_t f=0; | |
| 31135 | 100 | int32_t x2=0; | |
| 31136 | 100 | int32_t curtain_x=0; | |
| 31137 | 100 | int32_t c=0; | |
| 31138 | |||
| 31139 | 100 | do | |
| 31140 | { | ||
| 31141 | |||
| 31142 | |||
| 31143 |
1/2✓ Branch 0 taken 52360 times.
✗ Branch 1 not taken.
|
52360 | if ( (itemsbuf[id2].flags & item_flag13) ) //Run action script on collection. |
| 31144 | { | ||
| 31145 | ✗ | if ( itemsbuf[id2].script ) | |
| 31146 | { | ||
| 31147 | ✗ | if ( !FFCore.doscript(ScriptType::Item, id2) ) | |
| 31148 | { | ||
| 31149 | ✗ | int i = id2; | |
| 31150 | ✗ | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 31151 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[id2].script, i); | |
| 31152 | ✗ | FFCore.deallocateAllScriptOwned(ScriptType::Item, i); | |
| 31153 | ✗ | } | |
| 31154 | else | ||
| 31155 | { | ||
| 31156 | ✗ | if ( !(itemsbuf[id2].flags & item_flag10) ) //Cutscene halts the script it resumes after cutscene. | |
| 31157 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[id2].script, id2); //if flag is off, run the script every frame of the cutscene. | |
| 31158 | } | ||
| 31159 | ✗ | } | |
| 31160 | ✗ | } | |
| 31161 | //if ( itemsbuf[id2].misc2 == 2 ) //No cutscene; what if people used '2' on older quests? | ||
| 31162 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 52360 times.
|
52360 | if ( (itemsbuf[id2].flags & item_flag12) ) //No cutscene |
| 31163 | { | ||
| 31164 | ✗ | return; | |
| 31165 | } | ||
| 31166 |
2/2✓ Branch 0 taken 52260 times.
✓ Branch 1 taken 100 times.
|
52360 | if(f==40) |
| 31167 | { | ||
| 31168 | 100 | actiontype oldaction = action; | |
| 31169 | 100 | ALLOFF((!(itemsbuf[id2].flags & item_flag9)), false); | |
| 31170 | 100 | action=oldaction; // have to reset this flag | |
| 31171 | 100 | FFCore.setHeroAction(oldaction); | |
| 31172 | 100 | } | |
| 31173 | |||
| 31174 | |||
| 31175 |
4/4✓ Branch 0 taken 48360 times.
✓ Branch 1 taken 4000 times.
✓ Branch 2 taken 43560 times.
✓ Branch 3 taken 4800 times.
|
52360 | if(f>=40 && f<88) |
| 31176 | { | ||
| 31177 |
2/2✓ Branch 0 taken 2928 times.
✓ Branch 1 taken 1872 times.
|
4800 | if(get_qr(qr_FADE)) |
| 31178 | { | ||
| 31179 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2928 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2928 | if (!flash_reduction_enabled() && (f&7) == 0) |
| 31180 | { | ||
| 31181 | ✗ | fade_interpolate(RAMpal,flash_pal,RAMpal,42,0,CSET(6)-1); | |
| 31182 | ✗ | refreshpal=true; | |
| 31183 | ✗ | } | |
| 31184 | |||
| 31185 |
2/2✓ Branch 0 taken 2196 times.
✓ Branch 1 taken 732 times.
|
2928 | if((f&3)==2) |
| 31186 | { | ||
| 31187 | 732 | loadpalset(0,0); | |
| 31188 | 732 | loadpalset(1,1); | |
| 31189 | 732 | loadpalset(5,5); | |
| 31190 | |||
| 31191 |
2/2✓ Branch 0 taken 720 times.
✓ Branch 1 taken 12 times.
|
732 | if(currscr<128) loadlvlpal(DMaps[currdmap].color); |
| 31192 | 12 | else loadlvlpal(0xB); // TODO: Cave/Item Cellar distinction? | |
| 31193 | 732 | } | |
| 31194 | 2928 | } | |
| 31195 | else | ||
| 31196 | { | ||
| 31197 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1872 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1872 | if(!flash_reduction_enabled() && (f&7) == 0) |
| 31198 | { | ||
| 31199 | ✗ | for(int32_t cs2=2; cs2<5; cs2++) | |
| 31200 | { | ||
| 31201 | ✗ | for(int32_t i=1; i<16; i++) | |
| 31202 | { | ||
| 31203 | ✗ | RAMpal[CSET(cs2)+i]=flash_pal[CSET(cs2)+i]; | |
| 31204 | ✗ | } | |
| 31205 | ✗ | } | |
| 31206 | |||
| 31207 | ✗ | refreshpal=true; | |
| 31208 | ✗ | } | |
| 31209 | |||
| 31210 |
2/2✓ Branch 0 taken 1638 times.
✓ Branch 1 taken 234 times.
|
1872 | if((f&7)==4) |
| 31211 | { | ||
| 31212 |
1/2✓ Branch 0 taken 234 times.
✗ Branch 1 not taken.
|
234 | if(currscr<128) loadlvlpal(DMaps[currdmap].color); |
| 31213 | ✗ | else loadlvlpal(0xB); | |
| 31214 | |||
| 31215 | 234 | loadpalset(5,5); | |
| 31216 | 234 | } | |
| 31217 | } | ||
| 31218 | 4800 | } | |
| 31219 | |||
| 31220 | |||
| 31221 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 52360 times.
|
52360 | if(itemsbuf[id2].flags & item_gamedata) |
| 31222 | { | ||
| 31223 |
2/2✓ Branch 0 taken 52260 times.
✓ Branch 1 taken 100 times.
|
52360 | if(f==refill_frame) |
| 31224 | { | ||
| 31225 | 100 | refill_what=REFILL_ALL; | |
| 31226 | 100 | refill_why=id2; | |
| 31227 | 100 | StartRefill(REFILL_ALL); | |
| 31228 | 100 | refill(); | |
| 31229 | 100 | } | |
| 31230 | |||
| 31231 |
2/2✓ Branch 0 taken 47900 times.
✓ Branch 1 taken 4460 times.
|
52360 | if(f==(refill_frame+1)) |
| 31232 | { | ||
| 31233 |
2/2✓ Branch 0 taken 100 times.
✓ Branch 1 taken 4360 times.
|
4460 | if(refill()) |
| 31234 | { | ||
| 31235 | 4360 | --f; | |
| 31236 | 4360 | } | |
| 31237 | 4460 | } | |
| 31238 | 52360 | } | |
| 31239 | |||
| 31240 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 52360 times.
|
52360 | if(itemsbuf[id2].flags & item_flag1) // Warp out flag |
| 31241 | { | ||
| 31242 |
4/4✓ Branch 0 taken 27200 times.
✓ Branch 1 taken 25160 times.
✓ Branch 2 taken 19200 times.
✓ Branch 3 taken 8000 times.
|
52360 | if(f>=208 && f<288) |
| 31243 | { | ||
| 31244 | 8000 | ++x2; | |
| 31245 | |||
| 31246 |
3/3✓ Branch 0 taken 3200 times.
✓ Branch 1 taken 3200 times.
✓ Branch 2 taken 1600 times.
|
8000 | switch(++c) |
| 31247 | { | ||
| 31248 | case 5: | ||
| 31249 | 1600 | c=0; | |
| 31250 | [[fallthrough]]; | ||
| 31251 | case 0: | ||
| 31252 | case 2: | ||
| 31253 | case 3: | ||
| 31254 | 4800 | ++x2; | |
| 31255 | 4800 | break; | |
| 31256 | } | ||
| 31257 | 8000 | } | |
| 31258 | |||
| 31259 | 52360 | do_dcounters(); | |
| 31260 | |||
| 31261 |
2/2✓ Branch 0 taken 19200 times.
✓ Branch 1 taken 33160 times.
|
52360 | if(f<288) |
| 31262 | { | ||
| 31263 | 33160 | curtain_x=x2&0xF8; | |
| 31264 | 33160 | draw_screen_clip_rect_x1=curtain_x; | |
| 31265 | 33160 | draw_screen_clip_rect_x2=255-curtain_x; | |
| 31266 | 33160 | draw_screen_clip_rect_y1=0; | |
| 31267 | 33160 | draw_screen_clip_rect_y2=223; | |
| 31268 | //draw_screen(tmpscr); | ||
| 31269 | 33160 | } | |
| 31270 | 52360 | } | |
| 31271 | |||
| 31272 | 52360 | draw_screen(tmpscr); | |
| 31273 | //this causes bugs | ||
| 31274 | //the subscreen appearing over the curtain effect should now be fixed in draw_screen | ||
| 31275 | //so this is not necessary -DD | ||
| 31276 | //put_passive_subscr(framebuf,0,passive_subscreen_offset,false,false); | ||
| 31277 | |||
| 31278 | //Run Triforce Script | ||
| 31279 | 52360 | advanceframe(true); | |
| 31280 | 52360 | ++f; | |
| 31281 |
2/2✓ Branch 0 taken 52260 times.
✓ Branch 1 taken 100 times.
|
104720 | } |
| 31282 | while | ||
| 31283 | ( | ||
| 31284 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 52360 times.
|
52360 | (f < ( (itemsbuf[id2].misc4 > 0) ? itemsbuf[id2].misc4 : 408)) |
| 31285 |
4/6✓ Branch 0 taken 7300 times.
✓ Branch 1 taken 45060 times.
✓ Branch 2 taken 7300 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 7300 times.
|
52360 | || (!(itemsbuf[id2].flags & item_flag15) /*&& !(itemsbuf[id2].flags & item_flag11)*/ && (midi_pos > 0 && !replay_is_active())) |
| 31286 |
2/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 7300 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 7300 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
14600 | || (/*!(itemsbuf[id2].flags & item_flag15) &&*/ !(itemsbuf[id2].flags & item_flag11) && (zcmusic!=NULL) && (zcmusic->position<800 && !replay_is_active()) |
| 31287 | // Music is played at the same speed when fps is uncapped, so in replay mode we need to ignore the music position and instead | ||
| 31288 | // just count frames. 480 is the number of frames it takes for the triforce song in classic_1st.qst to finish playing, but the exact | ||
| 31289 | // value doesn't matter. | ||
| 31290 |
1/4✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 7300 times.
|
7300 | || (replay_is_active() && f < 480) ) |
| 31291 | ); // 800 may not be just right, but it works | ||
| 31292 | |||
| 31293 | 100 | action=none; FFCore.setHeroAction(none); | |
| 31294 | 100 | holdclk=0; | |
| 31295 | 100 | draw_screen_clip_rect_x1=0; | |
| 31296 | 100 | draw_screen_clip_rect_x2=255; | |
| 31297 | 100 | draw_screen_clip_rect_y1=0; | |
| 31298 | 100 | draw_screen_clip_rect_y2=223; | |
| 31299 | 100 | show_subscreen_items=true; | |
| 31300 | |||
| 31301 | //Warp Hero out of item cellars, in 2.10 and earlier quests. -Z ( 16th January, 2019 ) | ||
| 31302 | //Added a QR for this, to Other->2, as `Triforce in Cellar Warps Hero Out`. -Z 15th March, 2019 | ||
| 31303 |
5/6✗ Branch 0 not taken.
✓ Branch 1 taken 100 times.
✓ Branch 2 taken 52 times.
✓ Branch 3 taken 48 times.
✓ Branch 4 taken 51 times.
✓ Branch 5 taken 1 times.
|
100 | if((itemsbuf[id2].flags & item_flag1) && ( get_qr(qr_SIDEVIEWTRIFORCECELLAR) ? ( currscr < MAPSCRS192b136 ) : (currscr < MAPSCRSNORMAL) ) ) |
| 31304 | { | ||
| 31305 | 99 | sdir=dir; | |
| 31306 | 99 | dowarp(1,0); //side warp | |
| 31307 | 99 | } | |
| 31308 | else | ||
| 31309 | { | ||
| 31310 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if ( !(itemsbuf[id2].flags & item_flag11) ) playLevelMusic(); |
| 31311 | } | ||
| 31312 | 100 | } | |
| 31313 | |||
| 31314 | 28450 | void red_shift() | |
| 31315 | { | ||
| 31316 | 28450 | int32_t tnum=176; | |
| 31317 | |||
| 31318 | // set up the new palette | ||
| 31319 |
2/2✓ Branch 0 taken 910400 times.
✓ Branch 1 taken 28450 times.
|
938850 | for(int32_t i=CSET(2); i < CSET(4); i++) |
| 31320 | { | ||
| 31321 | 910400 | int32_t r = (i-CSET(2)) << 1; | |
| 31322 | 910400 | RAMpal[i+tnum].r = _rgb_scale_6[r]; | |
| 31323 | 910400 | RAMpal[i+tnum].g = _rgb_scale_6[r >> 3]; | |
| 31324 | 910400 | RAMpal[i+tnum].b = _rgb_scale_6[r >> 4]; | |
| 31325 | 910400 | } | |
| 31326 | |||
| 31327 | // color scale the game screen | ||
| 31328 |
2/2✓ Branch 0 taken 4779600 times.
✓ Branch 1 taken 28450 times.
|
4808050 | for(int32_t y=0; y<168; y++) |
| 31329 | { | ||
| 31330 |
2/2✓ Branch 0 taken 1223577600 times.
✓ Branch 1 taken 4779600 times.
|
1228357200 | for(int32_t x=0; x<256; x++) |
| 31331 | { | ||
| 31332 | 1223577600 | int c = framebuf->line[y+playing_field_offset][x]; | |
| 31333 | 1223577600 | int r = RAMpal[c].r / 4; | |
| 31334 | 1223577600 | int g = RAMpal[c].g / 4; | |
| 31335 | 1223577600 | int b = RAMpal[c].b / 4; | |
| 31336 |
2/2✓ Branch 0 taken 1150787269 times.
✓ Branch 1 taken 72790331 times.
|
1223577600 | int v = zc_min(int32_t(r*0.4 + g*0.6 + b*0.4)>>1,31); |
| 31337 |
2/2✓ Branch 0 taken 1222710767 times.
✓ Branch 1 taken 866833 times.
|
1223577600 | putpixel(framebuf, x, y + playing_field_offset, c ? (v + tnum+CSET(2)) : 0); |
| 31338 | 1223577600 | } | |
| 31339 | 4779600 | } | |
| 31340 | |||
| 31341 | 28450 | refreshpal = true; | |
| 31342 | 28450 | } | |
| 31343 | |||
| 31344 | |||
| 31345 | |||
| 31346 | ✗ | void setup_red_screen_old() | |
| 31347 | { | ||
| 31348 | ✗ | clear_bitmap(framebuf); | |
| 31349 | ✗ | rectfill(scrollbuf, 0, 0, 255, 167, 0); | |
| 31350 | |||
| 31351 | ✗ | if(XOR(tmpscr->flags7&fLAYER2BG, DMaps[currdmap].flags&dmfLAYER2BG)) do_layer(scrollbuf, 0, 2, tmpscr, 0, playing_field_offset, 2); | |
| 31352 | |||
| 31353 | ✗ | if(XOR(tmpscr->flags7&fLAYER3BG, DMaps[currdmap].flags&dmfLAYER3BG)) do_layer(scrollbuf, 0, 3, tmpscr, 0, playing_field_offset, 2); | |
| 31354 | |||
| 31355 | ✗ | if(lenscheck(tmpscr,0)) putscr(scrollbuf, 0, 0, tmpscr); | |
| 31356 | ✗ | putscrdoors(scrollbuf,0,0,tmpscr); | |
| 31357 | ✗ | blit(scrollbuf, framebuf, 0, 0, 0, playing_field_offset, 256, 168); | |
| 31358 | ✗ | do_layer(framebuf, 0, 1, tmpscr, 0, 0, 2); | |
| 31359 | |||
| 31360 | ✗ | if(!(XOR(tmpscr->flags7&fLAYER2BG, DMaps[currdmap].flags&dmfLAYER2BG))) do_layer(framebuf, 0, 2, tmpscr, 0, 0, 2); | |
| 31361 | |||
| 31362 | ✗ | if(get_qr(qr_PUSHBLOCK_SPRITE_LAYER)) | |
| 31363 | { | ||
| 31364 | ✗ | do_layer(framebuf, -2, 0, tmpscr, 0, 0, 2); | |
| 31365 | ✗ | if(get_qr(qr_PUSHBLOCK_LAYER_1_2)) | |
| 31366 | { | ||
| 31367 | ✗ | do_layer(framebuf, -2, 1, tmpscr, 0, 0, 2); | |
| 31368 | ✗ | do_layer(framebuf, -2, 2, tmpscr, 0, 0, 2); | |
| 31369 | ✗ | } | |
| 31370 | ✗ | } | |
| 31371 | |||
| 31372 | ✗ | if(!(msg_bg_display_buf->clip)) | |
| 31373 | { | ||
| 31374 | ✗ | blit_msgstr_bg(framebuf, 0, 0, 0, playing_field_offset, 256, 168); | |
| 31375 | ✗ | } | |
| 31376 | |||
| 31377 | ✗ | if(!(msg_portrait_display_buf->clip)) | |
| 31378 | { | ||
| 31379 | ✗ | blit_msgstr_prt(framebuf, 0, 0, 0, playing_field_offset, 256, 168); | |
| 31380 | ✗ | } | |
| 31381 | |||
| 31382 | ✗ | if(!(msg_txt_display_buf->clip)) | |
| 31383 | { | ||
| 31384 | ✗ | blit_msgstr_fg(framebuf, 0, 0, 0, playing_field_offset, 256, 168); | |
| 31385 | ✗ | } | |
| 31386 | |||
| 31387 | ✗ | if(!(pricesdisplaybuf->clip)) | |
| 31388 | { | ||
| 31389 | ✗ | masked_blit(pricesdisplaybuf, framebuf,0,0,0,playing_field_offset, 256,168); | |
| 31390 | ✗ | } | |
| 31391 | |||
| 31392 | //red shift | ||
| 31393 | // color scale the game screen | ||
| 31394 | ✗ | for(int32_t y=0; y<168; y++) | |
| 31395 | { | ||
| 31396 | ✗ | for(int32_t x=0; x<256; x++) | |
| 31397 | { | ||
| 31398 | ✗ | int32_t c = framebuf->line[y+playing_field_offset][x]; | |
| 31399 | ✗ | int32_t r = zc_min(int32_t(RAMpal[c].r*0.4 + RAMpal[c].g*0.6 + RAMpal[c].b*0.4)>>1,31); | |
| 31400 | ✗ | framebuf->line[y+playing_field_offset][x] = (c ? (r+CSET(2)) : 0); | |
| 31401 | ✗ | } | |
| 31402 | ✗ | } | |
| 31403 | |||
| 31404 | // Hero->draw(framebuf); | ||
| 31405 | ✗ | blit(framebuf,scrollbuf, 0, playing_field_offset, 256, playing_field_offset, 256, 168); | |
| 31406 | |||
| 31407 | ✗ | clear_bitmap(framebuf); | |
| 31408 | |||
| 31409 | ✗ | if(!((tmpscr->layermap[2]==0||(XOR(tmpscr->flags7&fLAYER3BG, DMaps[currdmap].flags&dmfLAYER3BG))) | |
| 31410 | ✗ | && tmpscr->layermap[3]==0 | |
| 31411 | ✗ | && tmpscr->layermap[4]==0 | |
| 31412 | ✗ | && tmpscr->layermap[5]==0 | |
| 31413 | ✗ | && !overheadcombos(tmpscr))) | |
| 31414 | { | ||
| 31415 | ✗ | if(!(XOR(tmpscr->flags7&fLAYER3BG, DMaps[currdmap].flags&dmfLAYER3BG))) do_layer(framebuf, 0, 3, tmpscr, 0, 0, 2); | |
| 31416 | |||
| 31417 | ✗ | do_layer(framebuf, 0, 4, tmpscr, 0, 0, 2); | |
| 31418 | ✗ | do_layer(framebuf, -1, 0, tmpscr, 0, 0, 2); | |
| 31419 | ✗ | if(get_qr(qr_OVERHEAD_COMBOS_L1_L2)) | |
| 31420 | { | ||
| 31421 | ✗ | do_layer(framebuf, -1, 1, tmpscr, 0, 0, 2); | |
| 31422 | ✗ | do_layer(framebuf, -1, 2, tmpscr, 0, 0, 2); | |
| 31423 | ✗ | } | |
| 31424 | ✗ | do_layer(framebuf, 0, 5, tmpscr, 0, 0, 2); | |
| 31425 | ✗ | do_layer(framebuf, 0, 6, tmpscr, 0, 0, 2); | |
| 31426 | |||
| 31427 | //do an AND masked blit for messages on top of layers | ||
| 31428 | ✗ | if(!(msg_txt_display_buf->clip) || !(msg_bg_display_buf->clip) || !(pricesdisplaybuf->clip) || !(msg_portrait_display_buf->clip)) | |
| 31429 | { | ||
| 31430 | ✗ | BITMAP* subbmp = create_bitmap_ex(8,256,168); | |
| 31431 | ✗ | clear_bitmap(subbmp); | |
| 31432 | ✗ | if(!(msg_txt_display_buf->clip) || !(msg_bg_display_buf->clip) || !(msg_portrait_display_buf->clip)) | |
| 31433 | { | ||
| 31434 | ✗ | masked_blit(framebuf, subbmp, 0, playing_field_offset, 0, 0, 256, 168); | |
| 31435 | ✗ | if(!(msg_bg_display_buf->clip)) blit_msgstr_bg(subbmp, 0, 0, 0, 0, 256, 168); | |
| 31436 | ✗ | if(!(msg_portrait_display_buf->clip)) blit_msgstr_prt(subbmp, 0, 0, 0, 0, 256, 168); | |
| 31437 | ✗ | if(!(msg_txt_display_buf->clip)) blit_msgstr_fg(subbmp, 0, 0, 0, 0, 256, 168); | |
| 31438 | ✗ | } | |
| 31439 | ✗ | for(int32_t y=0; y<168; y++) | |
| 31440 | { | ||
| 31441 | ✗ | for(int32_t x=0; x<256; x++) | |
| 31442 | { | ||
| 31443 | ✗ | int32_t c1 = framebuf->line[y+playing_field_offset][x]; | |
| 31444 | ✗ | int32_t c2 = subbmp->line[y][x]; | |
| 31445 | ✗ | int32_t c3 = pricesdisplaybuf->clip ? 0 : pricesdisplaybuf->line[y][x]; | |
| 31446 | |||
| 31447 | ✗ | if(c1 && c3) | |
| 31448 | { | ||
| 31449 | ✗ | framebuf->line[y+playing_field_offset][x] = c3; | |
| 31450 | ✗ | } | |
| 31451 | ✗ | else if(c1 && c2) | |
| 31452 | { | ||
| 31453 | ✗ | framebuf->line[y+playing_field_offset][x] = c2; | |
| 31454 | ✗ | } | |
| 31455 | ✗ | } | |
| 31456 | ✗ | } | |
| 31457 | ✗ | destroy_bitmap(subbmp); | |
| 31458 | ✗ | } | |
| 31459 | |||
| 31460 | //red shift | ||
| 31461 | // color scale the game screen | ||
| 31462 | ✗ | for(int32_t y=0; y<168; y++) | |
| 31463 | { | ||
| 31464 | ✗ | for(int32_t x=0; x<256; x++) | |
| 31465 | { | ||
| 31466 | ✗ | int32_t c = framebuf->line[y+playing_field_offset][x]; | |
| 31467 | ✗ | int32_t r = zc_min(int32_t(RAMpal[c].r*0.4 + RAMpal[c].g*0.6 + RAMpal[c].b*0.4)>>1,31); | |
| 31468 | ✗ | framebuf->line[y+playing_field_offset][x] = r+CSET(2); | |
| 31469 | ✗ | } | |
| 31470 | ✗ | } | |
| 31471 | ✗ | } | |
| 31472 | |||
| 31473 | ✗ | blit(framebuf,scrollbuf, 0, playing_field_offset, 0, playing_field_offset, 256, 168); | |
| 31474 | |||
| 31475 | // set up the new palette | ||
| 31476 | ✗ | for(int32_t i=CSET(2); i < CSET(4); i++) | |
| 31477 | { | ||
| 31478 | ✗ | int32_t r = (i-CSET(2)) << 1; | |
| 31479 | ✗ | RAMpal[i].r = r; | |
| 31480 | ✗ | RAMpal[i].g = r >> 3; | |
| 31481 | ✗ | RAMpal[i].b = r >> 4; | |
| 31482 | ✗ | } | |
| 31483 | |||
| 31484 | ✗ | refreshpal = true; | |
| 31485 | ✗ | } | |
| 31486 | |||
| 31487 | |||
| 31488 | |||
| 31489 | 75 | void slide_in_color(int32_t color) | |
| 31490 | { | ||
| 31491 |
2/2✓ Branch 0 taken 375 times.
✓ Branch 1 taken 75 times.
|
450 | for(int32_t i=1; i<16; i+=3) |
| 31492 | { | ||
| 31493 | 375 | RAMpal[CSET(2)+i+2] = RAMpal[CSET(2)+i+1]; | |
| 31494 | 375 | RAMpal[CSET(2)+i+1] = RAMpal[CSET(2)+i]; | |
| 31495 | 375 | RAMpal[CSET(2)+i] = NESpal(color); | |
| 31496 | 375 | } | |
| 31497 | |||
| 31498 | 75 | refreshpal=true; | |
| 31499 | 75 | } | |
| 31500 | |||
| 31501 | |||
| 31502 | 274 | void HeroClass::heroDeathAnimation() | |
| 31503 | { | ||
| 31504 | 274 | int32_t f=0; | |
| 31505 | 274 | int32_t deathclk=0,deathfrm=0; | |
| 31506 | |||
| 31507 | 274 | action=none; FFCore.setHeroAction(dying); //mayhaps a new action of 'gameover'? -Z | |
| 31508 | |||
| 31509 | 274 | kill_sfx(); //call before the onDeath script. | |
| 31510 | |||
| 31511 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 274 times.
|
274 | if(!debug_enabled) |
| 31512 | { | ||
| 31513 | 274 | Paused=false; | |
| 31514 | 274 | } | |
| 31515 | |||
| 31516 | /* | ||
| 31517 | game->set_deaths(zc_min(game->get_deaths()+1,999)); | ||
| 31518 | dir=down; | ||
| 31519 | music_stop(); | ||
| 31520 | |||
| 31521 | attackclk=hclk=superman=0; | ||
| 31522 | scriptcoldet = true; | ||
| 31523 | |||
| 31524 | for(int32_t i=0; i<32; i++) miscellaneous[i] = 0; | ||
| 31525 | |||
| 31526 | |||
| 31527 | |||
| 31528 | playing_field_offset=56; // otherwise, red_shift() may go past the bottom of the screen | ||
| 31529 | quakeclk=wavy=0; | ||
| 31530 | |||
| 31531 | //in original Z1, Hero marker vanishes at death. | ||
| 31532 | //code in subscr.cpp, put_passive_subscr checks the following value. | ||
| 31533 | //color 255 is a GUI color, so quest makers shouldn't be using this value. | ||
| 31534 | //Also, subscreen is static after death in Z1. | ||
| 31535 | int32_t tmp_hero_dot = QMisc.colors.hero_dot; | ||
| 31536 | QMisc.colors.hero_dot = 255; | ||
| 31537 | //doesn't work | ||
| 31538 | //scrollbuf is tampered with by draw_screen() | ||
| 31539 | //put_passive_subscr(scrollbuf, 256, passive_subscreen_offset, false, false);//save this and reuse it. | ||
| 31540 | BITMAP *subscrbmp = create_bitmap_ex(8, framebuf->w, framebuf->h); | ||
| 31541 | clear_bitmap(subscrbmp); | ||
| 31542 | put_passive_subscr(subscrbmp, 0, passive_subscreen_offset, false, sspUP); | ||
| 31543 | QMisc.colors.hero_dot = tmp_hero_dot; | ||
| 31544 | */ | ||
| 31545 | 274 | BITMAP *subscrbmp = create_bitmap_ex(8, framebuf->w, framebuf->h); | |
| 31546 | 274 | clear_bitmap(subscrbmp); | |
| 31547 | //get rid off all sprites but Hero | ||
| 31548 | 274 | guys.clear(); | |
| 31549 | 274 | items.clear(); | |
| 31550 | 274 | Ewpns.clear(); | |
| 31551 | 274 | Lwpns.clear(); | |
| 31552 | 274 | chainlinks.clear(); | |
| 31553 | 274 | decorations.clear(); | |
| 31554 | |||
| 31555 | 274 | kill_subscr_items(); | |
| 31556 | |||
| 31557 | 274 | Playing = false; | |
| 31558 | |||
| 31559 |
1/2✓ Branch 0 taken 274 times.
✗ Branch 1 not taken.
|
274 | game->set_deaths(zc_min(game->get_deaths()+1,USHRT_MAX)); |
| 31560 | 274 | dir=down; | |
| 31561 | 274 | music_stop(); | |
| 31562 | |||
| 31563 | 274 | attackclk=hclk=superman=0; | |
| 31564 | 274 | scriptcoldet = true; | |
| 31565 | |||
| 31566 |
2/2✓ Branch 0 taken 8768 times.
✓ Branch 1 taken 274 times.
|
9042 | for(int32_t i=0; i<32; i++) miscellaneous[i] = 0; |
| 31567 | |||
| 31568 | |||
| 31569 | |||
| 31570 | 274 | playing_field_offset=56; // otherwise, red_shift() may go past the bottom of the screen | |
| 31571 | 274 | quakeclk=wavy=0; | |
| 31572 | |||
| 31573 | //in original Z1, Hero marker vanishes at death. | ||
| 31574 | //code in subscr.cpp, put_passive_subscr checks the following value. | ||
| 31575 | //color 255 is a GUI color, so quest makers shouldn't be using this value. | ||
| 31576 | //Also, subscreen is static after death in Z1. | ||
| 31577 | 274 | int32_t tmp_hero_dot = QMisc.colors.hero_dot; | |
| 31578 | 274 | QMisc.colors.hero_dot = 255; | |
| 31579 | //doesn't work | ||
| 31580 | //scrollbuf is tampered with by draw_screen() | ||
| 31581 | //put_passive_subscr(scrollbuf, 256, passive_subscreen_offset, false, false);//save this and reuse it. | ||
| 31582 | |||
| 31583 | 274 | put_passive_subscr(subscrbmp, 0, passive_subscreen_offset, game->should_show_time(), sspUP); | |
| 31584 | //Don't forget passive subscreen scripts! | ||
| 31585 |
2/2✓ Branch 0 taken 252 times.
✓ Branch 1 taken 22 times.
|
274 | if(get_qr(qr_PASSIVE_SUBSCRIPT_RUNS_WHEN_GAME_IS_FROZEN)) |
| 31586 | { | ||
| 31587 | 22 | script_drawing_commands.Clear(); //We only want draws from this script | |
| 31588 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(DMaps[currdmap].passive_sub_script != 0) |
| 31589 | ✗ | ZScriptVersion::RunScript(ScriptType::ScriptedPassiveSubscreen, DMaps[currdmap].passive_sub_script, currdmap); | |
| 31590 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 22 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
22 | if (FFCore.waitdraw(ScriptType::ScriptedPassiveSubscreen) && DMaps[currdmap].passive_sub_script != 0 && FFCore.doscript(ScriptType::ScriptedPassiveSubscreen)) |
| 31591 | { | ||
| 31592 | ✗ | ZScriptVersion::RunScript(ScriptType::ScriptedPassiveSubscreen, DMaps[currdmap].passive_sub_script, currdmap); | |
| 31593 | ✗ | FFCore.waitdraw(ScriptType::ScriptedPassiveSubscreen) = false; | |
| 31594 | ✗ | } | |
| 31595 | 22 | BITMAP* tmp = framebuf; | |
| 31596 | 22 | framebuf = subscrbmp; //Hack; force draws to subscrbmp | |
| 31597 | 22 | do_script_draws(framebuf, tmpscr, 0, playing_field_offset); //Draw the script draws | |
| 31598 | 22 | framebuf = tmp; | |
| 31599 | 22 | script_drawing_commands.Clear(); //Don't let these draws repeat during 'draw_screen()' | |
| 31600 | 22 | } | |
| 31601 | 274 | QMisc.colors.hero_dot = tmp_hero_dot; | |
| 31602 | 274 | bool clearedit = false; | |
| 31603 | 274 | do | |
| 31604 | { | ||
| 31605 |
2/2✓ Branch 0 taken 69204 times.
✓ Branch 1 taken 25359 times.
|
94563 | if(f<254) |
| 31606 | { | ||
| 31607 |
2/2✓ Branch 0 taken 60226 times.
✓ Branch 1 taken 8978 times.
|
69204 | if(f<=32) |
| 31608 | { | ||
| 31609 | 8978 | hclk=(32-f); | |
| 31610 | 8978 | } | |
| 31611 | |||
| 31612 |
4/4✓ Branch 0 taken 52338 times.
✓ Branch 1 taken 16866 times.
✓ Branch 2 taken 31711 times.
✓ Branch 3 taken 20627 times.
|
69204 | if(f>=62 && f<138) |
| 31613 | { | ||
| 31614 |
5/5✓ Branch 0 taken 16284 times.
✓ Branch 1 taken 1086 times.
✓ Branch 2 taken 1086 times.
✓ Branch 3 taken 1086 times.
✓ Branch 4 taken 1085 times.
|
20627 | switch((f-62)%20) |
| 31615 | { | ||
| 31616 | case 0: | ||
| 31617 | 1086 | dir=right; | |
| 31618 | 1086 | break; | |
| 31619 | |||
| 31620 | case 5: | ||
| 31621 | 1086 | dir=up; | |
| 31622 | 1086 | break; | |
| 31623 | |||
| 31624 | case 10: | ||
| 31625 | 1086 | dir=left; | |
| 31626 | 1086 | break; | |
| 31627 | |||
| 31628 | case 15: | ||
| 31629 | 1085 | dir=down; | |
| 31630 | 1085 | break; | |
| 31631 | } | ||
| 31632 | |||
| 31633 | 20627 | herostep(); | |
| 31634 | 20627 | } | |
| 31635 | |||
| 31636 |
4/4✓ Branch 0 taken 16535 times.
✓ Branch 1 taken 52669 times.
✓ Branch 2 taken 12446 times.
✓ Branch 3 taken 4089 times.
|
69204 | if(f>=194 && f<208) |
| 31637 | { | ||
| 31638 |
2/2✓ Branch 0 taken 3818 times.
✓ Branch 1 taken 271 times.
|
4089 | if(f==194) |
| 31639 | { | ||
| 31640 | 271 | action=dying; | |
| 31641 | 271 | FFCore.setHeroAction(dying); | |
| 31642 | 271 | } | |
| 31643 | |||
| 31644 | 4089 | extend = 0; | |
| 31645 | 4089 | cs = wpnsbuf[spr_death].csets&15; | |
| 31646 | 4089 | tile = wpnsbuf[spr_death].tile; | |
| 31647 |
2/2✓ Branch 0 taken 3514 times.
✓ Branch 1 taken 575 times.
|
4089 | if(!get_qr(qr_HARDCODED_ENEMY_ANIMS)) |
| 31648 | { | ||
| 31649 | 575 | tile += deathfrm; | |
| 31650 | 575 | f = 206; | |
| 31651 |
2/2✓ Branch 0 taken 495 times.
✓ Branch 1 taken 80 times.
|
575 | if(++deathclk >= wpnsbuf[spr_death].speed) |
| 31652 | { | ||
| 31653 | 80 | deathclk=0; | |
| 31654 |
2/2✓ Branch 0 taken 60 times.
✓ Branch 1 taken 20 times.
|
80 | if(++deathfrm >= wpnsbuf[spr_death].frames) |
| 31655 | { | ||
| 31656 | 20 | f = 208; | |
| 31657 | 20 | deathfrm = 0; | |
| 31658 | 20 | } | |
| 31659 | 80 | } | |
| 31660 | 575 | } | |
| 31661 |
2/2✓ Branch 0 taken 2632 times.
✓ Branch 1 taken 882 times.
|
3514 | else if(BSZ) |
| 31662 | { | ||
| 31663 | 2632 | tile += (f-194)/3; | |
| 31664 | 2632 | } | |
| 31665 |
2/2✓ Branch 0 taken 630 times.
✓ Branch 1 taken 252 times.
|
882 | else if(f>=204) |
| 31666 | { | ||
| 31667 | 252 | ++tile; | |
| 31668 | 252 | } | |
| 31669 | 4089 | } | |
| 31670 | |||
| 31671 |
2/2✓ Branch 0 taken 68933 times.
✓ Branch 1 taken 271 times.
|
69204 | if(f==208) |
| 31672 | { | ||
| 31673 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 267 times.
|
271 | if ( dontdraw < 2 ) { dontdraw = 1; } |
| 31674 | 271 | } | |
| 31675 |
2/2✓ Branch 0 taken 65394 times.
✓ Branch 1 taken 3810 times.
|
69204 | if(get_qr(qr_FADE)) |
| 31676 | { | ||
| 31677 |
2/2✓ Branch 0 taken 43615 times.
✓ Branch 1 taken 21779 times.
|
65394 | if(f < 170) |
| 31678 | { | ||
| 31679 |
2/2✓ Branch 0 taken 28193 times.
✓ Branch 1 taken 15422 times.
|
43615 | if(f<60) |
| 31680 | { | ||
| 31681 | 15422 | draw_screen(tmpscr); | |
| 31682 | //reuse our static subscreen | ||
| 31683 | 15422 | set_clip_rect(framebuf, 0, 0, framebuf->w, framebuf->h); | |
| 31684 | 15422 | blit(subscrbmp,framebuf,0,0,0,0,256,passive_subscreen_height); | |
| 31685 | 15422 | } | |
| 31686 | |||
| 31687 |
2/2✓ Branch 0 taken 43358 times.
✓ Branch 1 taken 257 times.
|
43615 | if(f==60) |
| 31688 | { | ||
| 31689 | 257 | red_shift(); | |
| 31690 | 257 | create_rgb_table_range(&rgb_table, RAMpal, 208, 239, NULL); | |
| 31691 | 257 | create_zc_trans_table(&trans_table, RAMpal, 128, 128, 128); | |
| 31692 | 257 | memcpy(&trans_table2, &trans_table, sizeof(COLOR_MAP)); | |
| 31693 | |||
| 31694 |
2/2✓ Branch 0 taken 65792 times.
✓ Branch 1 taken 257 times.
|
66049 | for(int32_t q=0; q<PAL_SIZE; q++) |
| 31695 | { | ||
| 31696 | 65792 | trans_table2.data[0][q] = q; | |
| 31697 | 65792 | trans_table2.data[q][q] = q; | |
| 31698 | 65792 | } | |
| 31699 | 257 | } | |
| 31700 | |||
| 31701 |
3/4✓ Branch 0 taken 28193 times.
✓ Branch 1 taken 15422 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 28193 times.
|
43615 | if(f>=60 && f<=169) |
| 31702 | { | ||
| 31703 | 28193 | draw_screen(tmpscr); | |
| 31704 | //reuse our static subscreen | ||
| 31705 | 28193 | blit(subscrbmp,framebuf,0,0,0,0,256,passive_subscreen_height); | |
| 31706 | 28193 | red_shift(); | |
| 31707 | |||
| 31708 | 28193 | } | |
| 31709 | |||
| 31710 |
3/4✓ Branch 0 taken 7936 times.
✓ Branch 1 taken 35679 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7936 times.
|
43615 | if(f>=139 && f<=169)//fade from red to black |
| 31711 | { | ||
| 31712 | 7936 | fade_interpolate(RAMpal,black_palette,RAMpal, (f-138)<<1, 224, 255); | |
| 31713 | 7936 | create_rgb_table_range(&rgb_table, RAMpal, 208, 239, NULL); | |
| 31714 | 7936 | create_zc_trans_table(&trans_table, RAMpal, 128, 128, 128); | |
| 31715 | 7936 | memcpy(&trans_table2, &trans_table, sizeof(COLOR_MAP)); | |
| 31716 | |||
| 31717 |
2/2✓ Branch 0 taken 2031616 times.
✓ Branch 1 taken 7936 times.
|
2039552 | for(int32_t q=0; q<PAL_SIZE; q++) |
| 31718 | { | ||
| 31719 | 2031616 | trans_table2.data[0][q] = q; | |
| 31720 | 2031616 | trans_table2.data[q][q] = q; | |
| 31721 | 2031616 | } | |
| 31722 | |||
| 31723 | 7936 | refreshpal=true; | |
| 31724 | 7936 | } | |
| 31725 | 43615 | } | |
| 31726 | else //f>=170 | ||
| 31727 | { | ||
| 31728 |
2/2✓ Branch 0 taken 21523 times.
✓ Branch 1 taken 256 times.
|
21779 | if(f==170)//make Hero grayish |
| 31729 | { | ||
| 31730 | 256 | fade_interpolate(RAMpal,black_palette,RAMpal,64, 224, 255); | |
| 31731 | |||
| 31732 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 256 times.
|
4352 | for(int32_t i=CSET(6); i < CSET(7); i++) |
| 31733 | { | ||
| 31734 | 4096 | int32_t g = (RAMpal[i].r + RAMpal[i].g + RAMpal[i].b)/3; | |
| 31735 | 4096 | RAMpal[i] = _RGB(g,g,g); | |
| 31736 | 4096 | } | |
| 31737 | |||
| 31738 | 256 | refreshpal = true; | |
| 31739 | 256 | } | |
| 31740 | |||
| 31741 | //draw only hero. otherwise black layers might cover him. | ||
| 31742 | 21779 | rectfill(framebuf,0,playing_field_offset,255,167+playing_field_offset,0); | |
| 31743 | 21779 | draw(framebuf); | |
| 31744 | 21779 | blit(subscrbmp,framebuf,0,0,0,0,256,passive_subscreen_height); | |
| 31745 | } | ||
| 31746 | 65394 | } | |
| 31747 | else //!qr_FADE | ||
| 31748 | { | ||
| 31749 |
2/2✓ Branch 0 taken 3795 times.
✓ Branch 1 taken 15 times.
|
3810 | if(f==58) |
| 31750 | { | ||
| 31751 |
2/2✓ Branch 0 taken 1440 times.
✓ Branch 1 taken 15 times.
|
1455 | for(int32_t i = 0; i < 96; i++) |
| 31752 | 1440 | tmpscr->cset[i] = 3; | |
| 31753 | |||
| 31754 |
2/2✓ Branch 0 taken 90 times.
✓ Branch 1 taken 15 times.
|
105 | for(int32_t j=0; j<6; j++) |
| 31755 |
2/2✓ Branch 0 taken 88 times.
✓ Branch 1 taken 2 times.
|
92 | if(tmpscr->layermap[j]>0) |
| 31756 |
2/2✓ Branch 0 taken 192 times.
✓ Branch 1 taken 2 times.
|
194 | for(int32_t i=0; i<96; i++) |
| 31757 | 194 | tmpscr2[j].cset[i] = 3; | |
| 31758 | 15 | } | |
| 31759 | |||
| 31760 |
2/2✓ Branch 0 taken 3795 times.
✓ Branch 1 taken 15 times.
|
3810 | if(f==59) |
| 31761 | { | ||
| 31762 |
2/2✓ Branch 0 taken 1200 times.
✓ Branch 1 taken 15 times.
|
1215 | for(int32_t i = 96; i < 176; i++) |
| 31763 | 1200 | tmpscr->cset[i] = 3; | |
| 31764 | |||
| 31765 |
2/2✓ Branch 0 taken 90 times.
✓ Branch 1 taken 15 times.
|
105 | for(int32_t j=0; j<6; j++) |
| 31766 |
2/2✓ Branch 0 taken 88 times.
✓ Branch 1 taken 2 times.
|
92 | if(tmpscr->layermap[j]>0) |
| 31767 |
2/2✓ Branch 0 taken 160 times.
✓ Branch 1 taken 2 times.
|
162 | for(int32_t i=96; i<176; i++) |
| 31768 | 162 | tmpscr2[j].cset[i] = 3; | |
| 31769 | 15 | } | |
| 31770 | |||
| 31771 |
2/2✓ Branch 0 taken 3795 times.
✓ Branch 1 taken 15 times.
|
3810 | if(f==60) |
| 31772 | { | ||
| 31773 |
2/2✓ Branch 0 taken 2640 times.
✓ Branch 1 taken 15 times.
|
2655 | for(int32_t i=0; i<176; i++) |
| 31774 | { | ||
| 31775 | 2640 | tmpscr->cset[i] = 2; | |
| 31776 | 2640 | } | |
| 31777 | |||
| 31778 |
2/2✓ Branch 0 taken 90 times.
✓ Branch 1 taken 15 times.
|
105 | for(int32_t j=0; j<6; j++) |
| 31779 |
2/2✓ Branch 0 taken 88 times.
✓ Branch 1 taken 2 times.
|
92 | if(tmpscr->layermap[j]>0) |
| 31780 |
2/2✓ Branch 0 taken 352 times.
✓ Branch 1 taken 2 times.
|
354 | for(int32_t i=0; i<176; i++) |
| 31781 | 354 | tmpscr2[j].cset[i] = 2; | |
| 31782 | |||
| 31783 |
2/2✓ Branch 0 taken 75 times.
✓ Branch 1 taken 15 times.
|
90 | for(int32_t i=1; i<16; i+=3) |
| 31784 | { | ||
| 31785 | 75 | RAMpal[CSET(2)+i] = NESpal(0x17); | |
| 31786 | 75 | RAMpal[CSET(2)+i+1] = NESpal(0x16); | |
| 31787 | 75 | RAMpal[CSET(2)+i+2] = NESpal(0x26); | |
| 31788 | 75 | } | |
| 31789 | |||
| 31790 | 15 | refreshpal=true; | |
| 31791 | 15 | } | |
| 31792 | |||
| 31793 |
2/2✓ Branch 0 taken 3795 times.
✓ Branch 1 taken 15 times.
|
3810 | if(f==139) |
| 31794 | 15 | slide_in_color(0x06); | |
| 31795 | |||
| 31796 |
2/2✓ Branch 0 taken 3795 times.
✓ Branch 1 taken 15 times.
|
3810 | if(f==149) |
| 31797 | 15 | slide_in_color(0x07); | |
| 31798 | |||
| 31799 |
2/2✓ Branch 0 taken 3795 times.
✓ Branch 1 taken 15 times.
|
3810 | if(f==159) |
| 31800 | 15 | slide_in_color(0x0F); | |
| 31801 | |||
| 31802 |
2/2✓ Branch 0 taken 3795 times.
✓ Branch 1 taken 15 times.
|
3810 | if(f==169) |
| 31803 | { | ||
| 31804 | 15 | slide_in_color(0x0F); | |
| 31805 | 15 | slide_in_color(0x0F); | |
| 31806 | 15 | } | |
| 31807 | |||
| 31808 |
2/2✓ Branch 0 taken 3795 times.
✓ Branch 1 taken 15 times.
|
3810 | if(f==170) |
| 31809 | { | ||
| 31810 |
2/2✓ Branch 0 taken 75 times.
✓ Branch 1 taken 15 times.
|
90 | for(int32_t i=1; i<16; i+=3) |
| 31811 | { | ||
| 31812 | 75 | RAMpal[CSET(6)+i] = NESpal(0x10); | |
| 31813 | 75 | RAMpal[CSET(6)+i+1] = NESpal(0x30); | |
| 31814 | 75 | RAMpal[CSET(6)+i+2] = NESpal(0x00); | |
| 31815 | 75 | refreshpal = true; | |
| 31816 | 75 | } | |
| 31817 | 15 | } | |
| 31818 | |||
| 31819 |
2/2✓ Branch 0 taken 2535 times.
✓ Branch 1 taken 1275 times.
|
3810 | if(f < 169) |
| 31820 | { | ||
| 31821 | 2535 | draw_screen(tmpscr); | |
| 31822 | //reuse our static subscreen | ||
| 31823 | 2535 | blit(subscrbmp,framebuf,0,0,0,0,256,passive_subscreen_height); | |
| 31824 | 2535 | } | |
| 31825 | else | ||
| 31826 | { | ||
| 31827 | //draw only hero. otherwise black layers might cover him. | ||
| 31828 | 1275 | rectfill(framebuf,0,playing_field_offset,255,167+playing_field_offset,0); | |
| 31829 | 1275 | draw(framebuf); | |
| 31830 | 1275 | blit(subscrbmp,framebuf,0,0,0,0,256,passive_subscreen_height); | |
| 31831 | } | ||
| 31832 | } | ||
| 31833 | 69204 | } | |
| 31834 | |||
| 31835 |
2/2✓ Branch 0 taken 24591 times.
✓ Branch 1 taken 768 times.
|
25359 | else if(f<350)//draw 'GAME OVER' text |
| 31836 | { | ||
| 31837 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 24591 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
24591 | if(get_qr(qr_INSTANT_RESPAWN) && !get_qr(qr_INSTANT_CONTINUE)) |
| 31838 | { | ||
| 31839 | ✗ | Quit = qRELOAD; | |
| 31840 | ✗ | skipcont = 1; | |
| 31841 | ✗ | clear_bitmap(framebuf); | |
| 31842 | ✗ | blit(subscrbmp,framebuf,0,0,0,0,256,passive_subscreen_height); | |
| 31843 | ✗ | } | |
| 31844 |
3/4✓ Branch 0 taken 24591 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24576 times.
✓ Branch 3 taken 15 times.
|
24591 | else if(!get_qr(qr_INSTANT_RESPAWN) && get_qr(qr_INSTANT_CONTINUE)) |
| 31845 | { | ||
| 31846 | 15 | Quit = qCONT; | |
| 31847 | 15 | skipcont = 1; | |
| 31848 | 15 | clear_bitmap(framebuf); | |
| 31849 | 15 | blit(subscrbmp,framebuf,0,0,0,0,256,passive_subscreen_height); | |
| 31850 | 15 | } | |
| 31851 | else | ||
| 31852 | { | ||
| 31853 | 24576 | clear_info_bmp(); | |
| 31854 | 24576 | clear_to_color(framebuf,SaveScreenSettings[SAVESC_BACKGROUND]); | |
| 31855 | 24576 | blit(subscrbmp,framebuf,0,0,0,0,256,passive_subscreen_height); | |
| 31856 | 24576 | textout_ex(framebuf,get_zc_font(font_zfont),"GAME OVER",96,playing_field_offset+80,SaveScreenSettings[SAVESC_TEXT],-1); | |
| 31857 | } | ||
| 31858 | 24591 | } | |
| 31859 | else | ||
| 31860 | { | ||
| 31861 | 768 | clear_bitmap(framebuf); | |
| 31862 | } | ||
| 31863 | |||
| 31864 | //SFX... put them all here | ||
| 31865 |
4/4✓ Branch 0 taken 93766 times.
✓ Branch 1 taken 274 times.
✓ Branch 2 taken 272 times.
✓ Branch 3 taken 251 times.
|
94563 | switch(f) |
| 31866 | { | ||
| 31867 | case 0: | ||
| 31868 | 274 | sfx(getHurtSFX(),pan(x.getInt())); | |
| 31869 | 274 | break; | |
| 31870 | //Death sound. | ||
| 31871 | case 60: | ||
| 31872 | 272 | sfx(WAV_SPIRAL); | |
| 31873 | 272 | break; | |
| 31874 | //Message sound. | ||
| 31875 | case 194: | ||
| 31876 | 251 | sfx(WAV_MSG); | |
| 31877 | 251 | break; | |
| 31878 | } | ||
| 31879 | //adv: | ||
| 31880 | 94563 | clear_darkroom_bitmaps(); | |
| 31881 | 94563 | advanceframe(true); | |
| 31882 | 94563 | ++f; | |
| 31883 |
2/2✓ Branch 0 taken 94289 times.
✓ Branch 1 taken 274 times.
|
189126 | } |
| 31884 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 94307 times.
|
94563 | while(f<353 && !Quit); |
| 31885 | |||
| 31886 | 274 | destroy_bitmap(subscrbmp); | |
| 31887 | 274 | action=none; FFCore.setHeroAction(none); | |
| 31888 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 270 times.
|
274 | if ( dontdraw < 2 ) { dontdraw=0; } |
| 31889 | 274 | } | |
| 31890 | |||
| 31891 | |||
| 31892 | 17 | void HeroClass::ganon_intro() | |
| 31893 | { | ||
| 31894 | /* | ||
| 31895 | ************************ | ||
| 31896 | * GANON INTRO SEQUENCE * | ||
| 31897 | ************************ | ||
| 31898 | -25 DOT updates | ||
| 31899 | -24 HERO in | ||
| 31900 | 0 TRIFORCE overhead - code begins at this point (f == 0) | ||
| 31901 | 47 GANON in | ||
| 31902 | 58 LIGHT step | ||
| 31903 | 68 LIGHT step | ||
| 31904 | 78 LIGHT step | ||
| 31905 | 255 TRIFORCE out | ||
| 31906 | 256 TRIFORCE in | ||
| 31907 | 270 TRIFORCE out | ||
| 31908 | 271 GANON out, HERO face up | ||
| 31909 | */ | ||
| 31910 | 17 | loaded_guys=true; | |
| 31911 | 17 | loaditem(); | |
| 31912 | |||
| 31913 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 13 times.
|
17 | if(game->lvlitems[dlevel]&liBOSS) |
| 31914 | { | ||
| 31915 | 4 | return; | |
| 31916 | } | ||
| 31917 | |||
| 31918 | 13 | dir=down; | |
| 31919 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
|
13 | if ( !isSideViewHero() ) |
| 31920 | { | ||
| 31921 | 13 | fall = 0; //Fix midair glitch on holding triforce. -Z | |
| 31922 | 13 | fakefall = 0; | |
| 31923 | 13 | z = 0; | |
| 31924 | 13 | fakez = 0; | |
| 31925 | 13 | } | |
| 31926 | 13 | action=landhold2; FFCore.setHeroAction(landhold2); | |
| 31927 | 13 | holditem=getItemID(itemsbuf,itype_triforcepiece, 1); | |
| 31928 | //not good, as this only returns the highest level that Hero possesses. -DD | ||
| 31929 | //getHighestLevelOfFamily(game, itemsbuf, itype_triforcepiece, false)); | ||
| 31930 | |||
| 31931 |
4/4✓ Branch 0 taken 13 times.
✓ Branch 1 taken 3133 times.
✓ Branch 2 taken 3133 times.
✓ Branch 3 taken 13 times.
|
3146 | for(int32_t f=0; f<271 && !Quit; f++) |
| 31932 | { | ||
| 31933 |
2/2✓ Branch 0 taken 3120 times.
✓ Branch 1 taken 13 times.
|
3133 | if(f==47) |
| 31934 | { | ||
| 31935 | 13 | music_stop(); | |
| 31936 | 13 | stop_sfx(WAV_ROAR); | |
| 31937 | 13 | sfx(WAV_GASP); | |
| 31938 | 13 | sfx(WAV_GANON); | |
| 31939 | 13 | int32_t Id=0; | |
| 31940 | |||
| 31941 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1027 times.
|
1027 | for(int32_t i=0; i<eMAXGUYS; i++) |
| 31942 | { | ||
| 31943 |
2/2✓ Branch 0 taken 1014 times.
✓ Branch 1 taken 13 times.
|
1027 | if(guysbuf[i].flags&guy_ganon) |
| 31944 | { | ||
| 31945 | 13 | Id=i; | |
| 31946 | 13 | break; | |
| 31947 | } | ||
| 31948 | 1014 | } | |
| 31949 | |||
| 31950 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 3 times.
|
13 | if(current_item(itype_ring)) |
| 31951 | { | ||
| 31952 | 10 | addenemy(160,96,Id,0); | |
| 31953 | 10 | } | |
| 31954 | else | ||
| 31955 | { | ||
| 31956 | 3 | addenemy(80,32,Id,0); | |
| 31957 | } | ||
| 31958 | 13 | } | |
| 31959 | |||
| 31960 |
2/2✓ Branch 0 taken 3120 times.
✓ Branch 1 taken 13 times.
|
3133 | if(f==48) |
| 31961 | { | ||
| 31962 | 13 | lighting(true,true); // Hmm. -L | |
| 31963 | 13 | f += 30; | |
| 31964 | 13 | } | |
| 31965 | |||
| 31966 | //NES Z1, the triforce vanishes for one frame in two cases | ||
| 31967 | //while still showing Hero's two-handed overhead sprite. | ||
| 31968 | //This should be a Quest Rule for NES Accuracy. -Z | ||
| 31969 |
4/4✓ Branch 0 taken 3120 times.
✓ Branch 1 taken 13 times.
✓ Branch 2 taken 13 times.
✓ Branch 3 taken 3107 times.
|
3133 | if(f==255 || f==270) |
| 31970 | { | ||
| 31971 | 26 | holditem=-1; | |
| 31972 | 26 | } | |
| 31973 | |||
| 31974 |
2/2✓ Branch 0 taken 3120 times.
✓ Branch 1 taken 13 times.
|
3133 | if(f==256) |
| 31975 | { | ||
| 31976 | 13 | holditem=getItemID(itemsbuf,itype_triforcepiece,1); | |
| 31977 | 13 | } | |
| 31978 | |||
| 31979 | 3133 | draw_screen(tmpscr); | |
| 31980 | 3133 | advanceframe(true); | |
| 31981 | |||
| 31982 |
1/2✓ Branch 0 taken 3133 times.
✗ Branch 1 not taken.
|
3133 | if(rSbtn()) |
| 31983 | { | ||
| 31984 | ✗ | conveyclk=3; | |
| 31985 | ✗ | int32_t tmp_subscr_clk = frame; | |
| 31986 | ✗ | dosubscr(); | |
| 31987 | ✗ | newscr_clk += frame - tmp_subscr_clk; | |
| 31988 | ✗ | } | |
| 31989 | |||
| 31990 | 3133 | } | |
| 31991 | |||
| 31992 | 13 | action=none; FFCore.setHeroAction(none); | |
| 31993 | 13 | dir=up; | |
| 31994 | |||
| 31995 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 11 times.
|
13 | if((!getmapflag() || (tmpscr->flags9&fBELOWRETURN)) && (tunes[MAXMIDIS-1].data)) |
| 31996 | 2 | jukebox(MAXMIDIS-1); | |
| 31997 | else | ||
| 31998 | 11 | playLevelMusic(); | |
| 31999 | |||
| 32000 | 13 | currcset=DMaps[currdmap].color; | |
| 32001 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
|
13 | if (get_qr(qr_GANONINTRO) ) |
| 32002 | { | ||
| 32003 | 13 | dointro(); | |
| 32004 | //Yes, I checked. This is literally in 2.10 (minus this if statement of course). | ||
| 32005 | //I have no clue why it's here; Literally the only difference between dointro in 2.10 and dointro in this version is an 'else' that sets introclk and intropos to 74. | ||
| 32006 | //I have no idea what was going through the original devs heads and I'm extremely worried I'm missing something, cause at first glance this looks like | ||
| 32007 | //a hack solution to an underlying bug, but no! There's just a fucking dointro() call in older versions and I don't know *why*. -Deedee | ||
| 32008 | 13 | } | |
| 32009 | //dointro(); //This is likely what causes Ganon Rooms to repeat the DMap intro. | ||
| 32010 | //I suppose it is to allow the user to make Gaanon rooms have their own dialogue, if they are | ||
| 32011 | //on a different DMap. | ||
| 32012 | //~ Otherwise, why is it here?! -Z | ||
| 32013 | |||
| 32014 | |||
| 32015 | //if ( !(DMaps[currdmap].flags&dmfALWAYSMSG) ) { dointro(); } //This is likely what causes Ganon Rooms to repeat the DMap intro. | ||
| 32016 | //If we try it this way: The dmap flag /always display intro string/ is probably why James had this issue. | ||
| 32017 | |||
| 32018 | //The only fix that I can think of, off the top of me head, is either a QR or a Screen Flag to disable the intro text. | ||
| 32019 | //Users who use that dmap rule should put ganons room on its own DMap! -Z | ||
| 32020 | 13 | cont_sfx(WAV_ROAR); | |
| 32021 | 17 | } | |
| 32022 | |||
| 32023 | 10 | void HeroClass::win_game() | |
| 32024 | { | ||
| 32025 |
2/4✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
|
10 | replay_step_comment("win_game"); |
| 32026 | 10 | Playing=Paused=false; | |
| 32027 | 10 | action=won; FFCore.setHeroAction(won); | |
| 32028 | 10 | Quit=qWON; | |
| 32029 | 10 | hclk=0; | |
| 32030 | 10 | x = 136; | |
| 32031 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 9 times.
|
10 | y = (isdungeon() && currscr<128) ? 75 : 73; |
| 32032 | 10 | z = fakez = fall = fakefall = spins = 0; | |
| 32033 | 10 | dir=left; | |
| 32034 | 10 | } | |
| 32035 | |||
| 32036 | 39408 | void HeroClass::reset_swordcharge() | |
| 32037 | { | ||
| 32038 | 39408 | charging=spins=tapping=0; | |
| 32039 | 39408 | } | |
| 32040 | |||
| 32041 | 137913 | void HeroClass::reset_hookshot() | |
| 32042 | { | ||
| 32043 |
10/12✓ Branch 0 taken 88988 times.
✓ Branch 1 taken 48925 times.
✓ Branch 2 taken 88974 times.
✓ Branch 3 taken 14 times.
✓ Branch 4 taken 88893 times.
✓ Branch 5 taken 81 times.
✓ Branch 6 taken 88886 times.
✓ Branch 7 taken 7 times.
✓ Branch 8 taken 88886 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 88886 times.
|
137913 | if(action!=walking && action!=rafting && action!=landhold1 && action!=landhold2 && action!=sidewaterhold1 && action!=sidewaterhold2) |
| 32044 | { | ||
| 32045 | 88886 | action=none; FFCore.setHeroAction(none); | |
| 32046 | 88886 | } | |
| 32047 | |||
| 32048 | 137913 | hookshot_frozen=false; | |
| 32049 | 137913 | hookshot_used=false; | |
| 32050 | 137913 | pull_hero=false; | |
| 32051 | 137913 | hs_fix=false; | |
| 32052 | 137913 | switchhookclk = switchhookmaxtime = switchhookstyle = switchhookarg = 0; | |
| 32053 | 137913 | switch_hooked = false; | |
| 32054 |
2/2✓ Branch 0 taken 137908 times.
✓ Branch 1 taken 5 times.
|
137913 | if(switching_object) |
| 32055 | 5 | switching_object->switch_hooked = false; | |
| 32056 | 137913 | switching_object = NULL; | |
| 32057 | 137913 | hooked_combopos = -1; | |
| 32058 | 137913 | switchhook_cost_item = -1; | |
| 32059 | 137913 | hooked_layerbits = 0; | |
| 32060 |
2/2✓ Branch 0 taken 965391 times.
✓ Branch 1 taken 137913 times.
|
1103304 | for(auto q = 0; q < 7; ++q) |
| 32061 | 965391 | hooked_undercombos[q] = -1; | |
| 32062 | 137913 | Lwpns.del(Lwpns.idFirst(wHSHandle)); | |
| 32063 | 137913 | Lwpns.del(Lwpns.idFirst(wHookshot)); | |
| 32064 | 137913 | chainlinks.clear(); | |
| 32065 |
2/2✓ Branch 0 taken 33496 times.
✓ Branch 1 taken 104417 times.
|
137913 | int32_t index=directWpn>-1 ? directWpn : current_item_id(hs_switcher ? itype_switchhook : itype_hookshot); |
| 32066 | 137913 | hs_switcher = false; | |
| 32067 | |||
| 32068 |
2/2✓ Branch 0 taken 94437 times.
✓ Branch 1 taken 43476 times.
|
137913 | if(index>=0) |
| 32069 | { | ||
| 32070 | 43476 | stop_sfx(itemsbuf[index].usesound); | |
| 32071 | 43476 | } | |
| 32072 | |||
| 32073 | 137913 | hs_xdist=0; | |
| 32074 | 137913 | hs_ydist=0; | |
| 32075 | 137913 | } | |
| 32076 | |||
| 32077 | |||
| 32078 | 16953498 | bool HeroClass::can_deploy_ladder() | |
| 32079 | { | ||
| 32080 |
2/2✓ Branch 0 taken 7099135 times.
✓ Branch 1 taken 9854363 times.
|
29890120 | bool ladderallowed = ((!get_qr(qr_LADDERANYWHERE) && (tmpscr->flags&fLADDER)) || isdungeon() |
| 32081 |
4/4✓ Branch 0 taken 3927525 times.
✓ Branch 1 taken 12936622 times.
✓ Branch 2 taken 4778180 times.
✓ Branch 3 taken 8158442 times.
|
9854363 | || (get_qr(qr_LADDERANYWHERE) && !(tmpscr->flags&fLADDER))); |
| 32082 |
9/10✓ Branch 0 taken 6585084 times.
✓ Branch 1 taken 17378198 times.
✓ Branch 2 taken 2925049 times.
✓ Branch 3 taken 3660035 times.
✓ Branch 4 taken 2924797 times.
✓ Branch 5 taken 252 times.
✓ Branch 6 taken 2924092 times.
✓ Branch 7 taken 705 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 2924092 times.
|
26887374 | return (current_item_id(itype_ladder)>-1 && ladderallowed && !ilswim && z==0 && fakez==0 && |
| 32083 |
2/2✓ Branch 0 taken 2903281 times.
✓ Branch 1 taken 20811 times.
|
2924092 | (!isSideViewHero() || on_sideview_solid_oldpos(this))); |
| 32084 | } | ||
| 32085 | |||
| 32086 | 9609077 | void HeroClass::reset_ladder() | |
| 32087 | { | ||
| 32088 | 9609077 | ladderx=laddery=0; | |
| 32089 | 9609077 | } | |
| 32090 | |||
| 32091 | bool is_conveyor(int32_t type); | ||
| 32092 | int32_t get_conveyor(int32_t x, int32_t y); | ||
| 32093 | |||
| 32094 | 14151802 | void HeroClass::check_conveyor() | |
| 32095 | { | ||
| 32096 | 14151802 | ++newconveyorclk; | |
| 32097 | |||
| 32098 |
2/2✓ Branch 0 taken 14148585 times.
✓ Branch 1 taken 3217 times.
|
14151802 | if (is_conveyor_stunned) |
| 32099 | 3217 | --is_conveyor_stunned; | |
| 32100 | |||
| 32101 |
16/18✓ Branch 0 taken 14147907 times.
✓ Branch 1 taken 3895 times.
✓ Branch 2 taken 14147907 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 14141923 times.
✓ Branch 5 taken 5984 times.
✓ Branch 6 taken 14141923 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 14141667 times.
✓ Branch 9 taken 256 times.
✓ Branch 10 taken 14134372 times.
✓ Branch 11 taken 7295 times.
✓ Branch 12 taken 14117189 times.
✓ Branch 13 taken 17183 times.
✓ Branch 14 taken 14099513 times.
✓ Branch 15 taken 17676 times.
✓ Branch 16 taken 14099793 times.
✓ Branch 17 taken 17396 times.
|
14151802 | if(action==casting||action==sideswimcasting||action==drowning || action==sidedrowning||action==lavadrowning||inlikelike||pull_hero||((z>0||fakez>0) && !(tmpscr->flags2&fAIRCOMBOS))) |
| 32102 | { | ||
| 32103 | 52009 | is_conveyor_stunned = 0; | |
| 32104 | 52009 | return; | |
| 32105 | } | ||
| 32106 | |||
| 32107 | 14099793 | WalkflagInfo info; | |
| 32108 | int32_t xoff,yoff; | ||
| 32109 | 14099793 | zfix deltax(0), deltay(0); | |
| 32110 | 14099793 | int32_t cmbid = get_conveyor(x+7,y+(bigHitbox?8:12)); | |
| 32111 |
2/2✓ Branch 0 taken 19053 times.
✓ Branch 1 taken 14080740 times.
|
14099793 | if(cmbid < 0) |
| 32112 | { | ||
| 32113 |
2/2✓ Branch 0 taken 9408417 times.
✓ Branch 1 taken 4672323 times.
|
14080740 | if (conveyclk <= 0) |
| 32114 | { | ||
| 32115 | 4672323 | is_on_conveyor = false; | |
| 32116 | 4672323 | conv_forcedir = -1; | |
| 32117 | 4672323 | } | |
| 32118 | 14080740 | return; | |
| 32119 | } | ||
| 32120 | 19053 | newcombo const* cmb = &combobuf[cmbid]; | |
| 32121 | 19053 | auto pos = COMBOPOS(x+7,y+(bigHitbox?8:12)); | |
| 32122 | 19053 | bool custom_spd = (cmb->usrflags&cflag2); | |
| 32123 |
3/4✓ Branch 0 taken 15782 times.
✓ Branch 1 taken 3271 times.
✓ Branch 2 taken 15782 times.
✗ Branch 3 not taken.
|
19053 | if(custom_spd || conveyclk<=0) //!DIMITODO: let player be on multiple conveyors at once |
| 32124 | { | ||
| 32125 | 19053 | int32_t ctype=cmb->type; | |
| 32126 |
3/4✓ Branch 0 taken 3271 times.
✓ Branch 1 taken 15782 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3271 times.
|
19053 | auto rate = custom_spd ? zc_max(cmb->attribytes[0], 1) : 3; |
| 32127 |
3/4✓ Branch 0 taken 3271 times.
✓ Branch 1 taken 15782 times.
✓ Branch 2 taken 3271 times.
✗ Branch 3 not taken.
|
19053 | if(custom_spd && (newconveyorclk % rate)) return; |
| 32128 |
3/4✓ Branch 0 taken 3271 times.
✓ Branch 1 taken 15782 times.
✓ Branch 2 taken 3271 times.
✗ Branch 3 not taken.
|
19053 | if((cmb->usrflags&cflag5) && HasHeavyBoots()) |
| 32129 | ✗ | return; | |
| 32130 | 19053 | is_on_conveyor=false; | |
| 32131 | 19053 | conv_forcedir=-1; | |
| 32132 | 19053 | is_conveyor_stunned=0; | |
| 32133 | |||
| 32134 | 19053 | deltax=combo_class_buf[ctype].conveyor_x_speed; | |
| 32135 | 19053 | deltay=combo_class_buf[ctype].conveyor_y_speed; | |
| 32136 | |||
| 32137 |
3/4✓ Branch 0 taken 19053 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15782 times.
✓ Branch 3 taken 3271 times.
|
19053 | if (is_conveyor(ctype) && custom_spd) |
| 32138 | { | ||
| 32139 | 3271 | deltax = zslongToFix(cmb->attributes[0]); | |
| 32140 | 3271 | deltay = zslongToFix(cmb->attributes[1]); | |
| 32141 | 3271 | } | |
| 32142 | |||
| 32143 |
3/8✓ Branch 0 taken 8708 times.
✓ Branch 1 taken 10345 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 8708 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
19053 | if((deltax==0&&deltay==0)&&(isSideViewHero() && on_sideview_solid_oldpos(this))) |
| 32144 | { | ||
| 32145 | ✗ | cmbid = MAPCOMBO(x+8,y+16); | |
| 32146 | ✗ | cmb = &combobuf[cmbid]; | |
| 32147 | ✗ | custom_spd = cmb->usrflags&cflag2; | |
| 32148 | ✗ | ctype=(cmb->type); | |
| 32149 | ✗ | rate = custom_spd ? zc_max(cmb->attribytes[0], 1) : 3; | |
| 32150 | ✗ | deltax=combo_class_buf[ctype].conveyor_x_speed; | |
| 32151 | ✗ | deltay=combo_class_buf[ctype].conveyor_y_speed; | |
| 32152 | ✗ | if ((deltax != 0 || deltay != 0) && custom_spd) | |
| 32153 | { | ||
| 32154 | ✗ | deltax = zslongToFix(cmb->attributes[0]); | |
| 32155 | ✗ | deltay = zslongToFix(cmb->attributes[1]); | |
| 32156 | ✗ | } | |
| 32157 | ✗ | } | |
| 32158 | |||
| 32159 |
3/4✓ Branch 0 taken 8708 times.
✓ Branch 1 taken 10345 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 8708 times.
|
19053 | if(deltax!=0||deltay!=0) |
| 32160 | { | ||
| 32161 | 19053 | is_on_conveyor=true; | |
| 32162 | 19053 | } | |
| 32163 | ✗ | else return; | |
| 32164 | |||
| 32165 |
1/2✓ Branch 0 taken 19053 times.
✗ Branch 1 not taken.
|
19053 | bool forcewalk = (cmb->usrflags&cflag6) && get_qr(qr_NEW_HERO_MOVEMENT2); |
| 32166 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19053 times.
|
19053 | if(forcewalk) |
| 32167 | { | ||
| 32168 | ✗ | is_conveyor_stunned = rate; | |
| 32169 | ✗ | if((cmb->usrflags&cflag3) && !spins) | |
| 32170 | { | ||
| 32171 | ✗ | if(abs(deltax) > abs(deltay)) | |
| 32172 | ✗ | conv_forcedir = dir = (deltax > 0) ? right : left; | |
| 32173 | ✗ | else conv_forcedir = dir = (deltay > 0) ? down : up; | |
| 32174 | ✗ | } | |
| 32175 | ✗ | convey_forcex = deltax; | |
| 32176 | ✗ | convey_forcey = deltay; | |
| 32177 | ✗ | } | |
| 32178 | else | ||
| 32179 | { | ||
| 32180 | 19053 | bool movedx = false, movedy = false; | |
| 32181 |
2/2✓ Branch 0 taken 15782 times.
✓ Branch 1 taken 3271 times.
|
19053 | if(cmb->usrflags&cflag4) //Smart corners |
| 32182 | { | ||
| 32183 |
2/2✓ Branch 0 taken 1095 times.
✓ Branch 1 taken 2176 times.
|
3271 | if(deltay<0) |
| 32184 | { | ||
| 32185 | 1095 | info = walkflag(x,y+8-(bigHitbox*8)-2,2,up); | |
| 32186 | 1095 | execute(info); | |
| 32187 | |||
| 32188 |
2/2✓ Branch 0 taken 51 times.
✓ Branch 1 taken 1044 times.
|
1095 | if(!info.isUnwalkable()) |
| 32189 | { | ||
| 32190 | 1044 | movedy = true; | |
| 32191 | 1044 | zfix step(0); | |
| 32192 | |||
| 32193 |
5/12✓ Branch 0 taken 993 times.
✓ Branch 1 taken 51 times.
✓ Branch 2 taken 144 times.
✓ Branch 3 taken 900 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 144 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
1044 | if((DrunkRight()||DrunkLeft())&&dir!=left&&dir!=right&&!(diagonalMovement||NO_GRIDLOCK)) |
| 32194 | { | ||
| 32195 | ✗ | while(step<(abs(deltay)*(isSideViewHero()?2:1))) | |
| 32196 | { | ||
| 32197 | ✗ | yoff=int32_t(y-step)&7; | |
| 32198 | |||
| 32199 | ✗ | if(!yoff) break; | |
| 32200 | |||
| 32201 | ✗ | step++; | |
| 32202 | } | ||
| 32203 | ✗ | } | |
| 32204 | else | ||
| 32205 | { | ||
| 32206 | 1044 | step=abs(deltay); | |
| 32207 | } | ||
| 32208 | |||
| 32209 | 1044 | y=y-step; | |
| 32210 | 1044 | hs_starty-=step.getInt(); | |
| 32211 | |||
| 32212 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1044 times.
|
1044 | for(int32_t j=0; j<chainlinks.Count(); j++) |
| 32213 | { | ||
| 32214 | ✗ | chainlinks.spr(j)->y-=step; | |
| 32215 | ✗ | } | |
| 32216 | |||
| 32217 |
1/2✓ Branch 0 taken 1044 times.
✗ Branch 1 not taken.
|
1044 | if(Lwpns.idFirst(wHookshot)>-1) |
| 32218 | { | ||
| 32219 | ✗ | Lwpns.spr(Lwpns.idFirst(wHookshot))->y-=step; | |
| 32220 | ✗ | } | |
| 32221 | |||
| 32222 |
1/2✓ Branch 0 taken 1044 times.
✗ Branch 1 not taken.
|
1044 | if(Lwpns.idFirst(wHSHandle)>-1) |
| 32223 | { | ||
| 32224 | ✗ | Lwpns.spr(Lwpns.idFirst(wHSHandle))->y-=step; | |
| 32225 | ✗ | } | |
| 32226 | 1044 | } | |
| 32227 | 1095 | } | |
| 32228 |
2/2✓ Branch 0 taken 1769 times.
✓ Branch 1 taken 407 times.
|
2176 | else if(deltay>0) |
| 32229 | { | ||
| 32230 | 407 | info = walkflag(x,y+15+2,2,down); | |
| 32231 | 407 | execute(info); | |
| 32232 | |||
| 32233 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 402 times.
|
407 | if(!info.isUnwalkable()) |
| 32234 | { | ||
| 32235 | 402 | movedy = true; | |
| 32236 | 402 | zfix step(0); | |
| 32237 | |||
| 32238 |
7/12✓ Branch 0 taken 311 times.
✓ Branch 1 taken 91 times.
✓ Branch 2 taken 91 times.
✓ Branch 3 taken 311 times.
✓ Branch 4 taken 9 times.
✓ Branch 5 taken 82 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 9 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
402 | if((DrunkRight()||DrunkLeft())&&dir!=left&&dir!=right&&!(diagonalMovement||NO_GRIDLOCK)) |
| 32239 | { | ||
| 32240 | ✗ | while(step<abs(deltay)) | |
| 32241 | { | ||
| 32242 | ✗ | yoff=int32_t(y+step)&7; | |
| 32243 | |||
| 32244 | ✗ | if(!yoff) break; | |
| 32245 | |||
| 32246 | ✗ | step++; | |
| 32247 | } | ||
| 32248 | ✗ | } | |
| 32249 | else | ||
| 32250 | { | ||
| 32251 | 402 | step=abs(deltay); | |
| 32252 | } | ||
| 32253 | |||
| 32254 | 402 | y=y+step; | |
| 32255 | 402 | hs_starty+=step.getInt(); | |
| 32256 | |||
| 32257 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 402 times.
|
402 | for(int32_t j=0; j<chainlinks.Count(); j++) |
| 32258 | { | ||
| 32259 | ✗ | chainlinks.spr(j)->y+=step; | |
| 32260 | ✗ | } | |
| 32261 | |||
| 32262 |
1/2✓ Branch 0 taken 402 times.
✗ Branch 1 not taken.
|
402 | if(Lwpns.idFirst(wHookshot)>-1) |
| 32263 | { | ||
| 32264 | ✗ | Lwpns.spr(Lwpns.idFirst(wHookshot))->y+=step; | |
| 32265 | ✗ | } | |
| 32266 | |||
| 32267 |
1/2✓ Branch 0 taken 402 times.
✗ Branch 1 not taken.
|
402 | if(Lwpns.idFirst(wHSHandle)>-1) |
| 32268 | { | ||
| 32269 | ✗ | Lwpns.spr(Lwpns.idFirst(wHSHandle))->y+=step; | |
| 32270 | ✗ | } | |
| 32271 | 402 | } | |
| 32272 | 407 | } | |
| 32273 | |||
| 32274 |
2/2✓ Branch 0 taken 496 times.
✓ Branch 1 taken 2775 times.
|
3271 | if(deltax<0) |
| 32275 | { | ||
| 32276 | 496 | info = walkflag(x-int32_t(lsteps[x.getInt()&7]),y+8-(bigHitbox ? 8 : 0),1,left); | |
| 32277 | 496 | execute(info); | |
| 32278 | |||
| 32279 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 496 times.
|
496 | if(!info.isUnwalkable()) |
| 32280 | { | ||
| 32281 | 496 | movedx = true; | |
| 32282 | 496 | zfix step(0); | |
| 32283 | |||
| 32284 |
7/12✓ Branch 0 taken 482 times.
✓ Branch 1 taken 14 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 486 times.
✓ Branch 4 taken 9 times.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 9 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
496 | if((DrunkUp()||DrunkDown())&&dir!=up&&dir!=down&&!(diagonalMovement||NO_GRIDLOCK)) |
| 32285 | { | ||
| 32286 | ✗ | while(step<abs(deltax)) | |
| 32287 | { | ||
| 32288 | ✗ | xoff=int32_t(x-step)&7; | |
| 32289 | |||
| 32290 | ✗ | if(!xoff) break; | |
| 32291 | |||
| 32292 | ✗ | step++; | |
| 32293 | } | ||
| 32294 | ✗ | } | |
| 32295 | else | ||
| 32296 | { | ||
| 32297 | 496 | step=abs(deltax); | |
| 32298 | } | ||
| 32299 | |||
| 32300 | 496 | x=x-step; | |
| 32301 | 496 | hs_startx-=step.getInt(); | |
| 32302 | |||
| 32303 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 496 times.
|
496 | for(int32_t j=0; j<chainlinks.Count(); j++) |
| 32304 | { | ||
| 32305 | ✗ | chainlinks.spr(j)->x-=step; | |
| 32306 | ✗ | } | |
| 32307 | |||
| 32308 |
1/2✓ Branch 0 taken 496 times.
✗ Branch 1 not taken.
|
496 | if(Lwpns.idFirst(wHookshot)>-1) |
| 32309 | { | ||
| 32310 | ✗ | Lwpns.spr(Lwpns.idFirst(wHookshot))->x-=step; | |
| 32311 | ✗ | } | |
| 32312 | |||
| 32313 |
1/2✓ Branch 0 taken 496 times.
✗ Branch 1 not taken.
|
496 | if(Lwpns.idFirst(wHSHandle)>-1) |
| 32314 | { | ||
| 32315 | ✗ | Lwpns.spr(Lwpns.idFirst(wHSHandle))->x-=step; | |
| 32316 | ✗ | } | |
| 32317 | 496 | } | |
| 32318 | 496 | } | |
| 32319 |
2/2✓ Branch 0 taken 1502 times.
✓ Branch 1 taken 1273 times.
|
2775 | else if(deltax>0) |
| 32320 | { | ||
| 32321 | 1273 | info = walkflag(x+15+2,y+8-(bigHitbox ? 8 : 0),1,right); | |
| 32322 | 1273 | execute(info); | |
| 32323 | |||
| 32324 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 1259 times.
|
1273 | if(!info.isUnwalkable()) |
| 32325 | { | ||
| 32326 | 1259 | movedx = true; | |
| 32327 | 1259 | zfix step(0); | |
| 32328 | |||
| 32329 |
7/12✓ Branch 0 taken 1093 times.
✓ Branch 1 taken 166 times.
✓ Branch 2 taken 181 times.
✓ Branch 3 taken 1078 times.
✓ Branch 4 taken 134 times.
✓ Branch 5 taken 47 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 134 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
1259 | if((DrunkUp()||DrunkDown())&&dir!=up&&dir!=down&&!(diagonalMovement||NO_GRIDLOCK)) |
| 32330 | { | ||
| 32331 | ✗ | while(step<abs(deltax)) | |
| 32332 | { | ||
| 32333 | ✗ | xoff=int32_t(x+step)&7; | |
| 32334 | |||
| 32335 | ✗ | if(!xoff) break; | |
| 32336 | |||
| 32337 | ✗ | step++; | |
| 32338 | } | ||
| 32339 | ✗ | } | |
| 32340 | else | ||
| 32341 | { | ||
| 32342 | 1259 | step=abs(deltax); | |
| 32343 | } | ||
| 32344 | |||
| 32345 | 1259 | x=x+step; | |
| 32346 | 1259 | hs_startx+=step.getInt(); | |
| 32347 | |||
| 32348 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1259 times.
|
1259 | for(int32_t j=0; j<chainlinks.Count(); j++) |
| 32349 | { | ||
| 32350 | ✗ | chainlinks.spr(j)->x+=step; | |
| 32351 | ✗ | } | |
| 32352 | |||
| 32353 |
1/2✓ Branch 0 taken 1259 times.
✗ Branch 1 not taken.
|
1259 | if(Lwpns.idFirst(wHookshot)>-1) |
| 32354 | { | ||
| 32355 | ✗ | Lwpns.spr(Lwpns.idFirst(wHookshot))->x+=step; | |
| 32356 | ✗ | } | |
| 32357 | |||
| 32358 |
1/2✓ Branch 0 taken 1259 times.
✗ Branch 1 not taken.
|
1259 | if(Lwpns.idFirst(wHSHandle)>-1) |
| 32359 | { | ||
| 32360 | ✗ | Lwpns.spr(Lwpns.idFirst(wHSHandle))->x+=step; | |
| 32361 | ✗ | } | |
| 32362 | 1259 | } | |
| 32363 | 1273 | } | |
| 32364 |
5/6✓ Branch 0 taken 1769 times.
✓ Branch 1 taken 1502 times.
✓ Branch 2 taken 14 times.
✓ Branch 3 taken 1755 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 14 times.
|
3271 | if(deltax && !movedx && !deltay) |
| 32365 | { | ||
| 32366 | 14 | zfix oy = y; | |
| 32367 | 14 | y = COMBOY(pos); | |
| 32368 | 14 | bool validpush = scr_canmove(deltax, 0, false, false); | |
| 32369 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
28 | zfix ny = handle_movestate_zfix([&]() |
| 32370 | { | ||
| 32371 | 14 | movexy(deltax,0,false,false,true,true); | |
| 32372 | 14 | return y; | |
| 32373 | }); | ||
| 32374 | 14 | y = oy; | |
| 32375 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
14 | if (validpush || ny != COMBOY(pos)) |
| 32376 | { | ||
| 32377 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | if (y <= ny-1) |
| 32378 | { | ||
| 32379 | 14 | setYfix(y+1); | |
| 32380 | 14 | } | |
| 32381 | ✗ | else if (y >= ny+1) | |
| 32382 | { | ||
| 32383 | ✗ | setYfix(y-1); | |
| 32384 | ✗ | } | |
| 32385 | else | ||
| 32386 | { | ||
| 32387 | ✗ | setYfix(ny); | |
| 32388 | } | ||
| 32389 | 14 | } | |
| 32390 | 14 | } | |
| 32391 |
5/6✓ Branch 0 taken 1502 times.
✓ Branch 1 taken 1769 times.
✓ Branch 2 taken 56 times.
✓ Branch 3 taken 1446 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 56 times.
|
3271 | if(deltay && !movedy && !deltax) |
| 32392 | { | ||
| 32393 | 56 | zfix ox = x; | |
| 32394 | 56 | x = COMBOX(pos); | |
| 32395 | 56 | bool validpush = scr_canmove(0, deltay, false, false); | |
| 32396 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 56 times.
|
112 | zfix nx = handle_movestate_zfix([&]() |
| 32397 | { | ||
| 32398 | 56 | movexy(0,deltay,false,false,true,true); | |
| 32399 | 56 | return x; | |
| 32400 | }); | ||
| 32401 | 56 | x = ox; | |
| 32402 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 56 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
56 | if (validpush || nx != COMBOX(pos)) |
| 32403 | { | ||
| 32404 |
2/2✓ Branch 0 taken 53 times.
✓ Branch 1 taken 3 times.
|
56 | if (x <= nx-1) |
| 32405 | { | ||
| 32406 | 53 | setXfix(x+1); | |
| 32407 | 53 | } | |
| 32408 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | else if (x >= nx+1) |
| 32409 | { | ||
| 32410 | ✗ | setXfix(x-1); | |
| 32411 | ✗ | } | |
| 32412 | else | ||
| 32413 | { | ||
| 32414 | 3 | setXfix(nx); | |
| 32415 | } | ||
| 32416 | 56 | } | |
| 32417 | 56 | } | |
| 32418 | 3271 | } | |
| 32419 |
2/2✓ Branch 0 taken 1446 times.
✓ Branch 1 taken 17607 times.
|
19053 | if(!movedy) |
| 32420 | { | ||
| 32421 |
2/2✓ Branch 0 taken 2764 times.
✓ Branch 1 taken 14843 times.
|
17607 | if(deltay<0) |
| 32422 | { | ||
| 32423 | 2764 | info = walkflag(x,y+8-(bigHitbox*8)-2,2,up); | |
| 32424 | 2764 | execute(info); | |
| 32425 | |||
| 32426 |
2/2✓ Branch 0 taken 247 times.
✓ Branch 1 taken 2517 times.
|
2764 | if(!info.isUnwalkable()) |
| 32427 | { | ||
| 32428 | 2517 | movedy = true; | |
| 32429 | 2517 | zfix step(0); | |
| 32430 | |||
| 32431 |
10/12✓ Branch 0 taken 1942 times.
✓ Branch 1 taken 575 times.
✓ Branch 2 taken 703 times.
✓ Branch 3 taken 1814 times.
✓ Branch 4 taken 218 times.
✓ Branch 5 taken 485 times.
✓ Branch 6 taken 195 times.
✓ Branch 7 taken 23 times.
✓ Branch 8 taken 195 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 195 times.
|
2517 | if((DrunkRight()||DrunkLeft())&&dir!=left&&dir!=right&&!(diagonalMovement||NO_GRIDLOCK)) |
| 32432 | { | ||
| 32433 |
2/2✓ Branch 0 taken 157 times.
✓ Branch 1 taken 373 times.
|
530 | while(step<(abs(deltay)*(isSideViewHero()?2:1))) |
| 32434 | { | ||
| 32435 | 373 | yoff=int32_t(y-step)&7; | |
| 32436 | |||
| 32437 |
2/2✓ Branch 0 taken 335 times.
✓ Branch 1 taken 38 times.
|
373 | if(!yoff) break; |
| 32438 | |||
| 32439 | 335 | step++; | |
| 32440 | } | ||
| 32441 | 195 | } | |
| 32442 | else | ||
| 32443 | { | ||
| 32444 | 2322 | step=abs(deltay); | |
| 32445 | } | ||
| 32446 | |||
| 32447 | 2517 | y=y-step; | |
| 32448 | 2517 | hs_starty-=step.getInt(); | |
| 32449 | |||
| 32450 |
2/2✓ Branch 0 taken 19 times.
✓ Branch 1 taken 2517 times.
|
2536 | for(int32_t j=0; j<chainlinks.Count(); j++) |
| 32451 | { | ||
| 32452 | 19 | chainlinks.spr(j)->y-=step; | |
| 32453 | 19 | } | |
| 32454 | |||
| 32455 |
2/2✓ Branch 0 taken 2498 times.
✓ Branch 1 taken 19 times.
|
2517 | if(Lwpns.idFirst(wHookshot)>-1) |
| 32456 | { | ||
| 32457 | 19 | Lwpns.spr(Lwpns.idFirst(wHookshot))->y-=step; | |
| 32458 | 19 | } | |
| 32459 | |||
| 32460 |
2/2✓ Branch 0 taken 2498 times.
✓ Branch 1 taken 19 times.
|
2517 | if(Lwpns.idFirst(wHSHandle)>-1) |
| 32461 | { | ||
| 32462 | 19 | Lwpns.spr(Lwpns.idFirst(wHSHandle))->y-=step; | |
| 32463 | 19 | } | |
| 32464 | 2517 | } | |
| 32465 | 247 | else checkdamagecombos(x,y+8-(bigHitbox ? 8 : 0)-2); | |
| 32466 | 2764 | } | |
| 32467 |
2/2✓ Branch 0 taken 10345 times.
✓ Branch 1 taken 4498 times.
|
14843 | else if(deltay>0) |
| 32468 | { | ||
| 32469 | 4498 | info = walkflag(x,y+15+2,2,down); | |
| 32470 | 4498 | execute(info); | |
| 32471 | |||
| 32472 |
2/2✓ Branch 0 taken 897 times.
✓ Branch 1 taken 3601 times.
|
4498 | if(!info.isUnwalkable()) |
| 32473 | { | ||
| 32474 | 3601 | movedy = true; | |
| 32475 | 3601 | zfix step(0); | |
| 32476 | |||
| 32477 |
10/12✓ Branch 0 taken 2879 times.
✓ Branch 1 taken 722 times.
✓ Branch 2 taken 956 times.
✓ Branch 3 taken 2645 times.
✓ Branch 4 taken 444 times.
✓ Branch 5 taken 512 times.
✓ Branch 6 taken 388 times.
✓ Branch 7 taken 56 times.
✓ Branch 8 taken 388 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 388 times.
|
3601 | if((DrunkRight()||DrunkLeft())&&dir!=left&&dir!=right&&!(diagonalMovement||NO_GRIDLOCK)) |
| 32478 | { | ||
| 32479 |
2/2✓ Branch 0 taken 235 times.
✓ Branch 1 taken 646 times.
|
881 | while(step<abs(deltay)) |
| 32480 | { | ||
| 32481 | 646 | yoff=int32_t(y+step)&7; | |
| 32482 | |||
| 32483 |
2/2✓ Branch 0 taken 493 times.
✓ Branch 1 taken 153 times.
|
646 | if(!yoff) break; |
| 32484 | |||
| 32485 | 493 | step++; | |
| 32486 | } | ||
| 32487 | 388 | } | |
| 32488 | else | ||
| 32489 | { | ||
| 32490 | 3213 | step=abs(deltay); | |
| 32491 | } | ||
| 32492 | |||
| 32493 | 3601 | y=y+step; | |
| 32494 | 3601 | hs_starty+=step.getInt(); | |
| 32495 | |||
| 32496 |
2/2✓ Branch 0 taken 13 times.
✓ Branch 1 taken 3601 times.
|
3614 | for(int32_t j=0; j<chainlinks.Count(); j++) |
| 32497 | { | ||
| 32498 | 13 | chainlinks.spr(j)->y+=step; | |
| 32499 | 13 | } | |
| 32500 | |||
| 32501 |
2/2✓ Branch 0 taken 3562 times.
✓ Branch 1 taken 39 times.
|
3601 | if(Lwpns.idFirst(wHookshot)>-1) |
| 32502 | { | ||
| 32503 | 39 | Lwpns.spr(Lwpns.idFirst(wHookshot))->y+=step; | |
| 32504 | 39 | } | |
| 32505 | |||
| 32506 |
2/2✓ Branch 0 taken 3562 times.
✓ Branch 1 taken 39 times.
|
3601 | if(Lwpns.idFirst(wHSHandle)>-1) |
| 32507 | { | ||
| 32508 | 39 | Lwpns.spr(Lwpns.idFirst(wHSHandle))->y+=step; | |
| 32509 | 39 | } | |
| 32510 | 3601 | } | |
| 32511 | 897 | else checkdamagecombos(x,y+15); | |
| 32512 | 4498 | } | |
| 32513 | 17607 | } | |
| 32514 |
2/2✓ Branch 0 taken 1755 times.
✓ Branch 1 taken 17298 times.
|
19053 | if(!movedx) |
| 32515 | { | ||
| 32516 |
2/2✓ Branch 0 taken 5381 times.
✓ Branch 1 taken 11917 times.
|
17298 | if(deltax<0) |
| 32517 | { | ||
| 32518 | 5381 | info = walkflag(x-int32_t(lsteps[x.getInt()&7]),y+8-(bigHitbox ? 8 : 0),1,left); | |
| 32519 | 5381 | execute(info); | |
| 32520 | |||
| 32521 |
2/2✓ Branch 0 taken 277 times.
✓ Branch 1 taken 5104 times.
|
5381 | if(!info.isUnwalkable()) |
| 32522 | { | ||
| 32523 | 5104 | movedx = true; | |
| 32524 | 5104 | zfix step(0); | |
| 32525 | |||
| 32526 |
10/12✓ Branch 0 taken 4579 times.
✓ Branch 1 taken 525 times.
✓ Branch 2 taken 689 times.
✓ Branch 3 taken 4415 times.
✓ Branch 4 taken 317 times.
✓ Branch 5 taken 372 times.
✓ Branch 6 taken 244 times.
✓ Branch 7 taken 73 times.
✓ Branch 8 taken 244 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 244 times.
|
5104 | if((DrunkUp()||DrunkDown())&&dir!=up&&dir!=down&&!(diagonalMovement||NO_GRIDLOCK)) |
| 32527 | { | ||
| 32528 |
2/2✓ Branch 0 taken 179 times.
✓ Branch 1 taken 456 times.
|
635 | while(step<abs(deltax)) |
| 32529 | { | ||
| 32530 | 456 | xoff=int32_t(x-step)&7; | |
| 32531 | |||
| 32532 |
2/2✓ Branch 0 taken 391 times.
✓ Branch 1 taken 65 times.
|
456 | if(!xoff) break; |
| 32533 | |||
| 32534 | 391 | step++; | |
| 32535 | } | ||
| 32536 | 244 | } | |
| 32537 | else | ||
| 32538 | { | ||
| 32539 | 4860 | step=abs(deltax); | |
| 32540 | } | ||
| 32541 | |||
| 32542 | 5104 | x=x-step; | |
| 32543 | 5104 | hs_startx-=step.getInt(); | |
| 32544 | |||
| 32545 |
2/2✓ Branch 0 taken 42 times.
✓ Branch 1 taken 5104 times.
|
5146 | for(int32_t j=0; j<chainlinks.Count(); j++) |
| 32546 | { | ||
| 32547 | 42 | chainlinks.spr(j)->x-=step; | |
| 32548 | 42 | } | |
| 32549 | |||
| 32550 |
2/2✓ Branch 0 taken 5053 times.
✓ Branch 1 taken 51 times.
|
5104 | if(Lwpns.idFirst(wHookshot)>-1) |
| 32551 | { | ||
| 32552 | 51 | Lwpns.spr(Lwpns.idFirst(wHookshot))->x-=step; | |
| 32553 | 51 | } | |
| 32554 | |||
| 32555 |
2/2✓ Branch 0 taken 5053 times.
✓ Branch 1 taken 51 times.
|
5104 | if(Lwpns.idFirst(wHSHandle)>-1) |
| 32556 | { | ||
| 32557 | 51 | Lwpns.spr(Lwpns.idFirst(wHSHandle))->x-=step; | |
| 32558 | 51 | } | |
| 32559 | 5104 | } | |
| 32560 | 277 | else checkdamagecombos(x-int32_t(lsteps[x.getInt()&7]),y+8-(bigHitbox ? 8 : 0)); | |
| 32561 | 5381 | } | |
| 32562 |
2/2✓ Branch 0 taken 8708 times.
✓ Branch 1 taken 3209 times.
|
11917 | else if(deltax>0) |
| 32563 | { | ||
| 32564 | 3209 | info = walkflag(x+15+2,y+8-(bigHitbox ? 8 : 0),1,right); | |
| 32565 | 3209 | execute(info); | |
| 32566 | |||
| 32567 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 3127 times.
|
3209 | if(!info.isUnwalkable()) |
| 32568 | { | ||
| 32569 | 3127 | movedx = true; | |
| 32570 | 3127 | zfix step(0); | |
| 32571 | |||
| 32572 |
10/12✓ Branch 0 taken 2627 times.
✓ Branch 1 taken 500 times.
✓ Branch 2 taken 510 times.
✓ Branch 3 taken 2617 times.
✓ Branch 4 taken 309 times.
✓ Branch 5 taken 201 times.
✓ Branch 6 taken 203 times.
✓ Branch 7 taken 106 times.
✓ Branch 8 taken 203 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 203 times.
|
3127 | if((DrunkUp()||DrunkDown())&&dir!=up&&dir!=down&&!(diagonalMovement||NO_GRIDLOCK)) |
| 32573 | { | ||
| 32574 |
2/2✓ Branch 0 taken 119 times.
✓ Branch 1 taken 341 times.
|
460 | while(step<abs(deltax)) |
| 32575 | { | ||
| 32576 | 341 | xoff=int32_t(x+step)&7; | |
| 32577 | |||
| 32578 |
2/2✓ Branch 0 taken 257 times.
✓ Branch 1 taken 84 times.
|
341 | if(!xoff) break; |
| 32579 | |||
| 32580 | 257 | step++; | |
| 32581 | } | ||
| 32582 | 203 | } | |
| 32583 | else | ||
| 32584 | { | ||
| 32585 | 2924 | step=abs(deltax); | |
| 32586 | } | ||
| 32587 | |||
| 32588 | 3127 | x=x+step; | |
| 32589 | 3127 | hs_startx+=step.getInt(); | |
| 32590 | |||
| 32591 |
2/2✓ Branch 0 taken 21 times.
✓ Branch 1 taken 3127 times.
|
3148 | for(int32_t j=0; j<chainlinks.Count(); j++) |
| 32592 | { | ||
| 32593 | 21 | chainlinks.spr(j)->x+=step; | |
| 32594 | 21 | } | |
| 32595 | |||
| 32596 |
2/2✓ Branch 0 taken 3104 times.
✓ Branch 1 taken 23 times.
|
3127 | if(Lwpns.idFirst(wHookshot)>-1) |
| 32597 | { | ||
| 32598 | 23 | Lwpns.spr(Lwpns.idFirst(wHookshot))->x+=step; | |
| 32599 | 23 | } | |
| 32600 | |||
| 32601 |
2/2✓ Branch 0 taken 3104 times.
✓ Branch 1 taken 23 times.
|
3127 | if(Lwpns.idFirst(wHSHandle)>-1) |
| 32602 | { | ||
| 32603 | 23 | Lwpns.spr(Lwpns.idFirst(wHSHandle))->x+=step; | |
| 32604 | 23 | } | |
| 32605 | 3127 | } | |
| 32606 | 82 | else checkdamagecombos(x+15+2,y+8-(bigHitbox ? 8 : 0)); | |
| 32607 | 3209 | } | |
| 32608 | 17298 | } | |
| 32609 |
4/4✓ Branch 0 taken 9067 times.
✓ Branch 1 taken 9986 times.
✓ Branch 2 taken 7564 times.
✓ Branch 3 taken 1503 times.
|
19053 | if(movedx || movedy) |
| 32610 | { | ||
| 32611 |
2/2✓ Branch 0 taken 14333 times.
✓ Branch 1 taken 3217 times.
|
17550 | if(cmb->usrflags&cflag1) |
| 32612 | 3217 | is_conveyor_stunned = rate; | |
| 32613 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 17550 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
17550 | if((cmb->usrflags&cflag3) && !spins) |
| 32614 | { | ||
| 32615 | ✗ | if(abs(deltax) > abs(deltay)) | |
| 32616 | ✗ | conv_forcedir = dir = (deltax > 0) ? right : left; | |
| 32617 | ✗ | else conv_forcedir = dir = (deltay > 0) ? down : up; | |
| 32618 | ✗ | } | |
| 32619 | 17550 | } | |
| 32620 | } | ||
| 32621 | 19053 | } | |
| 32622 | 14151802 | } | |
| 32623 | |||
| 32624 | ✗ | void HeroClass::setDivineProtectionShieldClk(int32_t newclk) | |
| 32625 | { | ||
| 32626 | ✗ | DivineProtectionShieldClk=newclk; | |
| 32627 | |||
| 32628 | ✗ | if(decorations.idCount(dDIVINEPROTECTIONSHIELD)==0) | |
| 32629 | { | ||
| 32630 | decoration *dec; | ||
| 32631 | ✗ | decorations.add(new dDivineProtectionShield(HeroX(), HeroY(), dDIVINEPROTECTIONSHIELD, 0)); | |
| 32632 | ✗ | decorations.spr(decorations.Count()-1)->misc=0; | |
| 32633 | ✗ | decorations.add(new dDivineProtectionShield(HeroX(), HeroY(), dDIVINEPROTECTIONSHIELD, 0)); | |
| 32634 | ✗ | dec=(decoration *)decorations.spr(decorations.Count()-1); | |
| 32635 | ✗ | decorations.spr(decorations.Count()-1)->misc=1; | |
| 32636 | ✗ | } | |
| 32637 | ✗ | } | |
| 32638 | |||
| 32639 | 35453 | int32_t HeroClass::getDivineProtectionShieldClk() | |
| 32640 | { | ||
| 32641 | 35453 | return DivineProtectionShieldClk; | |
| 32642 | } | ||
| 32643 | |||
| 32644 | 21 | int32_t HeroClass::getHoverClk() | |
| 32645 | { | ||
| 32646 | 21 | return hoverclk; | |
| 32647 | } | ||
| 32648 | |||
| 32649 | 25673289 | int32_t HeroClass::getHoldClk() | |
| 32650 | { | ||
| 32651 | 25673289 | return holdclk; | |
| 32652 | } | ||
| 32653 | |||
| 32654 | 8260655 | int32_t HeroClass::getLastLensID(){ | |
| 32655 | 8260655 | return last_lens_id; | |
| 32656 | } | ||
| 32657 | |||
| 32658 | 209 | void HeroClass::setLastLensID(int32_t p_item){ | |
| 32659 | 209 | last_lens_id = p_item; | |
| 32660 | 209 | } | |
| 32661 | |||
| 32662 | 118421143 | bool HeroClass::getOnSideviewLadder() | |
| 32663 | { | ||
| 32664 | 118421143 | return on_sideview_ladder; | |
| 32665 | } | ||
| 32666 | |||
| 32667 | 352 | void HeroClass::setOnSideviewLadder(bool val) | |
| 32668 | { | ||
| 32669 |
1/2✓ Branch 0 taken 352 times.
✗ Branch 1 not taken.
|
352 | if(val) |
| 32670 | { | ||
| 32671 | ✗ | fall = fakefall = hoverclk = jumping = 0; | |
| 32672 | ✗ | hoverflags = 0; | |
| 32673 | ✗ | inair = false; | |
| 32674 | ✗ | } | |
| 32675 | 352 | on_sideview_ladder = val; | |
| 32676 | 352 | } | |
| 32677 | |||
| 32678 | 4636539 | bool HeroClass::canSideviewLadder(bool down) | |
| 32679 | { | ||
| 32680 |
2/2✓ Branch 0 taken 4602632 times.
✓ Branch 1 taken 33907 times.
|
4636539 | if(!isSideViewHero()) return false; |
| 32681 |
2/2✓ Branch 0 taken 20701 times.
✓ Branch 1 taken 13206 times.
|
33907 | if(jumping < 0) return false; |
| 32682 |
2/2✓ Branch 0 taken 12182 times.
✓ Branch 1 taken 8519 times.
|
20701 | if (down) |
| 32683 | { | ||
| 32684 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8519 times.
|
8519 | if (check_new_slope(x, y + 0.0001_zf, 16, 16, old_x, old_y, true)) |
| 32685 | { | ||
| 32686 | ✗ | return false; | |
| 32687 | } | ||
| 32688 | 8519 | } | |
| 32689 |
3/4✓ Branch 0 taken 8519 times.
✓ Branch 1 taken 12182 times.
✓ Branch 2 taken 8519 times.
✗ Branch 3 not taken.
|
20701 | if(down && get_qr(qr_DOWN_DOESNT_GRAB_LADDERS)) |
| 32690 | { | ||
| 32691 | ✗ | bool onSolid = on_sideview_solid_oldpos(this,true); | |
| 32692 | ✗ | return ((isSVLadder(x+4,y+16) && (!isSVLadder(x+4,y)||onSolid)) || (isSVLadder(x+12,y+16) && (!isSVLadder(x+12,y)||onSolid))); | |
| 32693 | } | ||
| 32694 | //Are you presently able to climb a sideview ladder? | ||
| 32695 | //x+4 / +12 are the offsets used for detecting a platform below you in sideview | ||
| 32696 | //y+0 checks your top-half for large hitbox; y+8 for small | ||
| 32697 | //y+15 checks if you are on one at all. This is necessary so you don't just fall off before reaching the top. | ||
| 32698 | //y+16 check is for going down onto a ladder you are standing on. | ||
| 32699 |
1/2✓ Branch 0 taken 20701 times.
✗ Branch 1 not taken.
|
41402 | return (isSVLadder(x+4,y+(bigHitbox?0:8)) || isSVLadder(x+12,y+(bigHitbox?0:8))) |
| 32700 |
2/4✓ Branch 0 taken 20701 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 20701 times.
✗ Branch 3 not taken.
|
20701 | || isSVLadder(x+4,y+15) || isSVLadder(x+12,y+15) |
| 32701 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 20701 times.
✓ Branch 2 taken 12182 times.
✓ Branch 3 taken 8519 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 8519 times.
|
29220 | || (down && (isSVLadder(x+4,y+16) || isSVLadder(x+12,y+16))); |
| 32702 | 4636539 | } | |
| 32703 | |||
| 32704 | ✗ | bool HeroClass::canSideviewLadderRemote(int32_t wx, int32_t wy, bool down) | |
| 32705 | { | ||
| 32706 | ✗ | if(!isSideViewHero()) return false; | |
| 32707 | ✗ | if(jumping < 0) return false; | |
| 32708 | ✗ | if(down && get_qr(qr_DOWN_DOESNT_GRAB_LADDERS)) | |
| 32709 | { | ||
| 32710 | ✗ | bool onSolid = on_sideview_solid_oldpos(this,true); | |
| 32711 | ✗ | return ((isSVLadder(wx+4,wy+16) && (!isSVLadder(wx+4,wy)||onSolid)) || (isSVLadder(wx+12,wy+16) && (!isSVLadder(wx+12,wy)||onSolid))); | |
| 32712 | } | ||
| 32713 | //Are you presently able to climb a sideview ladder? | ||
| 32714 | //x+4 / +12 are the offsets used for detecting a platform below you in sideview | ||
| 32715 | //y+0 checks your top-half for large hitbox; y+8 for small | ||
| 32716 | //y+15 checks if you are on one at all. This is necessary so you don't just fall off before reaching the top. | ||
| 32717 | //y+16 check is for going down onto a ladder you are standing on. | ||
| 32718 | ✗ | return (isSVLadder(wx+4,wy+(bigHitbox?0:8)) || isSVLadder(wx+12,wy+(bigHitbox?0:8))) | |
| 32719 | ✗ | || isSVLadder(wx+4,wy+15) || isSVLadder(wx+12,wy+15) | |
| 32720 | ✗ | || (down && (isSVLadder(wx+4,wy+16) || isSVLadder(wx+12,wy+16))); | |
| 32721 | ✗ | } | |
| 32722 | |||
| 32723 | 9863001 | void HeroClass::execute(HeroClass::WalkflagInfo info) | |
| 32724 | { | ||
| 32725 | 9863001 | int32_t flags = info.getFlags(); | |
| 32726 | |||
| 32727 |
2/2✓ Branch 0 taken 1770 times.
✓ Branch 1 taken 9861231 times.
|
9863001 | if(flags & WalkflagInfo::CLEARILSWIM) |
| 32728 | 1770 | ilswim =false; | |
| 32729 |
2/2✓ Branch 0 taken 9857891 times.
✓ Branch 1 taken 3340 times.
|
9861231 | else if(flags & WalkflagInfo::SETILSWIM) |
| 32730 | 3340 | ilswim = true; | |
| 32731 | |||
| 32732 |
1/2✓ Branch 0 taken 9863001 times.
✗ Branch 1 not taken.
|
9863001 | if(flags & WalkflagInfo::CLEARCHARGEATTACK) |
| 32733 | { | ||
| 32734 | ✗ | charging = 0; | |
| 32735 | ✗ | attackclk = 0; | |
| 32736 | ✗ | } | |
| 32737 | |||
| 32738 |
1/2✓ Branch 0 taken 9863001 times.
✗ Branch 1 not taken.
|
9863001 | if(flags & WalkflagInfo::SETDIR) |
| 32739 | { | ||
| 32740 | ✗ | dir = info.getDir(); | |
| 32741 | ✗ | } | |
| 32742 | |||
| 32743 |
2/2✓ Branch 0 taken 9861713 times.
✓ Branch 1 taken 1288 times.
|
9863001 | if(flags & WalkflagInfo::SETHOPCLK) |
| 32744 | { | ||
| 32745 | 1288 | hopclk = info.getHopClk(); | |
| 32746 | 1288 | } | |
| 32747 | |||
| 32748 |
2/2✓ Branch 0 taken 9861557 times.
✓ Branch 1 taken 1444 times.
|
9863001 | if(flags & WalkflagInfo::SETHOPDIR) |
| 32749 | { | ||
| 32750 | 1444 | hopdir = info.getHopDir(); | |
| 32751 | 1444 | } | |
| 32752 | |||
| 32753 | 9863001 | } | |
| 32754 | |||
| 32755 | 17641537 | HeroClass::WalkflagInfo HeroClass::WalkflagInfo::operator ||(HeroClass::WalkflagInfo other) | |
| 32756 | { | ||
| 32757 | 17641537 | HeroClass::WalkflagInfo ret; | |
| 32758 | 17641537 | ret.newhopclk = newhopclk; | |
| 32759 | 17641537 | ret.newdir = newdir; | |
| 32760 |
2/2✓ Branch 0 taken 14652304 times.
✓ Branch 1 taken 2989233 times.
|
17641537 | ret.newhopdir = (other.newhopdir >-1 ? other.newhopdir : newhopdir); |
| 32761 | |||
| 32762 | 17641537 | int32_t flags1 = (flags & ~UNWALKABLE) & (other.flags & ~UNWALKABLE); | |
| 32763 | 17641537 | int32_t flags2 = (flags & UNWALKABLE) | (other.flags & UNWALKABLE); | |
| 32764 | 17641537 | ret.flags = flags1 | flags2; | |
| 32765 | 17641537 | return ret; | |
| 32766 | } | ||
| 32767 | |||
| 32768 | 211678 | HeroClass::WalkflagInfo HeroClass::WalkflagInfo::operator &&(HeroClass::WalkflagInfo other) | |
| 32769 | { | ||
| 32770 | 211678 | HeroClass::WalkflagInfo ret; | |
| 32771 | 211678 | ret.newhopclk = newhopclk; | |
| 32772 | 211678 | ret.newdir = newdir; | |
| 32773 |
1/2✓ Branch 0 taken 211678 times.
✗ Branch 1 not taken.
|
211678 | ret.newhopdir = (other.newhopdir >-1 ? other.newhopdir : newhopdir); |
| 32774 | |||
| 32775 | 211678 | ret.flags = flags & other.flags; | |
| 32776 | 211678 | return ret; | |
| 32777 | } | ||
| 32778 | |||
| 32779 | 211678 | HeroClass::WalkflagInfo HeroClass::WalkflagInfo::operator !() | |
| 32780 | { | ||
| 32781 | 211678 | HeroClass::WalkflagInfo ret; | |
| 32782 | 211678 | ret.newhopclk = newhopclk; | |
| 32783 | 211678 | ret.newdir = newdir; | |
| 32784 | 211678 | ret.newhopdir = newhopdir; | |
| 32785 | |||
| 32786 | 211678 | ret.flags = flags ^ UNWALKABLE; | |
| 32787 | 211678 | return ret; | |
| 32788 | } | ||
| 32789 | |||
| 32790 | ✗ | void HeroClass::explode(int32_t type) | |
| 32791 | { | ||
| 32792 | static int32_t tempx, tempy; | ||
| 32793 | static byte herotilebuf[256]; | ||
| 32794 | ✗ | int32_t ltile=0; | |
| 32795 | ✗ | int32_t lflip=0; | |
| 32796 | ✗ | bool shieldModify=true; | |
| 32797 | ✗ | unpack_tile(newtilebuf, tile, flip, true); | |
| 32798 | ✗ | memcpy(herotilebuf, unpackbuf, 256); | |
| 32799 | ✗ | tempx=Hero.getX(); | |
| 32800 | ✗ | tempy=Hero.getY(); | |
| 32801 | ✗ | for(int32_t i=0; i<16; ++i) | |
| 32802 | { | ||
| 32803 | ✗ | for(int32_t j=0; j<16; ++j) | |
| 32804 | { | ||
| 32805 | ✗ | if(herotilebuf[i*16+j]) | |
| 32806 | { | ||
| 32807 | ✗ | if(type==0) // Twilight | |
| 32808 | { | ||
| 32809 | ✗ | particles.add(new pTwilight(Hero.getX()+j, Hero.getY()-Hero.getZ()+i, 5, 0, 0, (zc_oldrand()%8)+i*4)); | |
| 32810 | ✗ | int32_t k=particles.Count()-1; | |
| 32811 | ✗ | particle *p = (particles.at(k)); | |
| 32812 | ✗ | p->step=3; | |
| 32813 | ✗ | } | |
| 32814 | ✗ | else if(type ==1) // Sands of Hours | |
| 32815 | { | ||
| 32816 | ✗ | particles.add(new pTwilight(Hero.getX()+j, Hero.getY()-Hero.getZ()+i, 5, 1, 2, (zc_oldrand()%16)+i*2)); | |
| 32817 | ✗ | int32_t k=particles.Count()-1; | |
| 32818 | ✗ | particle *p = (particles.at(k)); | |
| 32819 | ✗ | p->step=4; | |
| 32820 | |||
| 32821 | ✗ | if(zc_oldrand()%10 < 2) | |
| 32822 | { | ||
| 32823 | ✗ | p->color=1; | |
| 32824 | ✗ | p->cset=0; | |
| 32825 | ✗ | } | |
| 32826 | ✗ | } | |
| 32827 | else | ||
| 32828 | { | ||
| 32829 | ✗ | particles.add(new pDivineEscapeDust(Hero.getX()+j, Hero.getY()-Hero.getZ()+i, 5, 6, herotilebuf[i*16+j], zc_oldrand()%96)); | |
| 32830 | |||
| 32831 | ✗ | int32_t k=particles.Count()-1; | |
| 32832 | ✗ | particle *p = (particles.at(k)); | |
| 32833 | ✗ | p->angular=true; | |
| 32834 | ✗ | p->angle=zc_oldrand(); | |
| 32835 | ✗ | p->step=(((double)j)/8); | |
| 32836 | ✗ | p->yofs=Hero.getYOfs(); | |
| 32837 | } | ||
| 32838 | ✗ | } | |
| 32839 | ✗ | } | |
| 32840 | ✗ | } | |
| 32841 | ✗ | } | |
| 32842 | |||
| 32843 | 2224 | void HeroClass::SetSwim() | |
| 32844 | { | ||
| 32845 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2224 times.
|
2224 | if (CanSideSwim()) |
| 32846 | { | ||
| 32847 | ✗ | if (action != sideswimattacking && action != attacking) {action=sideswimming; FFCore.setHeroAction(sideswimming);} | |
| 32848 | ✗ | else {action=sideswimattacking; FFCore.setHeroAction(sideswimattacking);} | |
| 32849 | ✗ | if (get_qr(qr_SIDESWIMDIR) && spins <= 0 && dir != left && dir != right) dir = sideswimdir; | |
| 32850 | ✗ | } | |
| 32851 | 2224 | else {action=swimming; FFCore.setHeroAction(swimming);} | |
| 32852 | 2224 | } | |
| 32853 | |||
| 32854 | 122945 | void HeroClass::SetAttack() | |
| 32855 | { | ||
| 32856 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 122945 times.
|
122945 | if (IsSideSwim()) {action=sideswimattacking; FFCore.setHeroAction(sideswimattacking);} |
| 32857 | 122945 | else {action=attacking; FFCore.setHeroAction(attacking);} | |
| 32858 | 122945 | } | |
| 32859 | |||
| 32860 | 134703033 | bool HeroClass::IsSideSwim() | |
| 32861 | { | ||
| 32862 |
6/12✓ Branch 0 taken 134703033 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 134703033 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 134703033 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 134703033 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 134703033 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 134703033 times.
|
134703033 | return (action==sideswimming || action==sideswimhit || action == sideswimattacking || action == sidewaterhold1 || action == sidewaterhold2 || action == sideswimcasting || action == sideswimfreeze); |
| 32863 | } | ||
| 32864 | |||
| 32865 | 2774061 | bool HeroClass::CanSideSwim() | |
| 32866 | { | ||
| 32867 |
1/2✓ Branch 0 taken 2774061 times.
✗ Branch 1 not taken.
|
2774061 | return (isSideViewHero() && get_qr(qr_SIDESWIM)); |
| 32868 | } | ||
| 32869 | |||
| 32870 | 12789154 | int32_t HeroClass::getTileModifier() | |
| 32871 | { | ||
| 32872 | 12789154 | return item_tile_mod() + bunny_tile_mod(); | |
| 32873 | } | ||
| 32874 | ✗ | void HeroClass::setImmortal(int32_t nimmortal) | |
| 32875 | { | ||
| 32876 | ✗ | immortal = nimmortal; | |
| 32877 | ✗ | } | |
| 32878 | ✗ | void HeroClass::kill(bool bypassFairy) | |
| 32879 | { | ||
| 32880 | ✗ | dying_flags = DYING_FORCED | (bypassFairy ? DYING_NOREV : 0); | |
| 32881 | ✗ | } | |
| 32882 | 44111413 | bool HeroClass::sideview_mode() const | |
| 32883 | { | ||
| 32884 |
3/4✓ Branch 0 taken 766343 times.
✓ Branch 1 taken 43345070 times.
✓ Branch 2 taken 766343 times.
✗ Branch 3 not taken.
|
44111413 | return isSideViewHero() && (moveflags & move_obeys_grav) && !toogam; |
| 32885 | } | ||
| 32886 | 18082 | bool HeroClass::is_unpushable() const | |
| 32887 | { | ||
| 32888 | 18082 | return toogam; | |
| 32889 | } | ||
| 32890 |